Grzegorz-Lis | 4fad302 | 2020-07-31 10:18:21 +0200 | [diff] [blame] | 1 | apiVersion: apps/v1 |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 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: |
Grzegorz-Lis | 4fad302 | 2020-07-31 10:18:21 +0200 | [diff] [blame] | 12 | selector: |
| 13 | matchLabels: |
| 14 | app: {{ include "common.name" . }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 15 | replicas: {{ .Values.replicaCount }} |
| 16 | template: |
| 17 | metadata: |
| 18 | labels: |
| 19 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 20 | release: {{ include "common.release" . }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 21 | spec: |
Chenfei Gao | 8fdac3a | 2019-04-12 14:39:40 -0400 | [diff] [blame] | 22 | initContainers: |
| 23 | - command: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 24 | - /root/job_complete.py |
Chenfei Gao | 8fdac3a | 2019-04-12 14:39:40 -0400 | [diff] [blame] | 25 | args: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 26 | - --job-name |
| 27 | - {{ include "common.release" . }}-policy-galera-config |
Chenfei Gao | 8fdac3a | 2019-04-12 14:39:40 -0400 | [diff] [blame] | 28 | env: |
| 29 | - name: NAMESPACE |
| 30 | valueFrom: |
| 31 | fieldRef: |
| 32 | apiVersion: v1 |
| 33 | fieldPath: metadata.namespace |
| 34 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 35 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 36 | name: {{ include "common.name" . }}-readiness |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame] | 37 | - command: |
| 38 | - sh |
| 39 | args: |
| 40 | - -c |
| 41 | - "export SQL_PASSWORD_BASE64=`echo -n ${SQL_PASSWORD} | base64`; cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 42 | env: |
| 43 | - name: SQL_USER |
Dominik Mizyn | 1103810 | 2020-04-14 17:14:42 +0200 | [diff] [blame] | 44 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "login") | indent 12 }} |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame] | 45 | - name: SQL_PASSWORD |
Dominik Mizyn | 1103810 | 2020-04-14 17:14:42 +0200 | [diff] [blame] | 46 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "password") | indent 12 }} |
| 47 | - name: RESTSERVER_USER |
| 48 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 12 }} |
| 49 | - name: RESTSERVER_PASSWORD |
| 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 12 }} |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame] | 51 | volumeMounts: |
| 52 | - mountPath: /config-input |
| 53 | name: apiconfig |
| 54 | - mountPath: /config |
| 55 | name: apiconfig-processed |
| 56 | image: "{{ .Values.global.envsubstImage }}" |
| 57 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 58 | name: {{ include "common.name" . }}-update-config |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 59 | {{ include "common.certInitializer.initContainer" . | indent 8 }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 60 | containers: |
| 61 | - name: {{ include "common.name" . }} |
| 62 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 63 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 64 | {{- if .Values.global.aafEnabled }} |
| 65 | command: ["bash","-c"] |
| 66 | args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\ |
| 67 | cp {{ .Values.certInitializer.credsPath }}/org.onap.policy.p12 ${POLICY_HOME}/etc/ssl/policy-keystore;\ |
| 68 | /opt/app/policy/api/bin/policy-api.sh /opt/app/policy/api/etc/mounted/config.json"] |
| 69 | {{- else }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 70 | command: ["/opt/app/policy/api/bin/policy-api.sh"] |
| 71 | args: ["/opt/app/policy/api/etc/mounted/config.json"] |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 72 | env: |
| 73 | - name: KEYSTORE_PASSWD |
| 74 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }} |
| 75 | - name: TRUSTSTORE_PASSWD |
| 76 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }} |
| 77 | {{- end }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 78 | ports: |
| 79 | - containerPort: {{ .Values.service.internalPort }} |
| 80 | # disable liveness probe when breakpoints set in debugger |
| 81 | # so K8s doesn't restart unresponsive container |
| 82 | {{- if eq .Values.liveness.enabled true }} |
| 83 | livenessProbe: |
| 84 | tcpSocket: |
| 85 | port: {{ .Values.service.internalPort }} |
| 86 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 87 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 88 | {{ end -}} |
| 89 | readinessProbe: |
| 90 | tcpSocket: |
| 91 | port: {{ .Values.service.internalPort }} |
| 92 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 93 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 94 | volumeMounts: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 95 | {{ include "common.certInitializer.volumeMount" . | indent 10 }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 96 | - mountPath: /etc/localtime |
| 97 | name: localtime |
| 98 | readOnly: true |
| 99 | - mountPath: /opt/app/policy/api/etc/mounted |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame] | 100 | name: apiconfig-processed |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 101 | resources: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 102 | {{ include "common.resources" . }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 103 | {{- if .Values.nodeSelector }} |
| 104 | nodeSelector: |
| 105 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 106 | {{- end -}} |
| 107 | {{- if .Values.affinity }} |
| 108 | affinity: |
| 109 | {{ toYaml .Values.affinity | indent 10 }} |
| 110 | {{- end }} |
| 111 | volumes: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame^] | 112 | {{ include "common.certInitializer.volumes" . | indent 8 }} |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 113 | - name: localtime |
| 114 | hostPath: |
| 115 | path: /etc/localtime |
| 116 | - name: apiconfig |
| 117 | configMap: |
| 118 | name: {{ include "common.fullname" . }}-configmap |
| 119 | defaultMode: 0755 |
Krzysztof Opasiak | 09d1b31 | 2020-03-31 23:44:22 +0200 | [diff] [blame] | 120 | - name: apiconfig-processed |
| 121 | emptyDir: |
| 122 | medium: Memory |
Chenfei Gao | 9292e88 | 2019-02-27 22:14:45 -0500 | [diff] [blame] | 123 | imagePullSecrets: |
| 124 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |