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 |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [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" . }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [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" . }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [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" . }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 39 | spec: |
Dominik Mizyn | 4aa534f | 2020-04-14 18:03:53 +0200 | [diff] [blame] | 40 | initContainers: |
| 41 | - command: |
| 42 | - sh |
| 43 | args: |
| 44 | - -c |
| 45 | - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 46 | env: |
| 47 | - name: RESTSERVER_USER |
| 48 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }} |
| 49 | - name: RESTSERVER_PASSWORD |
| 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }} |
| 51 | - name: API_USER |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "login") | indent 10 }} |
| 53 | - name: API_PASSWORD |
| 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "password") | indent 10 }} |
| 55 | - name: PAP_USER |
| 56 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "login") | indent 10 }} |
| 57 | - name: PAP_PASSWORD |
| 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "password") | indent 10 }} |
| 59 | - name: SDCBE_USER |
| 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "login") | indent 10 }} |
| 61 | - name: SDCBE_PASSWORD |
| 62 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "password") | indent 10 }} |
| 63 | volumeMounts: |
| 64 | - mountPath: /config-input |
| 65 | name: distributionconfig-input |
| 66 | - mountPath: /config |
| 67 | name: distributionconfig |
| 68 | image: "{{ .Values.global.envsubstImage }}" |
| 69 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 70 | name: {{ include "common.name" . }}-update-config |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 71 | {{ include "common.certInitializer.initContainer" . | indent 6 }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 72 | containers: |
| 73 | - name: {{ include "common.name" . }} |
Julien Barbot | 665fdc1 | 2018-10-22 16:49:07 +0200 | [diff] [blame] | 74 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 75 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 76 | {{- if .Values.global.aafEnabled }} |
| 77 | command: ["bash","-c"] |
| 78 | args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\ |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 79 | /opt/app/policy/distribution/bin/policy-dist.sh /opt/app/policy/distribution/etc/mounted/config.json"] |
| 80 | {{- else }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 81 | command: ["/opt/app/policy/distribution/bin/policy-dist.sh"] |
| 82 | args: ["/opt/app/policy/distribution/etc/mounted/config.json"] |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 83 | env: |
| 84 | - name: KEYSTORE_PASSWD |
| 85 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }} |
| 86 | - name: TRUSTSTORE_PASSWD |
| 87 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }} |
| 88 | {{- end }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 89 | ports: |
| 90 | - containerPort: {{ .Values.service.internalPort }} |
| 91 | # disable liveness probe when breakpoints set in debugger |
| 92 | # so K8s doesn't restart unresponsive container |
| 93 | {{- if eq .Values.liveness.enabled true }} |
| 94 | livenessProbe: |
| 95 | tcpSocket: |
| 96 | port: {{ .Values.service.internalPort }} |
| 97 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 98 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 99 | {{ end -}} |
| 100 | readinessProbe: |
| 101 | tcpSocket: |
| 102 | port: {{ .Values.service.internalPort }} |
| 103 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 104 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 105 | volumeMounts: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 106 | {{ include "common.certInitializer.volumeMount" . | indent 10 }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 107 | - mountPath: /etc/localtime |
| 108 | name: localtime |
| 109 | readOnly: true |
| 110 | - mountPath: /opt/app/policy/distribution/etc/mounted |
| 111 | name: distributionconfig |
| 112 | resources: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 113 | {{ include "common.resources" . }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 114 | {{- if .Values.nodeSelector }} |
| 115 | nodeSelector: |
| 116 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 117 | {{- end -}} |
| 118 | {{- if .Values.affinity }} |
| 119 | affinity: |
| 120 | {{ toYaml .Values.affinity | indent 10 }} |
| 121 | {{- end }} |
| 122 | volumes: |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 123 | {{ include "common.certInitializer.volumes" . | indent 8 }} |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 124 | - name: localtime |
| 125 | hostPath: |
| 126 | path: /etc/localtime |
Dominik Mizyn | 4aa534f | 2020-04-14 18:03:53 +0200 | [diff] [blame] | 127 | - name: distributionconfig-input |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 128 | configMap: |
| 129 | name: {{ include "common.fullname" . }}-configmap |
| 130 | defaultMode: 0755 |
Dominik Mizyn | 4aa534f | 2020-04-14 18:03:53 +0200 | [diff] [blame] | 131 | - name: distributionconfig |
| 132 | emptyDir: |
| 133 | medium: Memory |
mmis | 9cb5029 | 2018-09-19 00:31:35 +0100 | [diff] [blame] | 134 | imagePullSecrets: |
| 135 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |