2bc9e796c9508367ceba58132146a7aa7aadc0dd
[oom.git] / kubernetes / pomba / charts / pomba-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 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - command:
35         - /root/ready.py
36         args:
37         - --container-name
38         - pomba-elasticsearch
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         name: {{ include "common.name" . }}-readiness
48       - args:
49         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
50         - --input=/config/default-mapping.json
51         - --type=mapping
52         env:
53         - name: NAMESPACE
54           valueFrom:
55             fieldRef:
56               apiVersion: v1
57               fieldPath: metadata.namespace
58         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         name: {{ include "common.name" . }}-config-map
61         volumeMounts:
62           - mountPath: /config/default-mapping.json
63             name: {{ include "common.fullname" . }}
64             subPath: default-mapping.json
65       - args:
66         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
67         - --input=/config/default.json
68         - --type=data
69         env:
70         - name: NAMESPACE
71           valueFrom:
72             fieldRef:
73               apiVersion: v1
74               fieldPath: metadata.namespace
75         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
76         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77         name: {{ include "common.name" . }}-config
78         volumeMounts:
79           - mountPath: /config/default.json
80             name: {{ include "common.fullname" . }}
81             subPath: default.json
82       - args:
83         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/service-validations
84         - --input=/config/validationsDump.json
85         - --type=mapping
86         env:
87         - name: NAMESPACE
88           valueFrom:
89             fieldRef:
90               apiVersion: v1
91               fieldPath: metadata.namespace
92         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
93         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94         name: {{ include "common.name" . }}-config-validation
95         volumeMounts:
96           - mountPath: /config/validationsDump.json
97             name: {{ include "common.fullname" . }}
98             subPath: validationsDump.json
99       - args:
100         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/service-violations
101         - --input=/config/violationsDump.json
102         - --type=mapping
103         env:
104         - name: NAMESPACE
105           valueFrom:
106             fieldRef:
107               apiVersion: v1
108               fieldPath: metadata.namespace
109         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
110         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111         name: {{ include "common.name" . }}-config-violation
112         volumeMounts:
113           - mountPath: /config/violationsDump.json
114             name: {{ include "common.fullname" . }}
115             subPath: violationsDump.json            
116       containers:
117         - name: {{ include "common.name" . }}
118           image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.image }}"
119           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
120           command: ["/bin/bash"]
121           args: ["-c", "/opt/app/bin/kibana_start.sh"]
122           ports:
123           - containerPort: {{ .Values.service.internalPort }}
124             name: {{ .Values.service.name }}
125           readinessProbe:
126             httpGet:
127               path: "/"
128               scheme: "HTTPS"
129               port: {{ .Values.service.internalPort }}
130             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
131             periodSeconds: {{ .Values.readiness.periodSeconds }}
132             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
133 # disable liveness probe when breakpoints set in debugger
134           # so K8s doesn't restart unresponsive container
135           {{- if eq .Values.liveness.enabled true }}
136           livenessProbe:
137             httpGet:
138               path: "/"
139               scheme: "HTTPS"
140               port: {{ .Values.service.internalPort }}
141             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
142             periodSeconds: {{ .Values.liveness.periodSeconds }}
143             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
144           {{ end -}}
145           env:
146           volumeMounts:
147           - mountPath: /etc/localtime
148             name: localtime
149             readOnly: true
150           - mountPath: /usr/share/kibana/config
151             name: {{ include "common.fullname" . }}
152           - mountPath: /opt/app/auth
153             name: {{ include "common.fullname" . }}-auth
154           - mountPath: /opt/app/bin
155             name: {{ include "common.fullname" . }}-bin
156           resources:
157 {{ include "common.resources" . | indent 12 }}
158         {{- if .Values.nodeSelector }}
159         nodeSelector:
160 {{ toYaml .Values.nodeSelector | indent 10 }}
161         {{- end -}}
162         {{- if .Values.affinity }}
163         affinity:
164 {{ toYaml .Values.affinity | indent 10 }}
165         {{- end }}
166       volumes:
167         - name: localtime
168           hostPath:
169             path: /etc/localtime
170         - name: {{ include "common.fullname" . }}
171           configMap:
172             name: {{ include "common.fullname" . }}
173             items:
174             - key: kibana.yml
175               path: kibana.yml
176             - key: default.json
177               path: default.json
178             - key: validationsDump.json
179               path: validationsDump.json
180             - key: violationsDump.json
181               path: violationsDump.json
182             - key: default-mapping.json
183               path: default-mapping.json
184         - name: {{ include "common.fullname" . }}-auth
185           configMap:
186             name: {{ include "common.fullname" . }}-auth
187             defaultMode: 0777
188         - name: {{ include "common.fullname" . }}-bin
189           configMap:
190             name: {{ include "common.fullname" . }}-bin
191             defaultMode: 0777
192       imagePullSecrets:
193       - name: "{{ include "common.namespace" . }}-docker-registry-key"