[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / dcaegen2 / components / dcae-servicechange-handler / templates / deployment.yaml
1 #============LICENSE_START========================================================
2 # ================================================================================
3 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
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 # ============LICENSE_END=========================================================
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   replicas: 1
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40         - name: {{ include "common.name" . }}-readiness
41           image: {{ include "common.repository" . }}/{{ .Values.global.readinessImage }}
42           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43           command:
44             - /app/ready.py
45           args:
46             - --container-name
47             - "dcae-inventory-api"
48             - --container-name
49             - "message-router"
50             - --container-name
51             - "sdc-dcae-be"
52             - "-t"
53             - "45"
54           env:
55           - name: NAMESPACE
56             valueFrom:
57               fieldRef:
58                 apiVersion: v1
59                 fieldPath: metadata.namespace
60         - name: init-tls
61           env:
62           - name: POD_IP
63             valueFrom:
64               fieldRef:
65                 apiVersion: v1
66                 fieldPath: status.podIP
67           image: {{ .Values.global.tlsRepository }}/{{ .Values.global.tlsImage }}
68           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69           resources: {}
70           volumeMounts:
71             - mountPath: /opt/app/osaaf
72               name: tls-info
73       containers:
74         - name: {{ include "common.name" . }}
75           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
76           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77           resources:
78 {{ include "common.resources" . | indent 12 }}
79           # disable liveness probe when breakpoints set in debugger
80           # so K8s doesn't restart unresponsive container
81           {{- if eq .Values.liveness.enabled true }}
82           livenessProbe:
83             exec:
84               command: [{{ .Values.liveness.script }}]
85             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86             periodSeconds: {{ .Values.liveness.periodSeconds }}
87           {{ end }}
88           readinessProbe:
89             exec:
90               command: [{{ .Values.readiness.script }}]
91             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
92             periodSeconds: {{ .Values.readiness.periodSeconds }}
93           volumeMounts:
94             - name: {{  include "common.fullname" . }}-sch-config
95               mountPath: /opt/config.json
96               subPath: config.json
97             # NOTE: This is tied to the PATH_TO_CACERT env variable
98             - mountPath: /opt/cert/
99               name: tls-info
100           env:
101             - name: CONSUL_HOST
102               value: consul.{{ include "common.namespace" . }}
103             - name: PATH_TO_CACERT
104               value: "/opt/cert/cacert.pem"
105             - name: SCH_ARGS
106               value: "prod /opt/config.json"
107       volumes:
108         - name: {{ include "common.fullname" . }}-sch-config
109           configMap:
110             name: {{ include "common.fullname" . }}-configmap
111         - emptyDir: {}
112           name: tls-info
113       imagePullSecrets:
114       - name: "{{ include "common.namespace" . }}-docker-registry-key"