blob: a6e3a52bf75bb05f5aa2cb1186c8aa7c9bdb3e54 [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
efiacor7d3b0142023-02-28 11:28:52 +00004# Modification Copyright © 2022-2023 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
efiacor7d3b0142023-02-28 11:28:52 +000021metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050022spec:
efiacor7d3b0142023-02-28 11:28:52 +000023 selector: {{- include "common.selectors" . | nindent 4 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050024 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050025 strategy:
26 type: RollingUpdate
27 rollingUpdate:
efiacor7d3b0142023-02-28 11:28:52 +000028 # This allows a new pod to be ready before terminating the old one
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050029 # causing no downtime when replicas is set to 1
30 maxUnavailable: 0
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050031 # maxSurge to 1 is very important for the hazelcast integration
32 # we only want one pod at a time to restart not multiple
33 # and break the hazelcast cluster. We should not use % maxSurge value
34 # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
35 maxSurge: 1
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050036 template:
efiacor7d3b0142023-02-28 11:28:52 +000037 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050038 spec:
efiacor7d3b0142023-02-28 11:28:52 +000039 initContainers:
40 {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050041 - command:
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010042 - sh
43 args:
44 - -c
Konrad Bańka031bdb72020-05-14 16:56:39 +020045 - "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 +010046 env:
47 - name: CDS_DB_USERNAME
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010048 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010049 - name: CDS_DB_PASSWORD
Krzysztof Opasiak28d194f2020-03-24 03:27:32 +010050 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}}
Konrad Bańka031bdb72020-05-14 16:56:39 +020051 - name: SDNC_DB_USERNAME
52 value: root
53 - name: SDNC_DB_PASSWORD
54 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-db-root-pass" "key" "password") | indent 10}}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010055 volumeMounts:
56 - mountPath: /config-input/application.properties
57 name: {{ include "common.fullname" . }}-config
58 subPath: application.properties
59 - mountPath: /config
60 name: processed-config
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010061 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +010062 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63 name: {{ include "common.name" . }}-update-config
64
65 - command:
jananibb38185a2020-04-23 19:33:45 +053066 - chown
67 - -R
root@nfs4b8e0752020-06-10 23:15:10 +000068 - 1000:1000
jananibb38185a2020-04-23 19:33:45 +053069 - /opt/app/onap/blueprints/deploy
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010070 image: {{ include "repositoryGenerator.image.busybox" . }}
jananibb38185a2020-04-23 19:33:45 +053071 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72 volumeMounts:
73 - mountPath: {{ .Values.persistence.deployedBlueprint }}
74 name: {{ include "common.fullname" . }}-blueprints
efiacor7d3b0142023-02-28 11:28:52 +000075 name: fix-permission
76
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050077 containers:
78 - name: {{ include "common.name" . }}
Sylvain Desbureaux503b2292020-11-21 22:29:17 +010079 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050080 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
81 env:
82 - name: APP_CONFIG_HOME
83 value: {{ .Values.config.appConfigDir }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050084 - name: CLUSTER_ENABLED
Julien Fontaine063a7a82020-12-17 13:51:38 -050085 value: {{ if (gt (int (.Values.replicaCount)) 2) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050086 - name: CLUSTER_ID
87 value: {{ .Values.cluster.clusterName }}
88 - name: CLUSTER_NODE_ID
89 valueFrom:
90 fieldRef:
91 fieldPath: metadata.name
92 - name: CLUSTER_CONFIG_FILE
93 value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
Michal Jagiello2cef5642022-06-27 10:08:41 +000094 - name: CPS_USER
95 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-creds" "key" "login") | indent 12 }}
96 - name: CPS_PASS_PLAIN
97 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-creds" "key" "password") | indent 12 }}
efiacor7d3b0142023-02-28 11:28:52 +000098 - name: SASL_JAAS_PASS
99 valueFrom:
100 secretKeyRef:
101 name: {{ include "common.name" . }}-ku
102 key: password
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500103 ports:
104 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500105 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500106 - containerPort: {{ .Values.service.cluster.internalPort }}
Jozsef Csongvai08515b72021-04-28 17:04:57 -0400107 startupProbe:
108 httpGet:
109 path: /api/v1/execution-service/health-check
efiacor7d3b0142023-02-28 11:28:52 +0000110 port: {{ .Values.startup.port }}
Jozsef Csongvai08515b72021-04-28 17:04:57 -0400111 httpHeaders:
112 - name: Authorization
113 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
114 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
115 failureThreshold: {{ .Values.startup.failureThreshold }}
116 periodSeconds: {{ .Values.startup.periodSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500117 # disable liveness probe when breakpoints set in debugger
118 # so K8s doesn't restart unresponsive container
119 {{ if .Values.liveness.enabled }}
120 livenessProbe:
121 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400122 path: /api/v1/execution-service/health-check
efiacor7d3b0142023-02-28 11:28:52 +0000123 port: {{ .Values.liveness.port }}
Munir Ahmad597db662019-03-26 08:17:11 -0400124 httpHeaders:
125 - name: Authorization
126 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500127 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
128 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400129 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500130 {{ end }}
131 readinessProbe:
132 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400133 path: /api/v1/execution-service/health-check
efiacor7d3b0142023-02-28 11:28:52 +0000134 port: {{ .Values.readiness.port }}
Munir Ahmad597db662019-03-26 08:17:11 -0400135 httpHeaders:
136 - name: Authorization
137 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400138 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
139 periodSeconds: {{ .Values.readiness.periodSeconds }}
140 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
efiacor7d3b0142023-02-28 11:28:52 +0000141 volumeMounts:
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500142 - mountPath: /etc/localtime
143 name: localtime
144 readOnly: true
145 - mountPath: {{ .Values.config.appConfigDir }}/application.properties
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100146 name: processed-config
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500147 subPath: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400148 - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
149 name: {{ include "common.fullname" . }}-config
150 subPath: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500151 - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
152 name: {{ include "common.fullname" . }}-config
153 subPath: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500154 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
155 name: {{ include "common.fullname" . }}-config
156 subPath: hazelcast.yaml
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400157 - mountPath: {{ .Values.persistence.deployedBlueprint }}
158 name: {{ include "common.fullname" . }}-blueprints
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100159 resources: {{ include "common.resources" . | nindent 12 }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500160 {{- if .Values.nodeSelector }}
161 nodeSelector:
162{{ toYaml .Values.nodeSelector | indent 10 }}
163 {{- end -}}
164 {{- if .Values.affinity }}
165 affinity:
166{{ toYaml .Values.affinity | indent 10 }}
167 {{- end }}
farida azmyffad0322021-04-09 14:18:14 +0200168 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacor7d3b0142023-02-28 11:28:52 +0000169 volumes:
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500170 - name: localtime
171 hostPath:
172 path: /etc/localtime
173 - name: {{ include "common.fullname" . }}-config
174 configMap:
175 name: {{ include "common.fullname" . }}-configmap
176 items:
177 - key: application.properties
178 path: application.properties
Steve Siani3925d7f2020-03-14 12:15:50 -0400179 - key: error-messages_en.properties
180 path: error-messages_en.properties
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500181 - key: logback.xml
182 path: logback.xml
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -0500183 - key: hazelcast.yaml
184 path: hazelcast.yaml
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400185 - name: {{ include "common.fullname" . }}-blueprints
186 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100187 claimName: {{ include "common.release" . }}-cds-blueprints
Krzysztof Opasiak32f9aaa2020-02-06 23:05:15 +0100188 - name: processed-config
189 emptyDir:
190 medium: Memory
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500191 imagePullSecrets:
192 - name: "{{ include "common.namespace" . }}-docker-registry-key"