{{- range $name, $component := .Values.components }} --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "chart.componentFullname" (dict "root" $ "name" $name) }} labels: {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 4 }} spec: {{- if not $component.autoscaling.enabled }} replicas: {{ $component.replicaCount }} {{- end }} selector: matchLabels: {{- include "chart.componentSelectorLabels" (dict "root" $ "name" $name) | nindent 6 }} template: metadata: {{- with $component.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 8 }} {{- with $component.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with $.Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "chart.serviceAccountName" $ }} {{- with (default $.Values.podSecurityContext $component.podSecurityContext) }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ $name }} {{- with (default $.Values.securityContext $component.securityContext) }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} image: "{{ $component.image.repository }}:{{ $component.image.tag | default $.Chart.AppVersion }}" imagePullPolicy: {{ $component.image.pullPolicy }} ports: - name: {{ $component.service.portName | default "http" }} containerPort: {{ $component.containerPort | default $component.service.port }} protocol: TCP {{- with $component.env }} env: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with $component.envFrom }} envFrom: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with $component.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with $component.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with $component.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with $component.volumeMounts }} volumeMounts: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with $component.volumes }} volumes: {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} {{- with $.Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with $.Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with $.Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}