[DCAEMOD] Uses new tpls for repos / images
[oom.git] / kubernetes / pomba / charts / pomba-kibana / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
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: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       initContainers:
36       - command:
37         - /app/ready.py
38         args:
39         - --container-name
40         - pomba-elasticsearch
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ include "common.repository" . }}/{{ .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-mapping.json
53         - --type=mapping
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-map
63         volumeMounts:
64           - mountPath: /config/default-mapping.json
65             name: {{ include "common.fullname" . }}
66             subPath: default-mapping.json
67       - args:
68         - --output=http://{{.Values.config.elasticsearchServiceName}}.{{ include "common.namespace" . }}:{{.Values.config.elasticsearchPort}}/.kibana
69         - --input=/config/default.json
70         - --type=data
71         env:
72         - name: NAMESPACE
73           valueFrom:
74             fieldRef:
75               apiVersion: v1
76               fieldPath: metadata.namespace
77         image: "{{ .Values.configRepository }}/{{ .Values.configImage }}"
78         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
79         name: {{ include "common.name" . }}-config
80         volumeMounts:
81           - mountPath: /config/default.json
82             name: {{ include "common.fullname" . }}
83             subPath: default.json
84       containers:
85         - name: {{ include "common.name" . }}
86           image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.image }}"
87           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88           command: ["/bin/bash"]
89           args: ["-c", "/opt/app/bin/kibana_start.sh"]
90           ports:
91           - containerPort: {{ .Values.service.internalPort }}
92             name: {{ .Values.service.name }}
93           readinessProbe:
94             httpGet:
95               path: "/"
96               scheme: "HTTPS"
97               port: {{ .Values.service.internalPort }}
98             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.readiness.periodSeconds }}
100             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
101 # disable liveness probe when breakpoints set in debugger
102           # so K8s doesn't restart unresponsive container
103           {{- if eq .Values.liveness.enabled true }}
104           livenessProbe:
105             httpGet:
106               path: "/"
107               scheme: "HTTPS"
108               port: {{ .Values.service.internalPort }}
109             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
110             periodSeconds: {{ .Values.liveness.periodSeconds }}
111             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
112           {{ end -}}
113           env:
114           volumeMounts:
115           - mountPath: /etc/localtime
116             name: localtime
117             readOnly: true
118           - mountPath: /usr/share/kibana/config
119             name: {{ include "common.fullname" . }}
120           - mountPath: /opt/app/auth
121             name: {{ include "common.fullname" . }}-auth
122           - mountPath: /opt/app/bin
123             name: {{ include "common.fullname" . }}-bin
124           resources:
125 {{ include "common.resources" . | indent 12 }}
126         {{- if .Values.nodeSelector }}
127         nodeSelector:
128 {{ toYaml .Values.nodeSelector | indent 10 }}
129         {{- end -}}
130         {{- if .Values.affinity }}
131         affinity:
132 {{ toYaml .Values.affinity | indent 10 }}
133         {{- end }}
134       volumes:
135         - name: localtime
136           hostPath:
137             path: /etc/localtime
138         - name: {{ include "common.fullname" . }}
139           configMap:
140             name: {{ include "common.fullname" . }}
141             items:
142             - key: kibana.yml
143               path: kibana.yml
144             - key: default.json
145               path: default.json
146             - key: default-mapping.json
147               path: default-mapping.json
148         - name: {{ include "common.fullname" . }}-auth
149           configMap:
150             name: {{ include "common.fullname" . }}-auth
151             defaultMode: 0777
152         - name: {{ include "common.fullname" . }}-bin
153           configMap:
154             name: {{ include "common.fullname" . }}-bin
155             defaultMode: 0777
156       imagePullSecrets:
157       - name: "{{ include "common.namespace" . }}-docker-registry-key"