6c1f7621186ab126c2f87b612189834f8dfa992c
[oom.git] / kubernetes / dmaap / charts / message-router / charts / message-router-zookeeper / 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-zookeeper-topics
36         command:
37         - /bin/bash
38         - -c
39         - >
40           if [ -d /tmp/topics/version-2 ]; 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-zookeeper/* to /tmp/topics";
45           cp -var /tmp/gerrit/oom-topics/data-zookeeper/* /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: zookeeper-data
53       containers:
54       - name: {{ include "common.name" . }}
55         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
56         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57         resources:
58 {{ include "common.resources" . | indent 12 }}
59         ports:
60         - containerPort: {{ .Values.service.internalPort }}
61         {{ if eq .Values.liveness.enabled true }}
62         livenessProbe:
63           tcpSocket:
64             port: {{ .Values.service.internalPort }}
65           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
66           periodSeconds: {{ .Values.liveness.periodSeconds }}
67         {{ end }}
68         readinessProbe:
69           tcpSocket:
70             port: {{ .Values.service.internalPort }}
71           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72           periodSeconds: {{ .Values.readiness.periodSeconds }}
73         volumeMounts:
74         - mountPath: /etc/localtime
75           name: localtime
76           readOnly: true
77         - mountPath: /opt/zookeeper-3.4.9/data
78           name: zookeeper-data
79       volumes:
80       - name: localtime
81         hostPath:
82           path: /etc/localtime
83       - name: zookeeper-data
84         persistentVolumeClaim:
85           claimName: {{ include "common.fullname" .  }}
86       imagePullSecrets:
87       - name: "{{ include "common.namespace" . }}-docker-registry-key"