apiVersion: apps/v1 kind: Deployment metadata: name: "{{ $.Release.Name }}-{{ $.Chart.Name }}" labels: {{- if $.Values.labels }} {{- toYaml $.Values.labels | nindent 4 }} {{- end }} app.kubernetes.io/name: {{ $.Chart.Name }} app.kubernetes.io/instance: {{ $.Release.Name }} app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} spec: {{- if not $.Values.autoscaling.enabled }} {{ if $.Values.replicaCount }} replicas: {{ $.Values.replicaCount }} {{ else }} replicas: 1 {{ end }} {{- end }} selector: matchLabels: app.kubernetes.io/name: {{ $.Chart.Name }} app.kubernetes.io/instance: {{ $.Release.Name }} template: metadata: annotations: metric.binom.pw/enabled: '{{ $.Values.metrics }}' {{ if ($.Values.metrics) }} metric.binom.pw/url: ":{{ $.Values.managementPort }}/actuator/prometheus" {{ end }} {{- with $.Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: app.kubernetes.io/name: {{ $.Chart.Name }} app.kubernetes.io/instance: {{ $.Release.Name }} spec: {{- with $.Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} volumes: - name: application-properties-volume configMap: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-main-config items: - key: application.yaml path: application.yaml securityContext: {{- toYaml $.Values.podSecurityContext | nindent 8 }} containers: - name: {{ $.Chart.Name }} securityContext: {{- toYaml $.Values.securityContext | nindent 12 }} image: "{{ $.Values.image.name }}:{{ default $.Chart.AppVersion $.Values.image.tag }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} env: - name: SPRING_CONFIG_ADDITIONAL_LOCATION value: "file:/opt/app/config/application.yaml" - name: DB_USER valueFrom: secretKeyRef: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-secret key: dbUser - name: DB_PASSWORD valueFrom: secretKeyRef: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-secret key: dbPassword - name: DB_URL value: "jdbc:postgresql://{{ $.Values.db.host }}:{{ $.Values.db.port }}/{{ $.Values.db.name }}" - name: S3_ACCESS_KEY valueFrom: secretKeyRef: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-secret key: app.s3.accessKey - name: S3_SECRET_KEY valueFrom: secretKeyRef: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-secret key: app.s3.secretKey volumeMounts: - mountPath: '/opt/app/config' name: application-properties-volume readOnly: true ports: - name: http containerPort: {{ $.Values.port }} protocol: TCP - name: management containerPort: {{ $.Values.managementPort }} protocol: TCP livenessProbe: httpGet: path: '/actuator/health/liveness' port: management initialDelaySeconds: 20 periodSeconds: 10 readinessProbe: httpGet: path: '/actuator/health/readiness' port: management initialDelaySeconds: 25 periodSeconds: 10 {{- if $.Values.resources }} resources: {{- toYaml $.Values.resources | nindent 12 }} {{- else }} resources: { } {{ 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 }}