apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "rustical.fullname" . }} labels: {{- include "rustical.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include "rustical.selectorLabels" . | nindent 6 }} strategy: rollingUpdate: maxSurge: 50% maxUnavailable: 50% type: RollingUpdate template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "rustical.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullpolicy }} {{- if or .Values.secret.existingSecretName .Values.secret.enabled }} envFrom: - secretRef: name: {{ .Values.secret.existingSecretName | default (include "rustical.fullname" .) }} {{- end }} env: {{- range $key, $value := .Values.env }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} {{- range $section, $items := .Values.rustical }} {{- range $key, $value := $items }} {{- if not (eq $value nil) }} - name: {{ printf "RUSTICAL_%s__%s" (upper $section) (upper $key) }} value: {{ $value | quote }} {{- end }} {{- end }} {{- end }} ports: - name: http containerPort: 4000 protocol: TCP {{- if .Values.persistence.enabled }} volumeMounts: - name: data mountPath: {{ .Values.persistence.mountPath }} {{- end }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.persistence.enabled }} volumes: - name: data {{- if .Values.persistence.existingClaim }} persistentVolumeClaim: claimName: {{ .Values.persistence.existingClaim }} {{- else }} persistentVolumeClaim: claimName: {{ include "rustical.fullname" . }}-pvc {{- end }} {{- 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 }} restartPolicy: Always automountServiceAccountToken: false