blob: 9645b20cd2764e3a128df9fe1977247aef5f692b [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
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05004#
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 Latusek50530762020-10-21 13:36:29 +020016*/}}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050017
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020018apiVersion: apps/v1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050019kind: Deployment
20metadata:
21 name: {{ include "common.fullname" . }}
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050027 heritage: {{ .Release.Service }}
28spec:
Grzegorz-Lis9bd98782020-07-27 15:22:28 +020029 selector:
30 matchLabels:
31 app: {{ include "common.name" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050032 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050033 strategy:
34 type: RollingUpdate
35 rollingUpdate:
36 # This allow a new pod to be ready before terminating the old one
37 # causing no downtime when replicas is set to 1
38 maxUnavailable: 0
39
40 # maxSurge to 1 is very important for the hazelcast integration
41 # we only want one pod at a time to restart not multiple
42 # and break the hazelcast cluster. We should not use % maxSurge value
43 # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
44 maxSurge: 1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050045 template:
46 metadata:
47 labels:
48 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010049 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050050 spec:
51 initContainers:
52 - command:
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010053 - sh
54 args:
55 - -c
Konrad Bańka031bdb72020-05-14 16:56:39 +020056 - "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 +010057 env:
58 - name: CDS_DB_USERNAME
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010059 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010060 - name: CDS_DB_PASSWORD
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010061 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}}
Konrad Bańka031bdb72020-05-14 16:56:39 +020062 - name: SDNC_DB_USERNAME
63 value: root
64 - name: SDNC_DB_PASSWORD
65 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-db-root-pass" "key" "password") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010066 volumeMounts:
67 - mountPath: /config-input/application.properties
68 name: {{ include "common.fullname" . }}-config
69 subPath: application.properties
70 - mountPath: /config
71 name: processed-config
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010072 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010073 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74 name: {{ include "common.name" . }}-update-config
75
76 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020077 - /app/ready.py
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050078 args:
79 - --container-name
Alexis de Talhouët63df1632019-03-20 08:17:58 -040080 - cds-db
Prathamesh Morde93da1272019-06-24 10:36:15 -040081 {{- if .Values.dmaapEnabled }}
82 - --container-name
83 - message-router
84 {{ end }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050085 env:
86 - name: NAMESPACE
87 valueFrom:
88 fieldRef:
89 apiVersion: v1
90 fieldPath: metadata.namespace
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010091 image: {{ include "repositoryGenerator.image.readiness" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050092 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93 name: {{ include "common.name" . }}-readiness
jananibb38185a2020-04-23 19:33:45 +053094 - name: fix-permission
95 command:
96 - chown
97 - -R
root@nfs4b8e0752020-06-10 23:15:10 +000098 - 1000:1000
jananibb38185a2020-04-23 19:33:45 +053099 - /opt/app/onap/blueprints/deploy
Sylvain Desbureaux503b2292020-11-21 22:29:17 +0100100 image: {{ include "repositoryGenerator.image.busybox" . }}
jananibb38185a2020-04-23 19:33:45 +0530101 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
102 volumeMounts:
103 - mountPath: {{ .Values.persistence.deployedBlueprint }}
104 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500105 containers:
106 - name: {{ include "common.name" . }}
Sylvain Desbureaux503b2292020-11-21 22:29:17 +0100107 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500108 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
109 env:
110 - name: APP_CONFIG_HOME
111 value: {{ .Values.config.appConfigDir }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500112 - name: CLUSTER_ENABLED
Julien Fontaine063a7a82020-12-17 13:51:38 -0500113 value: {{ if (gt (int (.Values.replicaCount)) 2) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500114 - name: CLUSTER_ID
115 value: {{ .Values.cluster.clusterName }}
116 - name: CLUSTER_NODE_ID
117 valueFrom:
118 fieldRef:
119 fieldPath: metadata.name
120 - name: CLUSTER_CONFIG_FILE
121 value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500122 ports:
123 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500124 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500125 - containerPort: {{ .Values.service.cluster.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500126 # disable liveness probe when breakpoints set in debugger
127 # so K8s doesn't restart unresponsive container
128 {{ if .Values.liveness.enabled }}
129 livenessProbe:
130 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400131 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500132 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400133 httpHeaders:
134 - name: Authorization
135 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500136 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
137 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400138 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500139 {{ end }}
140 readinessProbe:
141 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400142 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500143 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400144 httpHeaders:
145 - name: Authorization
146 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400147 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
148 periodSeconds: {{ .Values.readiness.periodSeconds }}
149 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500150 volumeMounts:
151 - mountPath: /etc/localtime
152 name: localtime
153 readOnly: true
154 - mountPath: {{ .Values.config.appConfigDir }}/application.properties
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100155 name: processed-config
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500156 subPath: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400157 - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
158 name: {{ include "common.fullname" . }}-config
159 subPath: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500160 - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
161 name: {{ include "common.fullname" . }}-config
162 subPath: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500163 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
164 name: {{ include "common.fullname" . }}-config
165 subPath: hazelcast.yaml
Abdelmuhaimen Seaudi204c64e2019-07-25 19:04:01 +0000166
167 - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
168 name: {{ include "common.fullname" . }}-config
169 subPath: ONAP_RootCA.cer
170
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400171 - mountPath: {{ .Values.persistence.deployedBlueprint }}
172 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500173 resources:
174{{ include "common.resources" . | indent 12 }}
175 {{- if .Values.nodeSelector }}
176 nodeSelector:
177{{ toYaml .Values.nodeSelector | indent 10 }}
178 {{- end -}}
179 {{- if .Values.affinity }}
180 affinity:
181{{ toYaml .Values.affinity | indent 10 }}
182 {{- end }}
183 volumes:
184 - name: localtime
185 hostPath:
186 path: /etc/localtime
187 - name: {{ include "common.fullname" . }}-config
188 configMap:
189 name: {{ include "common.fullname" . }}-configmap
190 items:
191 - key: application.properties
192 path: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400193 - key: error-messages_en.properties
194 path: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500195 - key: logback.xml
196 path: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500197 - key: hazelcast.yaml
198 path: hazelcast.yaml
Abdelmuhaimen Seaudia451fd62019-09-10 14:21:04 +0000199 - key: ONAP_RootCA.cer
200 path: ONAP_RootCA.cer
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400201 - name: {{ include "common.fullname" . }}-blueprints
202 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100203 claimName: {{ include "common.release" . }}-cds-blueprints
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100204 - name: processed-config
205 emptyDir:
206 medium: Memory
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500207 imagePullSecrets:
208 - name: "{{ include "common.namespace" . }}-docker-registry-key"