puthuparambil.aditya | 7625e52 | 2021-01-22 22:01:50 +0100 | [diff] [blame^] | 1 | {{/* |
| 2 | # Copyright (C) 2021 Pantheon.tech, Orange |
| 3 | # Modifications Copyright (C) 2020 Bell Canada. All rights reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | */}} |
| 17 | |
| 18 | apiVersion: apps/v1 |
| 19 | kind: Deployment |
| 20 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 21 | spec: |
| 22 | replicas: {{ .Values.replicaCount }} |
| 23 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 24 | template: |
| 25 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 26 | spec: |
| 27 | {{ include "common.podSecurityContext" . | indent 6 | trim}} |
| 28 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }} |
| 29 | initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }} |
| 30 | - name: {{ include "common.name" . }}-update-config |
| 31 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
| 32 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 33 | command: |
| 34 | - sh |
| 35 | args: |
| 36 | - -c |
| 37 | - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 38 | env: |
| 39 | - name: DB_USERNAME |
| 40 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }} |
| 41 | - name: DB_PASSWORD |
| 42 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }} |
| 43 | volumeMounts: |
| 44 | - mountPath: /config-input |
| 45 | name: init-data-input |
| 46 | - mountPath: /config |
| 47 | name: init-data |
| 48 | containers: |
| 49 | - name: {{ include "common.name" . }} |
| 50 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 51 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 52 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 53 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 54 | # disable liveness probe when breakpoints set in debugger |
| 55 | # so K8s doesn't restart unresponsive container |
| 56 | {{- if eq .Values.liveness.enabled true }} |
| 57 | livenessProbe: |
| 58 | httpGet: |
| 59 | port: {{ .Values.liveness.port }} |
| 60 | path: {{ .Values.liveness.path }} |
| 61 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 62 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 63 | {{ end -}} |
| 64 | readinessProbe: |
| 65 | httpGet: |
| 66 | port: {{ .Values.readiness.port }} |
| 67 | path: {{ .Values.readiness.path }} |
| 68 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 69 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 70 | resources: {{ include "common.resources" . | nindent 10 }} |
| 71 | {{- if .Values.nodeSelector }} |
| 72 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }} |
| 73 | {{- end }} |
| 74 | {{- if .Values.affinity }} |
| 75 | affinity: {{ toYaml .Values.affinity | nindent 12 }} |
| 76 | {{- end }} |
| 77 | volumeMounts: |
| 78 | - mountPath: /app/resources/application.yml |
| 79 | subPath: application.yml |
| 80 | name: init-data |
| 81 | - mountPath: /app/resources/logback.xml |
| 82 | subPath: logback.xml |
| 83 | name: init-data |
| 84 | - mountPath: /tmp |
| 85 | name: init-temp |
| 86 | volumes: |
| 87 | - name: init-data-input |
| 88 | configMap: |
| 89 | name: {{ include "common.fullname" . }} |
| 90 | - name: init-data |
| 91 | emptyDir: |
| 92 | medium: Memory |
| 93 | - name: init-temp |
| 94 | emptyDir: {} |
| 95 | imagePullSecrets: |
| 96 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |