blob: f07ed4a7ba79de8404c91b5365fa5a1245f59e3a [file] [log] [blame]
jhhd4258672020-08-09 12:08:08 -05001# ============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-Lis4fad3022020-07-31 10:18:21 +020019apiVersion: apps/v1
ramverma1a3b8ad2019-02-25 12:45:11 +000020kind: Deployment
Bruno Sakoto0644c262020-05-22 16:56:35 -040021metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000022spec:
Bruno Sakoto0644c262020-05-22 16:56:35 -040023 selector: {{- include "common.selectors" . | nindent 4 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000024 replicas: {{ .Values.replicaCount }}
25 template:
Bruno Sakoto0644c262020-05-22 16:56:35 -040026 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000027 spec:
ramverma6acdabf2019-04-12 18:56:03 +000028 initContainers:
29 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020030 - /app/ready.py
ramverma6acdabf2019-04-12 18:56:03 +000031 args:
jhhd4258672020-08-09 12:08:08 -050032 - --job-name
33 - {{ include "common.release" . }}-policy-galera-config
ramverma6acdabf2019-04-12 18:56:03 +000034 env:
35 - name: NAMESPACE
36 valueFrom:
37 fieldRef:
38 apiVersion: v1
39 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020040 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
ramverma6acdabf2019-04-12 18:56:03 +000041 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42 name: {{ include "common.name" . }}-readiness
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +020043 - 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 Mizyn389fca12020-04-09 22:37:00 +020053 - 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 Opasiak3d9dc8b2020-03-31 23:05:16 +020065 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
jhhd4258672020-08-09 12:08:08 -050073{{ include "common.certInitializer.initContainer" . | indent 6 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000074 containers:
75 - name: {{ include "common.name" . }}
76 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
77 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
jhhd4258672020-08-09 12:08:08 -050078{{- if .Values.global.aafEnabled }}
79 command: ["bash","-c"]
80 args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\
jhhd4258672020-08-09 12:08:08 -050081 /opt/app/policy/pap/bin/policy-pap.sh /opt/app/policy/pap/etc/mounted/config.json"]
82{{- else }}
ramverma1a3b8ad2019-02-25 12:45:11 +000083 command: ["/opt/app/policy/pap/bin/policy-pap.sh"]
jhhbf7fb4d2019-08-07 16:54:41 -050084 args: ["/opt/app/policy/pap/etc/mounted/config.json"]
jhhd4258672020-08-09 12:08:08 -050085 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 Sakoto0644c262020-05-22 16:56:35 -040091 ports: {{ include "common.containerPorts" . | nindent 12 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000092 # 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 Sakoto0644c262020-05-22 16:56:35 -040097 port: {{ .Values.liveness.port }}
ramverma1a3b8ad2019-02-25 12:45:11 +000098 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99 periodSeconds: {{ .Values.liveness.periodSeconds }}
100 {{ end -}}
101 readinessProbe:
102 tcpSocket:
Bruno Sakoto0644c262020-05-22 16:56:35 -0400103 port: {{ .Values.readiness.port }}
ramverma1a3b8ad2019-02-25 12:45:11 +0000104 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
105 periodSeconds: {{ .Values.readiness.periodSeconds }}
106 volumeMounts:
jhhd4258672020-08-09 12:08:08 -0500107{{ include "common.certInitializer.volumeMount" . | indent 10 }}
ramverma1a3b8ad2019-02-25 12:45:11 +0000108 - mountPath: /etc/localtime
109 name: localtime
110 readOnly: true
111 - mountPath: /opt/app/policy/pap/etc/mounted
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +0200112 name: papconfig-processed
ramverma1a3b8ad2019-02-25 12:45:11 +0000113 resources:
jhhd4258672020-08-09 12:08:08 -0500114{{ include "common.resources" . }}
ramverma1a3b8ad2019-02-25 12:45:11 +0000115 {{- 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:
jhhd4258672020-08-09 12:08:08 -0500124{{ include "common.certInitializer.volumes" . | indent 8 }}
ramverma1a3b8ad2019-02-25 12:45:11 +0000125 - name: localtime
126 hostPath:
127 path: /etc/localtime
128 - name: papconfig
129 configMap:
130 name: {{ include "common.fullname" . }}-configmap
131 defaultMode: 0755
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +0200132 - name: papconfig-processed
133 emptyDir:
134 medium: Memory
ramverma1a3b8ad2019-02-25 12:45:11 +0000135 imagePullSecrets:
136 - name: "{{ include "common.namespace" . }}-docker-registry-key"