blob: 161cf28d27542a66e29c44aa8451522f45e17c38 [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
16apiVersion: extensions/v1beta1
17kind: 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:
27 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050028 strategy:
29 type: RollingUpdate
30 rollingUpdate:
31 # This allow a new pod to be ready before terminating the old one
32 # causing no downtime when replicas is set to 1
33 maxUnavailable: 0
34
35 # maxSurge to 1 is very important for the hazelcast integration
36 # we only want one pod at a time to restart not multiple
37 # and break the hazelcast cluster. We should not use % maxSurge value
38 # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
39 maxSurge: 1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050040 template:
41 metadata:
42 labels:
43 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010044 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050045 spec:
46 initContainers:
47 - command:
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010048 - sh
49 args:
50 - -c
Konrad Bańka031bdb72020-05-14 16:56:39 +020051 - "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 +010052 env:
53 - name: CDS_DB_USERNAME
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010054 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010055 - name: CDS_DB_PASSWORD
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010056 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}}
Konrad Bańka031bdb72020-05-14 16:56:39 +020057 - name: SDNC_DB_USERNAME
58 value: root
59 - name: SDNC_DB_PASSWORD
60 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-db-root-pass" "key" "password") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010061 volumeMounts:
62 - mountPath: /config-input/application.properties
63 name: {{ include "common.fullname" . }}-config
64 subPath: application.properties
65 - mountPath: /config
66 name: processed-config
67 image: "{{ .Values.global.envsubstImage }}"
68 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69 name: {{ include "common.name" . }}-update-config
70
71 - command:
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050072 - /root/ready.py
73 args:
74 - --container-name
Alexis de Talhouët63df1632019-03-20 08:17:58 -040075 - cds-db
Prathamesh Morde93da1272019-06-24 10:36:15 -040076 {{- if .Values.dmaapEnabled }}
77 - --container-name
78 - message-router
79 {{ end }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050080 env:
81 - name: NAMESPACE
82 valueFrom:
83 fieldRef:
84 apiVersion: v1
85 fieldPath: metadata.namespace
86 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
87 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88 name: {{ include "common.name" . }}-readiness
jananibb38185a2020-04-23 19:33:45 +053089 - name: fix-permission
90 command:
91 - chown
92 - -R
93 - 100:101
94 - /opt/app/onap/blueprints/deploy
95 image: busybox:latest
96 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97 volumeMounts:
98 - mountPath: {{ .Values.persistence.deployedBlueprint }}
99 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500100 containers:
101 - name: {{ include "common.name" . }}
102 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
103 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
104 env:
105 - name: APP_CONFIG_HOME
106 value: {{ .Values.config.appConfigDir }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500107 - name: USE_SCRIPT_COMPILE_CACHE
108 value: {{ .Values.config.useScriptCompileCache | quote }}
109 # Cluster should only be enabled when replicaCount is more than 2 and useScriptCompileCache is set to false otherwise it won't work properly
110 - name: CLUSTER_ENABLED
111 value: {{ if and (gt (int (.Values.replicaCount)) 2) (not .Values.config.useScriptCompileCache) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
112 - name: CLUSTER_ID
113 value: {{ .Values.cluster.clusterName }}
114 - name: CLUSTER_NODE_ID
115 valueFrom:
116 fieldRef:
117 fieldPath: metadata.name
118 - name: CLUSTER_CONFIG_FILE
119 value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500120 ports:
121 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500122 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500123 - containerPort: {{ .Values.service.cluster.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500124 # disable liveness probe when breakpoints set in debugger
125 # so K8s doesn't restart unresponsive container
126 {{ if .Values.liveness.enabled }}
127 livenessProbe:
128 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400129 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500130 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400131 httpHeaders:
132 - name: Authorization
133 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500134 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
135 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400136 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500137 {{ end }}
138 readinessProbe:
139 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400140 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500141 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400142 httpHeaders:
143 - name: Authorization
144 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400145 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
146 periodSeconds: {{ .Values.readiness.periodSeconds }}
147 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500148 volumeMounts:
149 - mountPath: /etc/localtime
150 name: localtime
151 readOnly: true
152 - mountPath: {{ .Values.config.appConfigDir }}/application.properties
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100153 name: processed-config
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500154 subPath: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400155 - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
156 name: {{ include "common.fullname" . }}-config
157 subPath: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500158 - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
159 name: {{ include "common.fullname" . }}-config
160 subPath: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500161 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
162 name: {{ include "common.fullname" . }}-config
163 subPath: hazelcast.yaml
Abdelmuhaimen Seaudi204c64e2019-07-25 19:04:01 +0000164
165 - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
166 name: {{ include "common.fullname" . }}-config
167 subPath: ONAP_RootCA.cer
168
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400169 - mountPath: {{ .Values.persistence.deployedBlueprint }}
170 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500171 resources:
172{{ include "common.resources" . | indent 12 }}
173 {{- if .Values.nodeSelector }}
174 nodeSelector:
175{{ toYaml .Values.nodeSelector | indent 10 }}
176 {{- end -}}
177 {{- if .Values.affinity }}
178 affinity:
179{{ toYaml .Values.affinity | indent 10 }}
180 {{- end }}
181 volumes:
182 - name: localtime
183 hostPath:
184 path: /etc/localtime
185 - name: {{ include "common.fullname" . }}-config
186 configMap:
187 name: {{ include "common.fullname" . }}-configmap
188 items:
189 - key: application.properties
190 path: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400191 - key: error-messages_en.properties
192 path: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500193 - key: logback.xml
194 path: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500195 - key: hazelcast.yaml
196 path: hazelcast.yaml
Abdelmuhaimen Seaudia451fd62019-09-10 14:21:04 +0000197 - key: ONAP_RootCA.cer
198 path: ONAP_RootCA.cer
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400199 - name: {{ include "common.fullname" . }}-blueprints
200 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100201 claimName: {{ include "common.release" . }}-cds-blueprints
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100202 - name: processed-config
203 emptyDir:
204 medium: Memory
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500205 imagePullSecrets:
206 - name: "{{ include "common.namespace" . }}-docker-registry-key"