blob: 16fc57aa92afd5ee8038a55fc89d00fff534fd2c [file] [log] [blame]
Jakub Latusekd8eaff62020-10-21 13:36:29 +02001{{/*
Mandeep Khindab1f9efe2018-03-28 19:01:55 +00002# Copyright © 2017 Amdocs, AT&T, Bell Canada
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00003# Modifications Copyright © 2018 ZTE
Mandeep Khindab1f9efe2018-03-28 19:01:55 +00004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
Jakub Latusekd8eaff62020-10-21 13:36:29 +020016*/}}
Mandeep Khindab1f9efe2018-03-28 19:01:55 +000017
gummara72e6de2020-03-12 11:15:56 +000018apiVersion: apps/v1
Mandeep Khindaa1047f42018-03-22 02:12:15 +000019kind: Deployment
gummara72e6de2020-03-12 11:15:56 +000020metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000021spec:
gummara72e6de2020-03-12 11:15:56 +000022 selector: {{- include "common.selectors" . | nindent 4 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000023 replicas: {{ .Values.replicaCount }}
24 template:
gummara72e6de2020-03-12 11:15:56 +000025 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000026 spec:
ChrisC742a7b22020-09-04 11:29:57 +020027 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000028 - name: {{ include "common.name" . }}-readiness
29 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020030 - /app/ready.py
Mandeep Khindaa1047f42018-03-22 02:12:15 +000031 args:
32 - --container-name
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000033 - "sdc-onboarding-be"
efiacor3422fe92022-07-12 13:19:53 +010034 {{- if not .Values.global.kafka.useKafka }}
Sylvain Desbureaux29903c32021-12-06 14:39:02 +010035 - --container-name
36 - "message-router"
efiacor3422fe92022-07-12 13:19:53 +010037 {{- end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000038 env:
39 - name: NAMESPACE
40 valueFrom:
41 fieldRef:
42 apiVersion: v1
43 fieldPath: metadata.namespace
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010044 image: {{ include "repositoryGenerator.image.readiness" . }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000045 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
ChrisC32172342020-10-02 16:39:13 +020046 resources:
47 limits:
48 cpu: 100m
49 memory: 100Mi
50 requests:
51 cpu: 3m
52 memory: 20Mi
Mandeep Khindaa1047f42018-03-22 02:12:15 +000053 - name: {{ include "common.name" . }}-job-completion
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010054 image: {{ include "repositoryGenerator.image.readiness" . }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000055 imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
56 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020057 - /app/ready.py
Mandeep Khindaa1047f42018-03-22 02:12:15 +000058 args:
59 - --job-name
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010060 - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
Mandeep Khindaa1047f42018-03-22 02:12:15 +000061 env:
62 - name: NAMESPACE
63 valueFrom:
64 fieldRef:
65 apiVersion: v1
66 fieldPath: metadata.namespace
ChrisC32172342020-10-02 16:39:13 +020067 resources:
68 limits:
69 cpu: 100m
70 memory: 100Mi
71 requests:
72 cpu: 3m
73 memory: 20Mi
ChrisC742a7b22020-09-04 11:29:57 +020074 {{- if .Values.global.aafEnabled }}
k.kedron2774ab12020-03-26 11:13:46 +010075 - name: {{ include "common.name" . }}-update-config
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010076 image: {{ include "repositoryGenerator.image.envsubst" . }}
k.kedron2774ab12020-03-26 11:13:46 +010077 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78 command:
79 - sh
80 args:
ChrisC742a7b22020-09-04 11:29:57 +020081 - "-c"
82 - |
83 export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
84 export KEYSTORE_PASS=$cadi_keystore_password_p12
85 export KEYMANAGER_PASS=$cadi_keystore_password_p12
86 export TRUSTSTORE_PASS=$cadi_truststore_password
87 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }} /config-output
88 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }} /config-output
89 cd /config-input && \
90 for PFILE in `find . -not -type d | grep -v -F ..`
91 do
92 envsubst <${PFILE} >/config-output/${PFILE}
93 chmod 0755 /config-output/${PFILE}
94 done
ChrisC32172342020-10-02 16:39:13 +020095 resources:
96 limits:
97 cpu: 100m
98 memory: 100Mi
99 requests:
100 cpu: 3m
101 memory: 20Mi
ChrisC742a7b22020-09-04 11:29:57 +0200102 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
othman touijer2b764d02022-01-05 14:40:37 +0100103 - name: sdc-environments-input
k.kedron2774ab12020-03-26 11:13:46 +0100104 mountPath: /config-input/
othman touijer2b764d02022-01-05 14:40:37 +0100105 - name: sdc-environments
k.kedron2774ab12020-03-26 11:13:46 +0100106 mountPath: /config-output/
ChrisC742a7b22020-09-04 11:29:57 +0200107 {{- end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000108 containers:
109 - name: {{ include "common.name" . }}
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +0100110 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000111 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
ChrisC742a7b22020-09-04 11:29:57 +0200112 {{- if .Values.global.aafEnabled }}
113 command:
114 - sh
115 args:
116 - "-c"
117 - |
118 sed -i '/trustStorePassword/d' ${JETTY_BASE}/startup.sh
119 ${JETTY_BASE}/startup.sh
120 {{- end }}
gummara72e6de2020-03-12 11:15:56 +0000121 ports: {{ include "common.containerPorts" . | nindent 10 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000122 {{ if eq .Values.liveness.enabled true }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000123 livenessProbe:
Yang Xue5d5e682019-06-19 18:20:31 -0400124 httpGet:
shrek2000f336f6d2020-02-25 16:11:26 +0200125 path: /sdc2/rest/healthCheck
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200126 port: {{ .Values.service.internalPort }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000127 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
128 periodSeconds: {{ .Values.liveness.periodSeconds }}
Yang Xu85608542019-06-16 23:25:32 -0400129 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200130 successThreshold: {{ .Values.liveness.successThreshold }}
131 failureThreshold: {{ .Values.liveness.failureThreshold }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000132 {{ end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000133 readinessProbe:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200134 httpGet:
135 path: /sdc2/rest/healthCheck
136 port: {{ .Values.service.internalPort }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000137 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
138 periodSeconds: {{ .Values.readiness.periodSeconds }}
Yang Xu85608542019-06-16 23:25:32 -0400139 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200140 successThreshold: {{ .Values.readiness.successThreshold }}
141 failureThreshold: {{ .Values.readiness.failureThreshold }}
142 resources: {{ include "common.resources" . | nindent 12 }}
143 startupProbe:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200144 httpGet:
145 path: /sdc2/rest/healthCheck
146 port: {{ .Values.service.internalPort }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200147 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
148 periodSeconds: {{ .Values.startup.periodSeconds }}
149 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
150 successThreshold: {{ .Values.startup.successThreshold }}
151 failureThreshold: {{ .Values.startup.failureThreshold }}
gummara72e6de2020-03-12 11:15:56 +0000152 resources: {{ include "common.resources" . | nindent 12 }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000153 env:
154 - name: ENVNAME
ChrisC742a7b22020-09-04 11:29:57 +0200155 value: {{ .Values.env.name }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000156 - name: JAVA_OPTIONS
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000157 value: {{ .Values.config.javaOptions }}
158 - name: cassandra_ssl_enabled
159 value: {{ .Values.config.cassandraSslEnabled | quote }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000160 - name: HOST_IP
161 valueFrom:
162 fieldRef:
163 fieldPath: status.podIP
efiacor3422fe92022-07-12 13:19:53 +0100164 {{- if .Values.global.kafka.useKafka }}
165 - name: SASL_JAAS_CONFIG
166 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdc-be-kafka-secret" "key" "sasl.jaas.config") | indent 12 }}
167 - name: USE_KAFKA
168 value: {{ .Values.global.kafka.useKafka | quote }}
169 {{- end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000170 volumeMounts:
othman touijer2b764d02022-01-05 14:40:37 +0100171 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200172 mountPath: /app/jetty/chef-solo/environments/
othman touijer2b764d02022-01-05 14:40:37 +0100173 {{- if .Values.global.aafEnabled }}
174 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200175 mountPath: /app/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.p12
k.kedron2774ab12020-03-26 11:13:46 +0100176 subPath: org.onap.sdc.p12
othman touijer2b764d02022-01-05 14:40:37 +0100177 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200178 mountPath: /app/jetty/chef-solo/cookbooks/sdc-catalog-be/files/default/org.onap.sdc.trust.jks
k.kedron2774ab12020-03-26 11:13:46 +0100179 subPath: org.onap.sdc.trust.jks
othman touijer2b764d02022-01-05 14:40:37 +0100180 {{- end }}
181 - name: localtime
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000182 mountPath: /etc/localtime
183 readOnly: true
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000184 - name: logs
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000185 mountPath: /var/log/onap
othman touijer2b764d02022-01-05 14:40:37 +0100186 - name: logback
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000187 mountPath: /tmp/logback.xml
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000188 subPath: logback.xml
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000189 lifecycle:
190 postStart:
191 exec:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200192 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/app/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000193 # side car containers
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000194 {{ include "common.log.sidecar" . | nindent 8 }}
farida azmy1383b4c2021-04-06 12:33:31 +0200195 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
ChrisC742a7b22020-09-04 11:29:57 +0200196 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
othman touijer2b764d02022-01-05 14:40:37 +0100197 - name: localtime
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000198 hostPath:
199 path: /etc/localtime
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000200 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
othman touijer2b764d02022-01-05 14:40:37 +0100201 - name: logback
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000202 configMap:
203 name : {{ include "common.fullname" . }}-logging-configmap
othman touijer2b764d02022-01-05 14:40:37 +0100204 - name: sdc-environments
205 {{- if .Values.global.aafEnabled }}
206 emptyDir: { medium: "Memory" }
207 - name: sdc-environments-input
208 {{- end }}
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000209 configMap:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100210 name: {{ include "common.release" . }}-sdc-environments-configmap
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000211 defaultMode: 0755
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000212 - name: logs
Mandeep Khinda403c1c12018-04-19 23:15:43 +0000213 emptyDir: {}
Mandeep Khindaa1047f42018-03-22 02:12:15 +0000214 imagePullSecrets:
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +0000215 - name: "{{ include "common.namespace" . }}-docker-registry-key"