{{- $dbName := include ".db.name" . -}} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include ".fullname" . }} labels: {{- include ".labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include ".selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include ".selectorLabels" . | nindent 8 }} {{- include ".touchinLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include ".serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: - name: "{{ .Chart.Name }}-info" image: "busybox" command: - "sh" - "-c" - "echo hello" {{- if and .Values.db .Values.db.create }} - name: "{{ .Chart.Name }}-create-db" image: {{ .Values.db.image }} args: - "create" - "{{ $dbName }}" env: {{- include ".db.environments" . | indent 12 }} {{- end }} {{- if and .Values.db .Values.db.copy }} - name: "{{ .Chart.Name }}-copy-db" image: {{ .Values.db.image }} args: - "copy" - "{{ .Values.db.name }}" - "{{ $dbName }}" env: {{- include ".db.environments" . | indent 12 }} {{- end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: JAVA_OPTS value: "{{ .Values.app.javaOpts }}" - name: APP_PROFILE value: "{{ .Values.profile }}" - name: spring_datasource_password valueFrom: secretKeyRef: name: "{{- if .Values.db.secret }}{{ .Values.db.secret }}{{- else }}postgres12-{{ .Release.Namespace }}{{- end }}" key: postgresql-password - name: spring_datasource_url value: "jdbc:postgresql://{{- if .Values.db.host }}{{ .Values.db.host }}{{- else }}postgres12-{{ .Release.Namespace }}{{- end }}:5432/{{ $dbName }}" - name: spring_datasource_username value: "{{- if .Values.db.user }}{{ .Values.db.user }}{{- else }}postgres{{- end }}" - name: "management_metrics_export_elastic_enabled" value: "{{ .Values.metrics.enabled }}" - name: "management_metrics_export_elastic_host" value: "{{ .Values.metrics.elasticSearchHost }}" ports: - name: http containerPort: {{ .Values.app.port }} protocol: TCP livenessProbe: httpGet: path: "{{ .Values.probe.path }}" port: http initialDelaySeconds: {{ .Values.probe.delay }} periodSeconds: 60 readinessProbe: httpGet: path: "{{ .Values.probe.path }}" port: http initialDelaySeconds: {{ .Values.probe.delay }} periodSeconds: 60 resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}