Merge "Add missing resource limits to POMBA pods"
[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       containers:
49       - args:
50         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
51         - --input=/config/default-mapping.json
52         - --type=mapping
53         env:
54         - name: NAMESPACE
55           valueFrom:
56             fieldRef:
57               apiVersion: v1
58               fieldPath: metadata.namespace
59         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61         name: {{ include "common.name" . }}-config-map
62         volumeMounts:
63           - mountPath: /config/default-mapping.json
64             name: {{ include "common.fullname" . }}
65             subPath: default-mapping.json
66       - args:
67         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
68         - --input=/config/default.json
69         - --type=data
70         env:
71         - name: NAMESPACE
72           valueFrom:
73             fieldRef:
74               apiVersion: v1
75               fieldPath: metadata.namespace
76         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78         name: {{ include "common.name" . }}-config
79         volumeMounts:
80           - mountPath: /config/default.json
81             name: {{ include "common.fullname" . }}
82             subPath: default.json
83       - args:
84         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/service-validations
85         - --input=/config/validationsDump.json
86         - --type=mapping
87         env:
88         - name: NAMESPACE
89           valueFrom:
90             fieldRef:
91               apiVersion: v1
92               fieldPath: metadata.namespace
93         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
94         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95         name: {{ include "common.name" . }}-config-validation
96         volumeMounts:
97           - mountPath: /config/validationsDump.json
98             name: {{ include "common.fullname" . }}
99             subPath: validationsDump.json
100       - args:
101         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/service-violations
102         - --input=/config/violationsDump.json
103         - --type=mapping
104         env:
105         - name: NAMESPACE
106           valueFrom:
107             fieldRef:
108               apiVersion: v1
109               fieldPath: metadata.namespace
110         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
111         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
112         name: {{ include "common.name" . }}-config-violation
113         volumeMounts:
114           - mountPath: /config/violationsDump.json
115             name: {{ include "common.fullname" . }}
116             subPath: violationsDump.json            
117       containers:
118         - name: {{ include "common.name" . }}
119           image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.image }}"
120           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121           ports:
122           - containerPort: {{ .Values.service.internalPort }}
123             name: {{ .Values.service.name }}
124           readinessProbe:
125             httpGet:
126               path: "/"
127               port: {{ .Values.service.internalPort }}
128             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
129             periodSeconds: {{ .Values.readiness.periodSeconds }}
130             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
131 # disable liveness probe when breakpoints set in debugger
132           # so K8s doesn't restart unresponsive container
133           {{- if eq .Values.liveness.enabled true }}
134           livenessProbe:
135             httpGet:
136               path: "/"
137               port: {{ .Values.service.internalPort }}
138             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
139             periodSeconds: {{ .Values.liveness.periodSeconds }}
140             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
141           {{ end -}}
142           env:
143           volumeMounts:
144           - mountPath: /etc/localtime
145             name: localtime
146             readOnly: true
147           - mountPath: /usr/share/kibana/config/
148             name: {{ include "common.fullname" . }}
149           resources:
150 {{ include "common.resources" . | indent 12 }}
151         {{- if .Values.nodeSelector }}
152         nodeSelector:
153 {{ toYaml .Values.nodeSelector | indent 10 }}
154         {{- end -}}
155         {{- if .Values.affinity }}
156         affinity:
157 {{ toYaml .Values.affinity | indent 10 }}
158         {{- end }}
159       volumes:
160         - name: localtime
161           hostPath:
162             path: /etc/localtime
163         - name: {{ include "common.fullname" . }}
164           configMap:
165             name: {{ include "common.fullname" . }}
166             items:
167             - key: kibana.yml
168               path: kibana.yml
169             - key: default.json
170               path: default.json                    
171             - key: validationsDump.json
172               path: validationsDump.json
173             - key: violationsDump.json
174               path: violationsDump.json
175             - key: default-mapping.json
176               path: default-mapping.json                                                                                                       
177       imagePullSecrets:
178       - name: "{{ include "common.namespace" . }}-docker-registry-key"