Support execution control of SDC Workflow init
[oom.git] / kubernetes / sdc / charts / sdc-wfd-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, Bell Canada
2 # Modifications Copyright © 2018  ZTE
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
33     spec:
34       initContainers:
35       {{- if .Values.global.initJob.enabled }}
36       - name: {{ include "common.name" . }}-job-completion
37         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
38         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
39         command:
40         - /root/job_complete.py
41         args:
42         - --job-name
43         - {{ include "common.fullname" . }}-workflow-init
44         env:
45         - name: NAMESPACE
46           valueFrom:
47             fieldRef:
48               apiVersion: v1
49               fieldPath: metadata.namespace
50       {{ end }}
51       containers:
52         - name: {{ include "common.name" . }}
53           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
54           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55           ports:
56           - containerPort: {{ .Values.service.internalPort }}
57           # disable liveness probe when breakpoints set in debugger
58           # so K8s doesn't restart unresponsive container
59           {{ if .Values.liveness.enabled }}
60           livenessProbe:
61             tcpSocket:
62               port: {{ .Values.service.internalPort }}
63             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
64             periodSeconds: {{ .Values.liveness.periodSeconds }}
65           {{ end }}
66           readinessProbe:
67             tcpSocket:
68               port: {{ .Values.service.internalPort }}
69             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.readiness.periodSeconds }}
71           env:
72           - name: JAVA_OPTIONS
73             value: {{ .Values.config.javaOptions }}
74           - name: CS_HOSTS
75             value: "{{ .Values.config.cassandraHosts }}"
76           - name: CS_PORT
77             value: "{{ .Values.config.cassandraClientPort }}"
78           - name: CS_USER
79             valueFrom:
80               secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_user}
81           - name: CS_PASSWORD
82             valueFrom:
83               secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_password}
84           - name: SDC_PROTOCOL
85             value: "{{ .Values.config.sdcProtocol }}"
86           - name: SDC_ENDPOINT
87             value: "{{ .Values.config.sdcEndpoint }}"
88           - name: SDC_USER
89             value: "{{ .Values.config.sdcExternalUser }}"
90           - name: SDC_PASSWORD
91             value: "{{ .Values.config.sdcExternalUserPassword }}"
92       imagePullSecrets:
93       - name: "{{ include "common.namespace" . }}-docker-registry-key"