Merge "clamphealth check"
[oom.git] / kubernetes / clamp / charts / clamp-dash-kibana / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 # Modifications copyright (c) 2018 AT&T Intellectual Property
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         - clamp-dash-es
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       - args:
51         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
52         - --input=/config/default.json
53         - --type=data
54         env:
55         - name: NAMESPACE
56           valueFrom:
57             fieldRef:
58               apiVersion: v1
59               fieldPath: metadata.namespace
60         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
61         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62         name: {{ include "common.name" . }}-config
63         volumeMounts:
64           - mountPath: /config/default.json
65             name: {{ include "common.fullname" . }}
66             subPath: default.json
67       containers:
68         - name: {{ include "common.name" . }}
69           image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.image }}"
70           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71           ports:
72           - containerPort: {{ .Values.service.internalPort }}
73             name: {{ include "common.servicename" . }}
74           readinessProbe:
75             tcpSocket:
76               port: {{ .Values.service.internalPort }}
77             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.readiness.periodSeconds }}
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             tcpSocket:
84               port: {{ .Values.service.internalPort }}
85             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86             periodSeconds: {{ .Values.liveness.periodSeconds }}
87           {{ end -}}
88           env:
89           volumeMounts:
90           - mountPath: /etc/localtime
91             name: localtime
92             readOnly: true
93           - mountPath: /usr/share/kibana/config/kibana.yml
94             name: {{ include "common.fullname" . }}
95             subPath: kibana.yml
96           resources:
97 {{ toYaml .Values.resources | indent 12 }}
98         {{- if .Values.nodeSelector }}
99         nodeSelector:
100 {{ toYaml .Values.nodeSelector | indent 10 }}
101         {{- end -}}
102         {{- if .Values.affinity }}
103         affinity:
104 {{ toYaml .Values.affinity | indent 10 }}
105         {{- end }}
106       volumes:
107         - name: localtime
108           hostPath:
109             path: /etc/localtime
110         - name: {{ include "common.fullname" . }}
111           configMap:
112             name: {{ include "common.fullname" . }}
113             items:
114             - key: kibana.yml
115               path: kibana.yml
116             - key: default.json
117               path: default.json
118
119       imagePullSecrets:
120       - name: "{{ include "common.namespace" . }}-docker-registry-key"