blob: 8180cc79f149a3a672a45e472394b55c0a44bb41 [file] [log] [blame]
Jakub Latusekd8eaff62020-10-21 13:36:29 +02001{{/*
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +00002# Copyright © 2017 Amdocs, AT&T, Bell Canada
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00003# Modifications Copyright © 2018 ZTE
othman touijer2b764d02022-01-05 14:40:37 +01004# Modifications Copyright © 2021 Orange
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +00005#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
Jakub Latusekd8eaff62020-10-21 13:36:29 +020017*/}}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000018
kwasiel59cc6a42020-07-23 10:02:49 +000019apiVersion: apps/v1
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000020kind: Deployment
21metadata:
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 Opasiak137d7cc2020-01-24 23:49:11 +010027 release: {{ include "common.release" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000028 heritage: {{ .Release.Service }}
29spec:
kwasiel59cc6a42020-07-23 10:02:49 +000030 selector:
31 matchLabels:
32 app: {{ include "common.name" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000033 replicas: {{ .Values.replicaCount }}
34 template:
35 metadata:
36 labels:
37 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010038 release: {{ include "common.release" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000039 spec:
ChrisC742a7b22020-09-04 11:29:57 +020040 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000041 - name: {{ include "common.name" . }}-job-completion
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010042 image: {{ include "repositoryGenerator.image.readiness" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000043 imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
44 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020045 - /app/ready.py
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000046 args:
47 - --job-name
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010048 - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000049 env:
50 - name: NAMESPACE
51 valueFrom:
52 fieldRef:
53 apiVersion: v1
54 fieldPath: metadata.namespace
ChrisC32172342020-10-02 16:39:13 +020055 resources:
56 limits:
57 cpu: 100m
58 memory: 100Mi
59 requests:
60 cpu: 3m
61 memory: 20Mi
ChrisC742a7b22020-09-04 11:29:57 +020062 {{- if .Values.global.aafEnabled }}
k.kedron2774ab12020-03-26 11:13:46 +010063 - name: {{ include "common.name" . }}-update-config
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010064 image: {{ include "repositoryGenerator.image.envsubst" . }}
k.kedron2774ab12020-03-26 11:13:46 +010065 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66 command:
ChrisC742a7b22020-09-04 11:29:57 +020067 - sh
k.kedron2774ab12020-03-26 11:13:46 +010068 args:
ChrisC742a7b22020-09-04 11:29:57 +020069 - "-c"
70 - |
71 export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
72 export KEYSTORE_PASS=$cadi_keystore_password_p12
73 export KEYMANAGER_PASS=$cadi_keystore_password_p12
74 export TRUSTSTORE_PASS=$cadi_truststore_password
75 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }} /config-output
76 cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }} /config-output
77 cd /config-input && \
78 for PFILE in `find . -not -type d | grep -v -F ..`
79 do
80 envsubst <${PFILE} >/config-output/${PFILE}
81 chmod 0755 /config-output/${PFILE}
82 done
83 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
othman touijer2b764d02022-01-05 14:40:37 +010084 - name: sdc-environments-input
k.kedron2774ab12020-03-26 11:13:46 +010085 mountPath: /config-input/
othman touijer2b764d02022-01-05 14:40:37 +010086 - name: sdc-environments
k.kedron2774ab12020-03-26 11:13:46 +010087 mountPath: /config-output/
ChrisC32172342020-10-02 16:39:13 +020088 resources:
89 limits:
90 cpu: 100m
91 memory: 100Mi
92 requests:
93 cpu: 3m
94 memory: 20Mi
ChrisC742a7b22020-09-04 11:29:57 +020095 {{- end }}
Krzysztof Kuzmicki868a2802020-11-20 17:00:27 +010096 - name: volume-permissions
Sylvain Desbureaux80f32ff2021-05-03 15:24:59 +020097 image: {{ include "repositoryGenerator.image.busybox" . }}
Krzysztof Kuzmicki868a2802020-11-20 17:00:27 +010098 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
99 command:
100 - sh
101 args:
102 - "-c"
103 - |
104 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //onboard/cert
105 securityContext:
106 runAsUser: 0
107 volumeMounts:
othman touijer2b764d02022-01-05 14:40:37 +0100108 - name: cert-storage
Krzysztof Kuzmicki868a2802020-11-20 17:00:27 +0100109 mountPath: "/onboard/cert"
110 resources:
111 limits:
112 cpu: 100m
113 memory: 100Mi
114 requests:
115 cpu: 3m
116 memory: 20Mi
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000117 containers:
118 - name: {{ include "common.name" . }}
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +0100119 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000120 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121 ports:
122 - containerPort: {{ .Values.service.internalPort }}
123 - containerPort: {{ .Values.service.internalPort2 }}
124 {{ if eq .Values.liveness.enabled true }}
125 livenessProbe:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200126 httpGet:
127 path: /onboarding-api/v1.0/healthcheck
128 port: {{ .Values.service.internalPort2 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000129 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
130 periodSeconds: {{ .Values.liveness.periodSeconds }}
Brian Freeman6142d942019-10-02 09:50:19 -0500131 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200132 successThreshold: {{ .Values.liveness.successThreshold }}
133 failureThreshold: {{ .Values.liveness.failureThreshold }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000134 {{ end }}
135 readinessProbe:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200136 httpGet:
137 path: /onboarding-api/v1.0/healthcheck
138 port: {{ .Values.service.internalPort2 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000139 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
140 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200141 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
142 successThreshold: {{ .Values.readiness.successThreshold }}
143 failureThreshold: {{ .Values.readiness.failureThreshold }}
144 startupProbe:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200145 httpGet:
146 path: /onboarding-api/v1.0/healthcheck
147 port: {{ .Values.service.internalPort2 }}
Sylvain Desbureaux8c9416b2021-05-05 11:12:48 +0200148 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
149 periodSeconds: {{ .Values.startup.periodSeconds }}
150 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
151 successThreshold: {{ .Values.startup.successThreshold }}
152 failureThreshold: {{ .Values.startup.failureThreshold }}
ChrisC32172342020-10-02 16:39:13 +0200153 resources: {{ include "common.resources" . | nindent 12 }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000154 env:
155 - name: ENVNAME
ChrisC742a7b22020-09-04 11:29:57 +0200156 value: {{ .Values.env.name }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000157 - name: JAVA_OPTIONS
158 value: {{ .Values.config.javaOptions }}
159 - name: SDC_CLUSTER_NAME
ChrisC742a7b22020-09-04 11:29:57 +0200160 value: "SDC-CS-{{ .Values.env.name }}"
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000161 - name: cassandra_ssl_enabled
162 value: {{ .Values.config.cassandraSslEnabled | quote }}
163 - name: HOST_IP
164 valueFrom:
165 fieldRef:
166 fieldPath: status.podIP
167 - name: SDC_USER
168 valueFrom:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100169 secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000170 - name: SDC_PASSWORD
171 valueFrom:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100172 secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
kooper543d3aa2019-05-02 10:27:15 +0000173 - name: SDC_CERT_DIR
174 value: {{ .Values.cert.certDir }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000175 volumeMounts:
othman touijer2b764d02022-01-05 14:40:37 +0100176 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200177 mountPath: /app/jetty/chef-solo/environments/
othman touijer2b764d02022-01-05 14:40:37 +0100178 {{- if .Values.global.aafEnabled }}
179 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200180 mountPath: /app/jetty/chef-solo/cookbooks/sdc-onboard-backend/files/default/org.onap.sdc.p12
k.kedron2774ab12020-03-26 11:13:46 +0100181 subPath: org.onap.sdc.p12
othman touijer2b764d02022-01-05 14:40:37 +0100182 - name: sdc-environments
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200183 mountPath: /app/jetty/chef-solo/cookbooks/sdc-onboard-backend/files/default/org.onap.sdc.trust.jks
k.kedron2774ab12020-03-26 11:13:46 +0100184 subPath: org.onap.sdc.trust.jks
othman touijer2b764d02022-01-05 14:40:37 +0100185 {{- end }}
186 - name: localtime
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000187 mountPath: /etc/localtime
188 readOnly: true
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000189 - name: logs
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000190 mountPath: /var/log/onap
othman touijer2b764d02022-01-05 14:40:37 +0100191 - name: cert-storage
sebdete33ecd12020-11-04 18:22:19 +0100192 mountPath: "{{ .Values.cert.certDir }}"
othman touijer2b764d02022-01-05 14:40:37 +0100193 - name: logback
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000194 mountPath: /tmp/logback.xml
195 subPath: logback.xml
196 lifecycle:
197 postStart:
198 exec:
Joanna Jeremiczfe52bf52021-04-21 14:31:29 +0200199 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/app/jetty/config/onboarding-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000200 # side car containers
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000201 {{ include "common.log.sidecar" . | nindent 8 }}
farida azmy1383b4c2021-04-06 12:33:31 +0200202 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
ChrisC742a7b22020-09-04 11:29:57 +0200203 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
othman touijer2b764d02022-01-05 14:40:37 +0100204 - name: localtime
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000205 hostPath:
206 path: /etc/localtime
othman touijer2b764d02022-01-05 14:40:37 +0100207
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000208 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
othman touijer2b764d02022-01-05 14:40:37 +0100209 - name: logback
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000210 configMap:
211 name : {{ include "common.fullname" . }}-logging-configmap
othman touijer2b764d02022-01-05 14:40:37 +0100212 - name: sdc-environments
213 {{- if .Values.global.aafEnabled }}
214 emptyDir: { medium: "Memory" }
215 - name: sdc-environments-input
216 {{- end }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000217 configMap:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100218 name: {{ include "common.release" . }}-sdc-environments-configmap
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000219 defaultMode: 0755
Maciej Wereski771ec2a2021-10-14 13:59:12 +0000220 - name: logs
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000221 emptyDir: {}
othman touijer2b764d02022-01-05 14:40:37 +0100222 - name: cert-storage
sebdete33ecd12020-11-04 18:22:19 +0100223 persistentVolumeClaim:
224 claimName: {{ include "common.fullname" . }}-cert
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000225 imagePullSecrets:
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +0000226 - name: "{{ include "common.namespace" . }}-docker-registry-key"