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 |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 20 | kind: Deployment |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 21 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 22 | spec: |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 23 | selector: {{- include "common.selectors" . | nindent 4 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 24 | replicas: {{ .Values.replicaCount }} |
| 25 | template: |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 26 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 27 | spec: |
ramverma | 6acdabf | 2019-04-12 18:56:03 +0000 | [diff] [blame] | 28 | initContainers: |
| 29 | - command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 30 | - /app/ready.py |
ramverma | 6acdabf | 2019-04-12 18:56:03 +0000 | [diff] [blame] | 31 | args: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 32 | - --job-name |
| 33 | - {{ include "common.release" . }}-policy-galera-config |
ramverma | 6acdabf | 2019-04-12 18:56:03 +0000 | [diff] [blame] | 34 | env: |
| 35 | - name: NAMESPACE |
| 36 | valueFrom: |
| 37 | fieldRef: |
| 38 | apiVersion: v1 |
| 39 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 40 | image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" |
ramverma | 6acdabf | 2019-04-12 18:56:03 +0000 | [diff] [blame] | 41 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 42 | name: {{ include "common.name" . }}-readiness |
Krzysztof Opasiak | 3d9dc8b | 2020-03-31 23:05:16 +0200 | [diff] [blame] | 43 | - command: |
| 44 | - sh |
| 45 | args: |
| 46 | - -c |
| 47 | - "export SQL_PASSWORD_BASE64=`echo -n ${SQL_PASSWORD} | base64`; cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 48 | env: |
| 49 | - name: SQL_USER |
| 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
| 51 | - name: SQL_PASSWORD |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
Dominik Mizyn | 389fca1 | 2020-04-09 22:37:00 +0200 | [diff] [blame] | 53 | - name: RESTSERVER_USER |
| 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-secret" "key" "login") | indent 10 }} |
| 55 | - name: RESTSERVER_PASSWORD |
| 56 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-secret" "key" "password") | indent 10 }} |
| 57 | - name: API_USER |
| 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-secret" "key" "login") | indent 10 }} |
| 59 | - name: API_PASSWORD |
| 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-secret" "key" "password") | indent 10 }} |
| 61 | - name: DISTRIBUTION_USER |
| 62 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "distribution-secret" "key" "login") | indent 10 }} |
| 63 | - name: DISTRIBUTION_PASSWORD |
| 64 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "distribution-secret" "key" "password") | indent 10 }} |
Krzysztof Opasiak | 3d9dc8b | 2020-03-31 23:05:16 +0200 | [diff] [blame] | 65 | volumeMounts: |
| 66 | - mountPath: /config-input |
| 67 | name: papconfig |
| 68 | - mountPath: /config |
| 69 | name: papconfig-processed |
| 70 | image: "{{ .Values.global.envsubstImage }}" |
| 71 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 72 | name: {{ include "common.name" . }}-update-config |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 73 | {{ include "common.certInitializer.initContainer" . | indent 6 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 74 | containers: |
| 75 | - name: {{ include "common.name" . }} |
| 76 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 77 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 78 | {{- if .Values.global.aafEnabled }} |
| 79 | command: ["bash","-c"] |
| 80 | args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\ |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 81 | /opt/app/policy/pap/bin/policy-pap.sh /opt/app/policy/pap/etc/mounted/config.json"] |
| 82 | {{- else }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 83 | command: ["/opt/app/policy/pap/bin/policy-pap.sh"] |
jhh | bf7fb4d | 2019-08-07 16:54:41 -0500 | [diff] [blame] | 84 | args: ["/opt/app/policy/pap/etc/mounted/config.json"] |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 85 | env: |
| 86 | - name: KEYSTORE_PASSWD |
| 87 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }} |
| 88 | - name: TRUSTSTORE_PASSWD |
| 89 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }} |
| 90 | {{- end }} |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 91 | ports: {{ include "common.containerPorts" . | nindent 12 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 92 | # disable liveness probe when breakpoints set in debugger |
| 93 | # so K8s doesn't restart unresponsive container |
| 94 | {{- if eq .Values.liveness.enabled true }} |
| 95 | livenessProbe: |
| 96 | tcpSocket: |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 97 | port: {{ .Values.liveness.port }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 98 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 99 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 100 | {{ end -}} |
| 101 | readinessProbe: |
| 102 | tcpSocket: |
Bruno Sakoto | 0644c26 | 2020-05-22 16:56:35 -0400 | [diff] [blame] | 103 | port: {{ .Values.readiness.port }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 104 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 105 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 106 | volumeMounts: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 107 | {{ include "common.certInitializer.volumeMount" . | indent 10 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 108 | - mountPath: /etc/localtime |
| 109 | name: localtime |
| 110 | readOnly: true |
| 111 | - mountPath: /opt/app/policy/pap/etc/mounted |
Krzysztof Opasiak | 3d9dc8b | 2020-03-31 23:05:16 +0200 | [diff] [blame] | 112 | name: papconfig-processed |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 113 | resources: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 114 | {{ include "common.resources" . }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 115 | {{- if .Values.nodeSelector }} |
| 116 | nodeSelector: |
| 117 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 118 | {{- end -}} |
| 119 | {{- if .Values.affinity }} |
| 120 | affinity: |
| 121 | {{ toYaml .Values.affinity | indent 10 }} |
| 122 | {{- end }} |
| 123 | volumes: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 124 | {{ include "common.certInitializer.volumes" . | indent 8 }} |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 125 | - name: localtime |
| 126 | hostPath: |
| 127 | path: /etc/localtime |
| 128 | - name: papconfig |
| 129 | configMap: |
| 130 | name: {{ include "common.fullname" . }}-configmap |
| 131 | defaultMode: 0755 |
Krzysztof Opasiak | 3d9dc8b | 2020-03-31 23:05:16 +0200 | [diff] [blame] | 132 | - name: papconfig-processed |
| 133 | emptyDir: |
| 134 | medium: Memory |
ramverma | 1a3b8ad | 2019-02-25 12:45:11 +0000 | [diff] [blame] | 135 | imagePullSecrets: |
| 136 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |