Skip to content

Deployment

Definition

workload:
  kind: Deployment
  replicas: 3
  clusterRole: application

deployment:
  spec:
    strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
    template: 
      metadata:
        labels:
          custom-label: "custom label"
        annotations:
          custom-annotation: "custom annotation"
      spec:
        terminationGracePeriodSeconds: 60
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations: {}
  labels:
    app.kubernetes.io/component: cicd-sample
    app.kubernetes.io/instance: docs
    app.kubernetes.io/managed-by: helm
    app.kubernetes.io/name: cicd-sample
    app.kubernetes.io/part-of: cicd
    app.kubernetes.io/version: 1.0.0
    exordis/application: cicd-sample
    exordis/application-instance: docs
    exordis/application-type: service
    exordis/application-workload: "true"
    exordis/environment: test
    exordis/product: Some Product
    exordis/subsystem: cicd
    helm.sh/chart: cicd-subsystem-application-0.1.0
  name: cicd-sample-docs
  namespace: cicd-test
spec:
  replicas: 3
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      exordis/application: cicd-sample
      exordis/application-instance: docs
      exordis/application-workload: "true"
      exordis/environment: test
      exordis/subsystem: cicd
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/configMap.config-map-with-containers: 48b7e320feb03b105aa89ed415344c030af90d34a34c66f56146d9f0fd2da3e3
        checksum/configMap.config-map-without-containers: 1dbfa263d171e565d412b904c69bdf60fc6bc8db2fcb31e13049242a8bbdecac
        checksum/configMap.envs: 7804c1a2bc6fb98bc7b87c036f6bdb678f897e534204c2e4efd7d881bf5b2924
        checksum/configMap.external-secret-template: f921d5d8c41b9909941321f0d31975eb7ca6d83cba279a6fa91b5f035c9c3f56
        checksum/secret.secret-with-containers: 8e0836f50407f40dc36bf200910416c00f82b8bf5284ab96e908b1d709eb65e3
        checksum/secret.secret-without-containers: 2e931d517cebd760f5460ea95663a82d8df2673e2c075918c21b33c96bfd6686
        custom-annotation: custom annotation
      labels:
        app.kubernetes.io/component: cicd-sample
        app.kubernetes.io/instance: docs
        app.kubernetes.io/managed-by: helm
        app.kubernetes.io/name: cicd-sample
        app.kubernetes.io/part-of: cicd
        app.kubernetes.io/version: 1.0.0
        custom-label: custom label
        exordis/application: cicd-sample
        exordis/application-instance: docs
        exordis/application-type: service
        exordis/application-workload: "true"
        exordis/environment: test
        exordis/product: Some Product
        exordis/subsystem: cicd
        helm.sh/chart: cicd-subsystem-application-0.1.0
    spec:
      containers:
        - envFrom:
            - secretRef:
                name: cicd-sample-docs-external-full
            - secretRef:
                name: cicd-sample-docs-secret-without-containers
            - secretRef:
                name: cicd-sample-docs-secret-with-containers
            - configMapRef:
                name: cicd-sample-docs-envs
            - configMapRef:
                name: cicd-sample-docs-config-map-without-containers
            - configMapRef:
                name: cicd-sample-docs-config-map-with-containers
          image: registry.gitlab.com/cicd-unittests:1.0.0
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 30
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 1
          name: application
          ports:
            - containerPort: 80
              name: http
              protocol: TCP
          readinessProbe:
            failureThreshold: 30
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 1
          resources:
            limits:
              cpu: 200m
              memory: 256Mi
            requests:
              cpu: 50m
              memory: 64Mi
          startupProbe:
            failureThreshold: 30
            periodSeconds: 5
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 1
          volumeMounts:
            - mountPath: /some-data
              name: volume1
            - mountPath: /pvc-data
              name: mypvc
        - envFrom:
            - secretRef:
                name: cicd-sample-docs-external-full
            - secretRef:
                name: cicd-sample-docs-secret-without-containers
            - configMapRef:
                name: cicd-sample-docs-envs
            - configMapRef:
                name: cicd-sample-docs-config-map-without-containers
          image: docker.io/jsreport/jsreport:4.7.0
          imagePullPolicy: IfNotPresent
          name: jsreport
          resources:
            limits:
              cpu: 200m
              memory: 256Mi
            requests:
              cpu: 50m
              memory: 64Mi
          volumeMounts:
            - mountPath: /some-another-data-but-same-as-for-application
              name: volume1
      initContainers:
        - envFrom:
            - secretRef:
                name: cicd-sample-docs-external-full
            - secretRef:
                name: cicd-sample-docs-secret-without-containers
            - configMapRef:
                name: cicd-sample-docs-envs
            - configMapRef:
                name: cicd-sample-docs-config-map-without-containers
          image: registry.gitlab.com/my-migration-image:1.0.0
          imagePullPolicy: Always
          name: migration
          resources:
            limits:
              cpu: 200m
              memory: 256Mi
            requests:
              cpu: 50m
              memory: 64Mi
          volumeMounts: []
      serviceAccountName: cicd-sample-docs-workload
      terminationGracePeriodSeconds: 60
      volumes:
        - name: mypvc
          persistentVolumeClaim:
            claimName: cicd-sample-docs-mypvc
        - emptyDir:
            sizeLimit: 100Mi
          name: volume1
namespace

deployment namespace

default: subsystem namespace generated by convention

labels

list of labels to add to secret in addition to common labels

default: empty dict

annotations

list of annotations to add to secret in addition to common labels

default: empty dict

spec

Deployment kubernetes manifests spec field value. (spec.replicas, spec.selector, spec.template.spec.containers, spec.template.spec.initContainers, spec.template.spec.volumes are ignored, see overrides and manifest generation bellow)

default:

revisionHistoryLimit: 2

Validations

None

Overrides

name

generated with naming conventions with workload as deployment id

spec.replicas

populated with Values.replicas

spec.selector

populated to match application pods

spec.template

generated from Containers and Volumes

Manifests Generation

  • common labels are added to metadata and spec.template.metadata
  • Annotations with checksum for Secrets, External Secrets and Config Maps are generated. (see corresponding articles)
  • spec.selector is generated to match application pods
  • spec.template.spec.containers is generated from Containers
  • spec.template.spec.initContainers is generated from Containers
  • spec.template.spec.volumes is generated from Volumes