{{- range .Values.deployments }} --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "exam.fullname" $ }}-{{ .name }} labels: app: {{ .name }} {{- include "exam.labels" $ | nindent 4 }} spec: replicas: {{ default "1" .replicas }} selector: matchLabels: app: {{ .name }} tier: {{ .tier }} {{- include "exam.selectorLabels" $ | nindent 6 }} template: metadata: labels: app: {{ .name }} tier: {{ .tier }} {{- include "exam.selectorLabels" $ | nindent 8 }} spec: {{- if .initContainer }} initContainers: - name: {{ .name }}-init {{- with .image }} image: {{ .repository }}:{{ .tag | default $.Chart.AppVersion }} {{- end }} {{- with .initContainer }} {{- toYaml . | nindent 10 }} {{- end }} {{- end }} containers: - name: {{ .name }} {{- with .image }} image: {{ .repository }}:{{ .tag | default $.Chart.AppVersion }} {{- end }} ports: - name: {{ .name }} containerPort: {{ .port }} {{- if .env }} env: {{- with .env }} {{- range $key, $val := . }} {{- if ne "secrets" $key }} {{- $envKey := $key | upper | replace "-" "_" }} - name: {{ $envKey }} value: {{ quote $val }} {{- else }} {{- range $key, $val := $val }} {{- $envKey := $key | upper | replace "-" "_" }} - name: {{ $envKey }} valueFrom: secretKeyRef: name: {{ include "exam.secrets" $ }} key: {{ $val }} {{- end }} {{- end }} {{- end }} {{- end }} {{- end }} resources: {} {{- if not .probe }} livenessProbe: httpGet: path: /ping port: {{ .port }} scheme: HTTP initialDelaySeconds: 10 readinessProbe: httpGet: path: /ping port: {{ .port }} scheme: HTTP initialDelaySeconds: 10 {{- else }} livenessProbe: exec: {{- toYaml .probe | nindent 14 }} initialDelaySeconds: 5 readinessProbe: exec: {{- toYaml .probe | nindent 14 }} initialDelaySeconds: 5 {{- end }} {{- if .mountPath }} volumeMounts: - mountPath: {{ .mountPath }} name: {{ .storage }} {{- end }} {{- if .grace }} terminationGracePeriodSeconds: 30 {{- end }} {{- if .mountPath }} volumes: - name: {{ .storage }} persistentVolumeClaim: claimName: {{ include "exam.pvclaim" $ }} {{- end }} {{- end }}