jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 1 | # ============LICENSE_START======================================================= |
| 2 | # Copyright (C) 2020 AT&T Intellectual Property. |
| 3 | # ================================================================================ |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | # SPDX-License-Identifier: Apache-2.0 |
| 17 | # ============LICENSE_END========================================================= |
| 18 | |
Grzegorz-Lis | 4fad302 | 2020-07-31 10:18:21 +0200 | [diff] [blame] | 19 | apiVersion: apps/v1 |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 20 | kind: Deployment |
| 21 | metadata: |
| 22 | name: {{ include "common.fullname" . }} |
| 23 | namespace: {{ include "common.namespace" . }} |
| 24 | labels: |
| 25 | app: {{ include "common.name" . }} |
| 26 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 27 | release: {{ include "common.release" . }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 28 | heritage: {{ .Release.Service }} |
| 29 | spec: |
Grzegorz-Lis | 4fad302 | 2020-07-31 10:18:21 +0200 | [diff] [blame] | 30 | selector: |
| 31 | matchLabels: |
| 32 | app: {{ include "common.name" . }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 33 | replicas: {{ .Values.replicaCount }} |
| 34 | template: |
| 35 | metadata: |
| 36 | labels: |
| 37 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 38 | release: {{ include "common.release" . }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 39 | spec: |
Michael Mokry | 3b2647a | 2019-04-14 20:24:43 -0500 | [diff] [blame] | 40 | initContainers: |
| 41 | - command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 42 | - /app/ready.py |
Michael Mokry | 3b2647a | 2019-04-14 20:24:43 -0500 | [diff] [blame] | 43 | args: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 44 | - --job-name |
| 45 | - {{ include "common.release" . }}-policy-galera-config |
Michael Mokry | 3b2647a | 2019-04-14 20:24:43 -0500 | [diff] [blame] | 46 | env: |
| 47 | - name: NAMESPACE |
| 48 | valueFrom: |
| 49 | fieldRef: |
| 50 | apiVersion: v1 |
| 51 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 52 | image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" |
Michael Mokry | 3b2647a | 2019-04-14 20:24:43 -0500 | [diff] [blame] | 53 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 54 | name: {{ include "common.name" . }}-readiness |
Dominik Mizyn | c88bcc9 | 2020-04-14 18:20:20 +0200 | [diff] [blame] | 55 | - command: |
| 56 | - sh |
| 57 | args: |
| 58 | - -c |
Taka Cho | ebd6295 | 2020-10-08 13:50:09 -0400 | [diff] [blame] | 59 | - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done" |
Dominik Mizyn | c88bcc9 | 2020-04-14 18:20:20 +0200 | [diff] [blame] | 60 | env: |
| 61 | - name: RESTSERVER_USER |
| 62 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }} |
| 63 | - name: RESTSERVER_PASSWORD |
| 64 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }} |
| 65 | - name: API_USER |
| 66 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-creds" "key" "login") | indent 10 }} |
| 67 | - name: API_PASSWORD |
| 68 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-creds" "key" "password") | indent 10 }} |
jhh | ed6839f | 2020-05-08 12:28:27 -0500 | [diff] [blame] | 69 | - name: SQL_USER |
| 70 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
| 71 | - name: SQL_PASSWORD |
| 72 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
Dominik Mizyn | c88bcc9 | 2020-04-14 18:20:20 +0200 | [diff] [blame] | 73 | volumeMounts: |
| 74 | - mountPath: /config-input |
| 75 | name: pdpxconfig |
| 76 | - mountPath: /config |
| 77 | name: pdpxconfig-processed |
| 78 | image: "{{ .Values.global.envsubstImage }}" |
| 79 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 80 | name: {{ include "common.name" . }}-update-config |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 81 | {{ include "common.certInitializer.initContainer" . | indent 6 }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 82 | containers: |
| 83 | - name: {{ include "common.name" . }} |
| 84 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 85 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 86 | {{- if .Values.global.aafEnabled }} |
| 87 | command: ["bash","-c"] |
| 88 | args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\ |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 89 | /opt/app/policy/pdpx/bin/policy-pdpx.sh /opt/app/policy/pdpx/etc/mounted/config.json"] |
| 90 | {{- else }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 91 | command: ["/opt/app/policy/pdpx/bin/policy-pdpx.sh"] |
jhh | bf7fb4d | 2019-08-07 16:54:41 -0500 | [diff] [blame] | 92 | args: ["/opt/app/policy/pdpx/etc/mounted/config.json"] |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 93 | env: |
| 94 | - name: KEYSTORE_PASSWD |
| 95 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }} |
| 96 | - name: TRUSTSTORE_PASSWD |
| 97 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }} |
| 98 | {{- end }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 99 | ports: |
| 100 | - containerPort: {{ .Values.service.internalPort }} |
| 101 | # disable liveness probe when breakpoints set in debugger |
| 102 | # so K8s doesn't restart unresponsive container |
| 103 | {{- if eq .Values.liveness.enabled true }} |
| 104 | livenessProbe: |
| 105 | tcpSocket: |
| 106 | port: {{ .Values.service.internalPort }} |
| 107 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 108 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 109 | {{ end -}} |
| 110 | readinessProbe: |
| 111 | tcpSocket: |
| 112 | port: {{ .Values.service.internalPort }} |
| 113 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 114 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 115 | volumeMounts: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 116 | {{ include "common.certInitializer.volumeMount" . | indent 10 }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 117 | - mountPath: /etc/localtime |
| 118 | name: localtime |
| 119 | readOnly: true |
| 120 | - mountPath: /opt/app/policy/pdpx/etc/mounted |
Dominik Mizyn | c88bcc9 | 2020-04-14 18:20:20 +0200 | [diff] [blame] | 121 | name: pdpxconfig-processed |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 122 | resources: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 123 | {{ include "common.resources" . }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 124 | {{- if .Values.nodeSelector }} |
| 125 | nodeSelector: |
| 126 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 127 | {{- end -}} |
| 128 | {{- if .Values.affinity }} |
| 129 | affinity: |
| 130 | {{ toYaml .Values.affinity | indent 10 }} |
| 131 | {{- end }} |
| 132 | volumes: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 133 | {{ include "common.certInitializer.volumes" . | indent 8 }} |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 134 | - name: localtime |
| 135 | hostPath: |
| 136 | path: /etc/localtime |
| 137 | - name: pdpxconfig |
| 138 | configMap: |
| 139 | name: {{ include "common.fullname" . }}-configmap |
| 140 | defaultMode: 0755 |
Dominik Mizyn | c88bcc9 | 2020-04-14 18:20:20 +0200 | [diff] [blame] | 141 | - name: pdpxconfig-processed |
| 142 | emptyDir: |
| 143 | medium: Memory |
Michael Mokry | afae997 | 2019-03-11 14:46:34 -0500 | [diff] [blame] | 144 | imagePullSecrets: |
| 145 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |