update properties with ErrorCatalog
[oom.git] / kubernetes / cds / charts / cds-blueprints-processor / templates / deployment.yaml
1 # Copyright (c) 2019 IBM, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   strategy:
28     type: RollingUpdate
29     rollingUpdate:
30       # This allow a new pod to be ready before terminating the old one
31       # causing no downtime when replicas is set to 1
32       maxUnavailable: 0
33
34       # maxSurge to 1 is very important for the hazelcast integration
35       # we only want one pod at a time to restart not multiple
36       # and break the hazelcast cluster. We should not use % maxSurge value
37       # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/
38       maxSurge: 1
39   template:
40     metadata:
41       labels:
42         app: {{ include "common.name" . }}
43         release: {{ include "common.release" . }}
44     spec:
45       initContainers:
46       - command:
47         - /root/ready.py
48         args:
49         - --container-name
50         - cds-db
51         {{- if .Values.dmaapEnabled  }}
52         - --container-name
53         - message-router
54         {{ end }}
55         env:
56         - name: NAMESPACE
57           valueFrom:
58             fieldRef:
59               apiVersion: v1
60               fieldPath: metadata.namespace
61         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
62         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63         name: {{ include "common.name" . }}-readiness
64       containers:
65         - name: {{ include "common.name" . }}
66           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
67           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
68           env:
69           - name: APP_CONFIG_HOME
70             value: {{ .Values.config.appConfigDir }}
71           - name: USE_SCRIPT_COMPILE_CACHE
72             value: {{ .Values.config.useScriptCompileCache | quote }}
73           # Cluster should only be enabled when replicaCount is more than 2 and useScriptCompileCache is set to false otherwise it won't work properly
74           - name: CLUSTER_ENABLED
75             value: {{ if and (gt (int (.Values.replicaCount)) 2) (not .Values.config.useScriptCompileCache) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }}
76           - name: CLUSTER_ID
77             value: {{ .Values.cluster.clusterName }}
78           - name: CLUSTER_NODE_ID
79             valueFrom:
80               fieldRef:
81                 fieldPath: metadata.name
82           - name: CLUSTER_CONFIG_FILE
83             value: {{ .Values.config.appConfigDir }}/hazelcast.yaml
84           ports:
85           - containerPort: {{ .Values.service.http.internalPort }}
86           - containerPort: {{ .Values.service.grpc.internalPort }}
87           - containerPort: {{ .Values.service.cluster.internalPort }}
88           # disable liveness probe when breakpoints set in debugger
89           # so K8s doesn't restart unresponsive container
90           {{ if .Values.liveness.enabled }}
91           livenessProbe:
92             httpGet:
93               path: /api/v1/execution-service/health-check
94               port: {{ .Values.service.http.internalPort }}
95               httpHeaders:
96               - name: Authorization
97                 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
98             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.liveness.periodSeconds }}
100             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
101           {{ end }}
102           readinessProbe:
103             httpGet:
104               path: /api/v1/execution-service/health-check
105               port: {{ .Values.service.http.internalPort }}
106               httpHeaders:
107               - name: Authorization
108                 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
109             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
110             periodSeconds: {{ .Values.readiness.periodSeconds }}
111             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
112           volumeMounts:
113           - mountPath: /etc/localtime
114             name: localtime
115             readOnly: true
116           - mountPath: {{ .Values.config.appConfigDir }}/application.properties
117             name: {{ include "common.fullname" . }}-config
118             subPath: application.properties
119           - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties
120             name: {{ include "common.fullname" . }}-config
121             subPath: error-messages_en.properties
122           - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
123             name: {{ include "common.fullname" . }}-config
124             subPath: logback.xml
125           - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
126             name: {{ include "common.fullname" . }}-config
127             subPath: hazelcast.yaml
128
129           - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
130             name: {{ include "common.fullname" . }}-config
131             subPath: ONAP_RootCA.cer
132
133           - mountPath: {{ .Values.persistence.deployedBlueprint }}
134             name: {{ include "common.fullname" . }}-blueprints
135           resources:
136 {{ include "common.resources" . | indent 12 }}
137         {{- if .Values.nodeSelector }}
138         nodeSelector:
139 {{ toYaml .Values.nodeSelector | indent 10 }}
140         {{- end -}}
141         {{- if .Values.affinity }}
142         affinity:
143 {{ toYaml .Values.affinity | indent 10 }}
144         {{- end }}
145       volumes:
146         - name: localtime
147           hostPath:
148             path: /etc/localtime
149         - name: {{ include "common.fullname" . }}-config
150           configMap:
151             name: {{ include "common.fullname" . }}-configmap
152             items:
153             - key: application.properties
154               path: application.properties
155             - key: error-messages_en.properties
156               path: error-messages_en.properties
157             - key: logback.xml
158               path: logback.xml
159             - key: hazelcast.yaml
160               path: hazelcast.yaml
161             - key: ONAP_RootCA.cer
162               path: ONAP_RootCA.cer
163         - name: {{ include "common.fullname" . }}-blueprints
164           persistentVolumeClaim:
165             claimName: {{ include "common.release" . }}-cds-blueprints
166       imagePullSecrets:
167       - name: "{{ include "common.namespace" . }}-docker-registry-key"