Add chart for redis cluster
[oom.git] / kubernetes / msb / charts / msb-discovery / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   template:
14     metadata:
15       labels:
16         app: {{ include "common.name" . }}
17         release: {{ .Release.Name }}
18     spec:
19       initContainers:
20       - command:
21         - /root/ready.py
22         args:
23         - --container-name
24         - msb-consul
25         env:
26         - name: NAMESPACE
27           valueFrom:
28             fieldRef:
29               apiVersion: v1
30               fieldPath: metadata.namespace
31         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
32         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
33         name: {{ include "common.name" . }}-readiness
34       containers:
35         - name: {{ include "common.name" . }}
36           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
37           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38           ports:
39           - containerPort: {{ .Values.service.internalPort }}
40           # disable liveness probe when breakpoints set in debugger
41           # so K8s doesn't restart unresponsive container
42           {{- if eq .Values.liveness.enabled true }}
43           livenessProbe:
44             tcpSocket:
45               port: {{ .Values.service.internalPort }}
46             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
47             periodSeconds: {{ .Values.liveness.periodSeconds }}
48           {{ end -}}
49           readinessProbe:
50             tcpSocket:
51               port: {{ .Values.service.internalPort }}
52             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
53             periodSeconds: {{ .Values.readiness.periodSeconds }}
54           env:
55           - name: CONSUL_IP
56             value: {{.Release.Name}}-msb-consul.{{ include "common.namespace" . }}
57           volumeMounts:
58           - mountPath: /etc/localtime
59             name: localtime
60             readOnly: true
61           resources:
62 {{ toYaml .Values.resources | indent 12 }}
63         {{- if .Values.nodeSelector }}
64         nodeSelector:
65 {{ toYaml .Values.nodeSelector | indent 10 }}
66         {{- end -}}
67         {{- if .Values.affinity }}
68         affinity:
69 {{ toYaml .Values.affinity | indent 10 }}
70         {{- end }}
71       volumes:
72         - name: localtime
73           hostPath:
74             path: /etc/localtime
75       imagePullSecrets:
76       - name: "{{ include "common.namespace" . }}-docker-registry-key"