5ce7145ddc8e42cd342bb79af797c36541bc0f7a
[oom.git] / kubernetes / clamp / charts / clamp-dash-logstash / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
33     spec:
34       initContainers:
35       - command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - clamp-dash-es
40         env:
41         - name: NAMESPACE
42           valueFrom:
43             fieldRef:
44               apiVersion: v1
45               fieldPath: metadata.namespace
46         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
47         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48         name: {{ include "common.name" . }}-readiness
49       containers:
50         - name: {{ include "common.name" . }}
51           image: "{{ .Values.global.loggingRepository| default .Values.loggingRepository }}/{{ .Values.image }}"
52           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53           env:
54           - name: dmaap_consumer_group
55             value: "{{ .Values.config.dmaapConsumerGroup }}"
56           - name: dmaap_consumer_id
57             value: "{{ .Values.config.dmaapConsumerId }}"
58           - name: event_topic
59             value: "{{ .Values.config.eventTopic }}"
60           - name: notification_topic
61             value: "{{ .Values.config.notificationTopic }}"
62           - name: request_topic
63             value: "{{ .Values.config.requestTopic }}"
64           - name: dmaap_base_url
65             value: {{ .Values.config.dmaapScheme }}://{{ .Values.config.dmaapHost }}.{{ include "common.namespace" . }}:{{ .Values.config.dmaapPort }}
66           - name: elasticsearch_base_url
67             value: "http://{{.Values.config.elasticsearchServiceName}}.{{.Release.Namespace}}.svc.cluster.local:{{.Values.config.elasticsearchPort}}"
68           ports:
69           - containerPort: {{ .Values.service.internalPort }}
70             name: {{ include "common.servicename" . }}
71           readinessProbe:
72             tcpSocket:
73               port: {{ .Values.service.internalPort }}
74             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
75             periodSeconds: {{ .Values.readiness.periodSeconds }}
76 # disable liveness probe when breakpoints set in debugger
77           # so K8s doesn't restart unresponsive container
78           {{- if eq .Values.liveness.enabled true }}
79           livenessProbe:
80             tcpSocket:
81               port: {{ .Values.service.internalPort }}
82             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
83             periodSeconds: {{ .Values.liveness.periodSeconds }}
84           {{ end -}}
85           volumeMounts:
86           - mountPath: /etc/localtime
87             name: localtime
88             readOnly: true
89           - mountPath: /usr/share/logstash/config/logstash.yml
90             name: {{ include "common.fullname" . }}
91             subPath: logstash.yml
92           - mountPath: /usr/share/logstash/pipeline/logstash.conf
93             name: {{ include "common.fullname" . }}
94             subPath: pipeline.conf
95           resources:
96 {{ toYaml .Values.resources | indent 12 }}
97         {{- if .Values.nodeSelector }}
98         nodeSelector:
99 {{ toYaml .Values.nodeSelector | indent 10 }}
100         {{- end -}}
101         {{- if .Values.affinity }}
102         affinity:
103 {{ toYaml .Values.affinity | indent 10 }}
104         {{- end }}
105       volumes:
106         - name: localtime
107           hostPath:
108             path: /etc/localtime
109         - name: {{ include "common.fullname" . }}
110           configMap:
111             name: {{ include "common.fullname" . }}
112             items:
113             - key: logstash.yml
114               path: logstash.yml
115             - key: pipeline.conf
116               path: pipeline.conf
117       imagePullSecrets:
118       - name: "{{ include "common.namespace" . }}-docker-registry-key"