d6daf3eefeacf581b934bde57eb182f0884428cb
[oom.git] / kubernetes / dmaap / charts / message-router / charts / message-router-kafka / 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       - name: {{ include "common.name" . }}-seed-kafka-topics
36         command:
37         - /bin/bash
38         - -c
39         - >
40           if [ -d /tmp/topics/ECOMP-PORTAL-INBOX-0 ]; then
41           echo "nothing to do";
42           else
43           git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
44           echo "Clone complete. Copying from /tmp/gerrit/oom-projects/data-kafka/kafka-logs/* to /tmp/topics";
45           cp -var /tmp/gerrit/oom-topics/data-kafka/kafka-logs/* /tmp/topics;
46           echo "Done.";
47           fi
48         image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}"
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         volumeMounts:
51         - mountPath: /tmp/topics
52           name: kafka-data
53       - command:
54         - /root/ready.py
55         args:
56         - --container-name
57         - {{ .Values.zookeeper.name }}
58         env:
59         - name: NAMESPACE
60           valueFrom:
61             fieldRef:
62               apiVersion: v1
63               fieldPath: metadata.namespace
64         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
65         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66         name: {{ include "common.name" . }}-readiness
67       containers:
68       - name: {{ include "common.name" .  }}
69         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
70         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71         resources:
72 {{ include "common.resources" . | indent 12 }}
73         ports:
74         - containerPort: {{ .Values.service.internalPort }}
75         {{ if eq .Values.liveness.enabled true }}
76         livenessProbe:
77           tcpSocket:
78             port: {{ .Values.service.internalPort }}
79           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
80           periodSeconds: {{ .Values.liveness.periodSeconds }}
81         {{ end }}
82         readinessProbe:
83           tcpSocket:
84             port: {{ .Values.service.internalPort }}
85           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
86           periodSeconds: {{ .Values.readiness.periodSeconds }}
87         env:
88         - name: KAFKA_ZOOKEEPER_CONNECT
89           value: "{{.Values.zookeeper.name}}:{{.Values.zookeeper.port}}"
90         - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
91           value: "INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT"
92         - name: KAFKA_ADVERTISED_LISTENERS
93           value: "INTERNAL_PLAINTEXT://{{ include "common.servicename" .  }}:{{.Values.service.internalPort}}"
94         - name: KAFKA_LISTENERS
95           value: "INTERNAL_PLAINTEXT://0.0.0.0:{{.Values.service.internalPort}}"
96         - name: KAFKA_INTER_BROKER_LISTENER_NAME
97           value: "INTERNAL_PLAINTEXT"
98         volumeMounts:
99         - mountPath: /etc/localtime
100           name: localtime
101           readOnly: true
102         - mountPath: /var/run/docker.sock
103           name: docker-socket
104         - mountPath: /kafka
105           name: kafka-data
106       volumes:
107       - name: localtime
108         hostPath:
109           path: /etc/localtime
110       - name: docker-socket
111         hostPath:
112           path: /var/run/docker.sock
113       - name: kafka-data
114         persistentVolumeClaim:
115           claimName: {{ include "common.fullname" . }}
116       imagePullSecrets:
117       - name: "{{ include "common.namespace" . }}-docker-registry-key"