Remove redundant Ingress service config
[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 }}/logback.xml
120             name: {{ include "common.fullname" . }}-config
121             subPath: logback.xml
122           - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
123             name: {{ include "common.fullname" . }}-config
124             subPath: hazelcast.yaml
125
126           - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
127             name: {{ include "common.fullname" . }}-config
128             subPath: ONAP_RootCA.cer
129
130           - mountPath: {{ .Values.persistence.deployedBlueprint }}
131             name: {{ include "common.fullname" . }}-blueprints
132           resources:
133 {{ include "common.resources" . | indent 12 }}
134         {{- if .Values.nodeSelector }}
135         nodeSelector:
136 {{ toYaml .Values.nodeSelector | indent 10 }}
137         {{- end -}}
138         {{- if .Values.affinity }}
139         affinity:
140 {{ toYaml .Values.affinity | indent 10 }}
141         {{- end }}
142       volumes:
143         - name: localtime
144           hostPath:
145             path: /etc/localtime
146         - name: {{ include "common.fullname" . }}-config
147           configMap:
148             name: {{ include "common.fullname" . }}-configmap
149             items:
150             - key: application.properties
151               path: application.properties
152             - key: logback.xml
153               path: logback.xml
154             - key: hazelcast.yaml
155               path: hazelcast.yaml
156             - key: ONAP_RootCA.cer
157               path: ONAP_RootCA.cer
158         - name: {{ include "common.fullname" . }}-blueprints
159           persistentVolumeClaim:
160             claimName: {{ include "common.release" . }}-cds-blueprints
161       imagePullSecrets:
162       - name: "{{ include "common.namespace" . }}-docker-registry-key"