blob: 6ffb59a775733cdb5e93c26cb5a3295fec910c67 [file] [log] [blame]
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05001# Copyright (c) 2019 IBM, Bell Canada
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +01002# Copyright (c) 2020 Samsung Electronics
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05003#
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
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020016apiVersion: apps/v1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050017kind: Deployment
18metadata:
19 name: {{ include "common.fullname" . }}
20 namespace: {{ include "common.namespace" . }}
21 labels:
22 app: {{ include "common.name" . }}
23 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010024 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050025 heritage: {{ .Release.Service }}
26spec:
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020027 selector:
28 matchLabels:
29 app: {{ include "common.name" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050030 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050031 strategy:
32 type: RollingUpdate
33 rollingUpdate:
34 # This allow a new pod to be ready before terminating the old one
35 # causing no downtime when replicas is set to 1
36 maxUnavailable: 0
37
38 # maxSurge to 1 is very important for the hazelcast integration
39 # we only want one pod at a time to restart not multiple
40 # and break the hazelcast cluster. We should not use % maxSurge value
41 # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
42 maxSurge: 1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050043 template:
44 metadata:
45 labels:
46 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010047 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050048 spec:
49 initContainers:
50 - command:
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010051 - sh
52 args:
53 - -c
Konrad Bańka031bdb72020-05-14 16:56:39 +020054 - "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 +010055 env:
56 - name: CDS_DB_USERNAME
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010057 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010058 - name: CDS_DB_PASSWORD
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010059 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}}
Konrad Bańka031bdb72020-05-14 16:56:39 +020060 - name: SDNC_DB_USERNAME
61 value: root
62 - name: SDNC_DB_PASSWORD
63 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-db-root-pass" "key" "password") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010064 volumeMounts:
65 - mountPath: /config-input/application.properties
66 name: {{ include "common.fullname" . }}-config
67 subPath: application.properties
68 - mountPath: /config
69 name: processed-config
70 image: "{{ .Values.global.envsubstImage }}"
71 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72 name: {{ include "common.name" . }}-update-config
73
74 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020075 - /app/ready.py
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050076 args:
77 - --container-name
Alexis de Talhouët63df1632019-03-20 08:17:58 -040078 - cds-db
Prathamesh Morde93da1272019-06-24 10:36:15 -040079 {{- if .Values.dmaapEnabled }}
80 - --container-name
81 - message-router
82 {{ end }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050083 env:
84 - name: NAMESPACE
85 valueFrom:
86 fieldRef:
87 apiVersion: v1
88 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020089 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050090 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
91 name: {{ include "common.name" . }}-readiness
jananibb38185a2020-04-23 19:33:45 +053092 - name: fix-permission
93 command:
94 - chown
95 - -R
root@nfs4b8e0752020-06-10 23:15:10 +000096 - 1000:1000
jananibb38185a2020-04-23 19:33:45 +053097 - /opt/app/onap/blueprints/deploy
98 image: busybox:latest
99 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
100 volumeMounts:
101 - mountPath: {{ .Values.persistence.deployedBlueprint }}
102 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500103 containers:
104 - name: {{ include "common.name" . }}
105 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
106 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
107 env:
108 - name: APP_CONFIG_HOME
109 value: {{ .Values.config.appConfigDir }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500110 - name: USE_SCRIPT_COMPILE_CACHE
111 value: {{ .Values.config.useScriptCompileCache | quote }}
112 # Cluster should only be enabled when replicaCount is more than 2 and useScriptCompileCache is set to false otherwise it won't work properly
113 - name: CLUSTER_ENABLED
114 value: {{ if and (gt (int (.Values.replicaCount)) 2) (not .Values.config.useScriptCompileCache) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
115 - name: CLUSTER_ID
116 value: {{ .Values.cluster.clusterName }}
117 - name: CLUSTER_NODE_ID
118 valueFrom:
119 fieldRef:
120 fieldPath: metadata.name
121 - name: CLUSTER_CONFIG_FILE
122 value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500123 ports:
124 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500125 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500126 - containerPort: {{ .Values.service.cluster.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500127 # disable liveness probe when breakpoints set in debugger
128 # so K8s doesn't restart unresponsive container
129 {{ if .Values.liveness.enabled }}
130 livenessProbe:
131 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400132 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500133 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400134 httpHeaders:
135 - name: Authorization
136 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500137 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
138 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400139 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500140 {{ end }}
141 readinessProbe:
142 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400143 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500144 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400145 httpHeaders:
146 - name: Authorization
147 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400148 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
149 periodSeconds: {{ .Values.readiness.periodSeconds }}
150 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500151 volumeMounts:
152 - mountPath: /etc/localtime
153 name: localtime
154 readOnly: true
155 - mountPath: {{ .Values.config.appConfigDir }}/application.properties
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100156 name: processed-config
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500157 subPath: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400158 - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
159 name: {{ include "common.fullname" . }}-config
160 subPath: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500161 - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
162 name: {{ include "common.fullname" . }}-config
163 subPath: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500164 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
165 name: {{ include "common.fullname" . }}-config
166 subPath: hazelcast.yaml
Abdelmuhaimen Seaudi204c64e2019-07-25 19:04:01 +0000167
168 - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
169 name: {{ include "common.fullname" . }}-config
170 subPath: ONAP_RootCA.cer
171
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400172 - mountPath: {{ .Values.persistence.deployedBlueprint }}
173 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500174 resources:
175{{ include "common.resources" . | indent 12 }}
176 {{- if .Values.nodeSelector }}
177 nodeSelector:
178{{ toYaml .Values.nodeSelector | indent 10 }}
179 {{- end -}}
180 {{- if .Values.affinity }}
181 affinity:
182{{ toYaml .Values.affinity | indent 10 }}
183 {{- end }}
184 volumes:
185 - name: localtime
186 hostPath:
187 path: /etc/localtime
188 - name: {{ include "common.fullname" . }}-config
189 configMap:
190 name: {{ include "common.fullname" . }}-configmap
191 items:
192 - key: application.properties
193 path: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400194 - key: error-messages_en.properties
195 path: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500196 - key: logback.xml
197 path: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500198 - key: hazelcast.yaml
199 path: hazelcast.yaml
Abdelmuhaimen Seaudia451fd62019-09-10 14:21:04 +0000200 - key: ONAP_RootCA.cer
201 path: ONAP_RootCA.cer
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400202 - name: {{ include "common.fullname" . }}-blueprints
203 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100204 claimName: {{ include "common.release" . }}-cds-blueprints
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100205 - name: processed-config
206 emptyDir:
207 medium: Memory
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500208 imagePullSecrets:
209 - name: "{{ include "common.namespace" . }}-docker-registry-key"