Skip to content

Add selector to deployment resource

Thong Kuah requested to merge deployment_selector into master

This is a required value for apps/v1 but option for extensions/v1beta1. In preparation, provide an option to enable selectors

Related issue: #8 (closed)

Manual QA

  1. Deployed an minimal-ruby-app successfully.
  2. Add the chart from this MR with default enableSelector value (nil). Deploy was successful too.
  3. Added .gitlab/auto-deploy-values.yaml file. Deployment was successful too.
enableSelector: true

Selector after step 3:

$ kc get deployments production -n minimal-ruby-app-15-production -o yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    app.gitlab.com/app: hello-woww-minimal-ruby-app
    app.gitlab.com/env: production
    deployment.kubernetes.io/revision: "3"
  creationTimestamp: "2020-01-31T03:00:52Z"
  generation: 3
  labels:
    app: production
    chart: auto-deploy-app-0.4.1
    heritage: Tiller
    release: production
    tier: web
    track: stable
  name: production
  namespace: minimal-ruby-app-15-production
  resourceVersion: "39928"
  selfLink: /apis/extensions/v1beta1/namespaces/minimal-ruby-app-15-production/deployments/production
  uid: e431dc9d-43d5-11ea-ad1d-42010a940152
spec:
  progressDeadlineSeconds: 2147483647
  replicas: 1
  revisionHistoryLimit: 2147483647
  selector:
    matchLabels:
      app: production
      release: production
      tier: web
      track: stable
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      annotations:
        app.gitlab.com/app: hello-woww-minimal-ruby-app
        app.gitlab.com/env: production
        checksum/application-secrets: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
      creationTimestamp: null
      labels:
        app: production
        release: production
        tier: web
        track: stable
Edited by Thong Kuah

Merge request reports