blob: d68e9002225885271cf84dc1e41f283bd1da8037 [file] [log] [blame]
Jakub Latusek50530762020-10-21 13:36:29 +02001{{/*
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05002# Copyright (c) 2019 IBM, Bell Canada
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +01003# Copyright (c) 2020 Samsung Electronics
efiacorecbae132022-03-04 15:01:30 +00004# Modification Copyright © 2022 Nordix Foundation
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05005#
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 Latusek50530762020-10-21 13:36:29 +020017*/}}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050018
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020019apiVersion: apps/v1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050020kind: 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" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050028 heritage: {{ .Release.Service }}
29spec:
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020030 selector:
31 matchLabels:
32 app: {{ include "common.name" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050033 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050034 strategy:
35 type: RollingUpdate
36 rollingUpdate:
37 # This allow a new pod to be ready before terminating the old one
38 # causing no downtime when replicas is set to 1
39 maxUnavailable: 0
40
41 # maxSurge to 1 is very important for the hazelcast integration
42 # we only want one pod at a time to restart not multiple
43 # and break the hazelcast cluster. We should not use % maxSurge value
44 # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
45 maxSurge: 1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050046 template:
47 metadata:
48 labels:
49 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010050 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050051 spec:
Abdelmuhaimen Seaudi822eb092021-09-04 11:08:36 +020052 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050053 - command:
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010054 - sh
55 args:
56 - -c
Konrad Bańka031bdb72020-05-14 16:56:39 +020057 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst '${CDS_DB_USERNAME},${CDS_DB_PASSWORD},${SDNC_DB_USERNAME},${SDNC_DB_PASSWORD}' <${PFILE} >/config/${PFILE}; done"
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010058 env:
59 - name: CDS_DB_USERNAME
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010060 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010061 - name: CDS_DB_PASSWORD
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010062 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}}
Konrad Bańka031bdb72020-05-14 16:56:39 +020063 - name: SDNC_DB_USERNAME
64 value: root
65 - name: SDNC_DB_PASSWORD
66 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-db-root-pass" "key" "password") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010067 volumeMounts:
68 - mountPath: /config-input/application.properties
69 name: {{ include "common.fullname" . }}-config
70 subPath: application.properties
71 - mountPath: /config
72 name: processed-config
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010073 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010074 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75 name: {{ include "common.name" . }}-update-config
76
77 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020078 - /app/ready.py
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050079 args:
80 - --container-name
Alexis de Talhouët63df1632019-03-20 08:17:58 -040081 - cds-db
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050082 env:
83 - name: NAMESPACE
84 valueFrom:
85 fieldRef:
86 apiVersion: v1
87 fieldPath: metadata.namespace
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010088 image: {{ include "repositoryGenerator.image.readiness" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050089 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90 name: {{ include "common.name" . }}-readiness
jananibb38185a2020-04-23 19:33:45 +053091 - name: fix-permission
92 command:
93 - chown
94 - -R
root@nfs4b8e0752020-06-10 23:15:10 +000095 - 1000:1000
jananibb38185a2020-04-23 19:33:45 +053096 - /opt/app/onap/blueprints/deploy
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010097 image: {{ include "repositoryGenerator.image.busybox" . }}
jananibb38185a2020-04-23 19:33:45 +053098 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
99 volumeMounts:
100 - mountPath: {{ .Values.persistence.deployedBlueprint }}
101 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500102 containers:
103 - name: {{ include "common.name" . }}
Sylvain Desbureaux503b2292020-11-21 22:29:17 +0100104 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500105 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
106 env:
107 - name: APP_CONFIG_HOME
108 value: {{ .Values.config.appConfigDir }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500109 - name: CLUSTER_ENABLED
Julien Fontaine063a7a82020-12-17 13:51:38 -0500110 value: {{ if (gt (int (.Values.replicaCount)) 2) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500111 - name: CLUSTER_ID
112 value: {{ .Values.cluster.clusterName }}
Abdelmuhaimen Seaudi822eb092021-09-04 11:08:36 +0200113 - name: AAF_CREDSPATH
114 value: {{ .Values.certInitializer.credsPath }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500115 - name: CLUSTER_NODE_ID
116 valueFrom:
117 fieldRef:
118 fieldPath: metadata.name
119 - name: CLUSTER_CONFIG_FILE
120 value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
efiacorecbae132022-03-04 15:01:30 +0000121 {{ if .Values.useStrimziKafka }}
122 - name: JAAS_PASS
123 value: {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-kafka-secret" "key" "password") | indent 12 }}
124 {{ end }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500125 ports:
126 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500127 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500128 - containerPort: {{ .Values.service.cluster.internalPort }}
Jozsef Csongvai08515b72021-04-28 17:04:57 -0400129 startupProbe:
130 httpGet:
131 path: /api/v1/execution-service/health-check
132 port: {{ .Values.service.http.internalPort }}
133 httpHeaders:
134 - name: Authorization
135 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
136 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
137 failureThreshold: {{ .Values.startup.failureThreshold }}
138 periodSeconds: {{ .Values.startup.periodSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500139 # disable liveness probe when breakpoints set in debugger
140 # so K8s doesn't restart unresponsive container
141 {{ if .Values.liveness.enabled }}
142 livenessProbe:
143 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400144 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500145 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400146 httpHeaders:
147 - name: Authorization
148 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500149 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
150 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400151 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500152 {{ end }}
153 readinessProbe:
154 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400155 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500156 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400157 httpHeaders:
158 - name: Authorization
159 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400160 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
161 periodSeconds: {{ .Values.readiness.periodSeconds }}
162 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Abdelmuhaimen Seaudi822eb092021-09-04 11:08:36 +0200163 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500164 - mountPath: /etc/localtime
165 name: localtime
166 readOnly: true
167 - mountPath: {{ .Values.config.appConfigDir }}/application.properties
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100168 name: processed-config
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500169 subPath: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400170 - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
171 name: {{ include "common.fullname" . }}-config
172 subPath: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500173 - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
174 name: {{ include "common.fullname" . }}-config
175 subPath: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500176 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
177 name: {{ include "common.fullname" . }}-config
178 subPath: hazelcast.yaml
Abdelmuhaimen Seaudi204c64e2019-07-25 19:04:01 +0000179
180 - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
181 name: {{ include "common.fullname" . }}-config
182 subPath: ONAP_RootCA.cer
183
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400184 - mountPath: {{ .Values.persistence.deployedBlueprint }}
185 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500186 resources:
187{{ include "common.resources" . | indent 12 }}
188 {{- if .Values.nodeSelector }}
189 nodeSelector:
190{{ toYaml .Values.nodeSelector | indent 10 }}
191 {{- end -}}
192 {{- if .Values.affinity }}
193 affinity:
194{{ toYaml .Values.affinity | indent 10 }}
195 {{- end }}
farida azmyffad0322021-04-09 14:18:14 +0200196 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Abdelmuhaimen Seaudi822eb092021-09-04 11:08:36 +0200197 volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500198 - name: localtime
199 hostPath:
200 path: /etc/localtime
201 - name: {{ include "common.fullname" . }}-config
202 configMap:
203 name: {{ include "common.fullname" . }}-configmap
204 items:
205 - key: application.properties
206 path: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400207 - key: error-messages_en.properties
208 path: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500209 - key: logback.xml
210 path: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500211 - key: hazelcast.yaml
212 path: hazelcast.yaml
Abdelmuhaimen Seaudia451fd62019-09-10 14:21:04 +0000213 - key: ONAP_RootCA.cer
214 path: ONAP_RootCA.cer
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400215 - name: {{ include "common.fullname" . }}-blueprints
216 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100217 claimName: {{ include "common.release" . }}-cds-blueprints
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100218 - name: processed-config
219 emptyDir:
220 medium: Memory
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500221 imagePullSecrets:
222 - name: "{{ include "common.namespace" . }}-docker-registry-key"