Fix dictionary merge
[oom.git] / kubernetes / cds / charts / controller-blueprints / templates / deployment.yaml
1 # Copyright (c) 2018 Amdocs, Bell Canada
2 #
3 # Modifications Copyright (c) 2019 IBM, Bell Canada
4 #
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.
16
17 apiVersion: extensions/v1beta1
18 kind: Deployment
19 metadata:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ .Release.Name }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ .Release.Name }}
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - cds-db
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-readiness
50       containers:
51         - name: {{ include "common.name" . }}
52           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           env:
55             - name: APP_CONFIG_HOME
56               value: {{ .Values.config.appConfigDir }}
57           ports:
58           - containerPort: {{ .Values.service.internalPort }}
59           # disable liveness probe when breakpoints set in debugger
60           # so K8s doesn't restart unresponsive container
61           {{ if .Values.liveness.enabled }}
62           livenessProbe:
63             tcpSocket:
64               port: {{ .Values.service.internalPort }}
65             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.liveness.periodSeconds }}
67           {{ end }}
68           readinessProbe:
69             tcpSocket:
70               port: {{ .Values.service.internalPort }}
71             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.readiness.periodSeconds }}
73           volumeMounts:
74           - mountPath: /etc/localtime
75             name: localtime
76             readOnly: true
77           - mountPath: {{ .Values.config.appConfigDir }}/application.properties
78             name: {{ include "common.fullname" . }}-config
79             subPath: application.properties
80           - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
81             name: {{ include "common.fullname" . }}-config
82             subPath: logback.xml
83           resources:
84 {{ include "common.resources" . | indent 12 }}
85         {{- if .Values.nodeSelector }}
86         nodeSelector:
87 {{ toYaml .Values.nodeSelector | indent 10 }}
88         {{- end -}}
89         {{- if .Values.affinity }}
90         affinity:
91 {{ toYaml .Values.affinity | indent 10 }}
92         {{- end }}
93       volumes:
94         - name: localtime
95           hostPath:
96             path: /etc/localtime
97         - name: {{ include "common.fullname" . }}-config
98           configMap:
99             name: {{ include "common.fullname" . }}-configmap
100             items:
101             - key: application.properties
102               path: application.properties
103             - key: logback.xml
104               path: logback.xml
105       imagePullSecrets:
106       - name: "{{ include "common.namespace" . }}-docker-registry-key"