Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 1 | apiVersion: extensions/v1beta1 |
| 2 | kind: Deployment |
| 3 | metadata: |
| 4 | name: {{ include "common.fullname" . }} |
| 5 | namespace: {{ include "common.namespace" . }} |
| 6 | labels: |
| 7 | app: {{ include "common.name" . }} |
| 8 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 9 | release: {{ include "common.release" . }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 10 | heritage: {{ .Release.Service }} |
| 11 | spec: |
| 12 | replicas: {{ .Values.replicaCount }} |
| 13 | template: |
| 14 | metadata: |
| 15 | labels: |
| 16 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 17 | release: {{ include "common.release" . }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 18 | spec: |
Chenfei Gao | 8fdac3a | 2019-04-12 14:39:40 -0400 | [diff] [blame] | 19 | initContainers: |
| 20 | - command: |
| 21 | - /root/ready.py |
| 22 | args: |
| 23 | - --container-name |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 24 | - {{ include "common.release" . }}-galera-config |
Chenfei Gao | 8fdac3a | 2019-04-12 14:39:40 -0400 | [diff] [blame] | 25 | env: |
| 26 | - name: NAMESPACE |
| 27 | valueFrom: |
| 28 | fieldRef: |
| 29 | apiVersion: v1 |
| 30 | fieldPath: metadata.namespace |
| 31 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 32 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 33 | name: {{ include "common.name" . }}-readiness |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame^] | 34 | |
| 35 | - command: |
| 36 | - sh |
| 37 | args: |
| 38 | - -c |
| 39 | - "export SQL_PASSWORD_BASE64=`echo -n ${SQL_PASSWORD} | base64`; cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 40 | env: |
| 41 | - name: SQL_USER |
| 42 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }} |
| 43 | - name: SQL_PASSWORD |
| 44 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }} |
| 45 | volumeMounts: |
| 46 | - mountPath: /config-input |
| 47 | name: apiconfig |
| 48 | - mountPath: /config |
| 49 | name: apiconfig-processed |
| 50 | image: "{{ .Values.global.envsubstImage }}" |
| 51 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 52 | name: {{ include "common.name" . }}-update-config |
| 53 | |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 54 | containers: |
| 55 | - name: {{ include "common.name" . }} |
| 56 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 57 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 58 | command: ["/opt/app/policy/api/bin/policy-api.sh"] |
| 59 | args: ["/opt/app/policy/api/etc/mounted/config.json"] |
| 60 | ports: |
| 61 | - containerPort: {{ .Values.service.internalPort }} |
| 62 | # disable liveness probe when breakpoints set in debugger |
| 63 | # so K8s doesn't restart unresponsive container |
| 64 | {{- if eq .Values.liveness.enabled true }} |
| 65 | livenessProbe: |
| 66 | tcpSocket: |
| 67 | port: {{ .Values.service.internalPort }} |
| 68 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 69 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 70 | {{ end -}} |
| 71 | readinessProbe: |
| 72 | tcpSocket: |
| 73 | port: {{ .Values.service.internalPort }} |
| 74 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 75 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 76 | volumeMounts: |
| 77 | - mountPath: /etc/localtime |
| 78 | name: localtime |
| 79 | readOnly: true |
| 80 | - mountPath: /opt/app/policy/api/etc/mounted |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame^] | 81 | name: apiconfig-processed |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 82 | resources: |
| 83 | {{ include "common.resources" . | indent 12 }} |
| 84 | {{- if .Values.nodeSelector }} |
| 85 | nodeSelector: |
| 86 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 87 | {{- end -}} |
| 88 | {{- if .Values.affinity }} |
| 89 | affinity: |
| 90 | {{ toYaml .Values.affinity | indent 10 }} |
| 91 | {{- end }} |
| 92 | volumes: |
| 93 | - name: localtime |
| 94 | hostPath: |
| 95 | path: /etc/localtime |
| 96 | - name: apiconfig |
| 97 | configMap: |
| 98 | name: {{ include "common.fullname" . }}-configmap |
| 99 | defaultMode: 0755 |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame^] | 100 | - name: apiconfig-processed |
| 101 | emptyDir: |
| 102 | medium: Memory |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 103 | imagePullSecrets: |
| 104 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |