082a9afa76af86c7a77a4449a53cda1982ccf326
[oom.git] / kubernetes / oof / components / oof-has / components / oof-has-data / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T,VMware
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
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   replicas: {{ .Values.replicaCount }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       initContainers:
28       {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
29       containers:
30         - name: {{ include "common.name" . }}
31           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
32           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
33           command:
34           - python
35           args:
36           - /usr/local/bin/conductor-data
37           - --config-file=/usr/local/bin/conductor.conf
38           # disable liveness probe when breakpoints set in debugger
39           # so K8s doesn't restart unresponsive container
40           {{- if .Values.liveness.enabled }}
41           livenessProbe:
42             exec:
43               command:
44               - cat
45               - /usr/local/bin/healthy.sh
46             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
47             periodSeconds: {{ .Values.liveness.periodSeconds }}
48           {{ end -}}
49           readinessProbe:
50             exec:
51               command:
52               - cat
53               - /usr/local/bin/healthy.sh
54             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
55             periodSeconds: {{ .Values.readiness.periodSeconds }}
56           env: {{ include "oof.etcd.env" . | nindent 10 }}
57           volumeMounts:
58           - mountPath: /etc/localtime
59             name: localtime
60             readOnly: true
61           - mountPath: /usr/local/bin/conductor.conf
62             name: {{ .Values.global.commonConfigPrefix }}-config
63             subPath: conductor.conf
64           - mountPath: /usr/local/bin/log.conf
65             name: {{ .Values.global.commonConfigPrefix }}-config
66             subPath: log.conf
67           - mountPath: /usr/local/bin/healthy.sh
68             name: {{ .Values.global.commonConfigPrefix }}-config
69             subPath: healthy.sh
70           resources: {{ include "common.resources" . | nindent 12 }}
71         {{- if .Values.nodeSelector }}
72         nodeSelector:
73 {{ toYaml .Values.nodeSelector | indent 10 }}
74         {{- end -}}
75         {{- if .Values.affinity }}
76         affinity:
77 {{ toYaml .Values.affinity | indent 10 }}
78         {{- end }}
79       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
80       volumes:
81         - name: localtime
82           hostPath:
83             path: /etc/localtime
84         - name: {{ .Values.global.commonConfigPrefix }}-config
85           configMap:
86             name: {{ .Values.global.commonConfigPrefix }}-configmap
87             items:
88             - key: conductor.conf
89               path: conductor.conf
90             - key: log.conf
91               path: log.conf
92             - key: healthy.sh
93               path: healthy.sh
94       {{- include "common.imagePullSecrets" . | nindent 6 }}