Merge "bump the SO version to 1.5.3"
[oom.git] / kubernetes / dmaap / components / message-router / charts / message-router-zookeeper / templates / statefulset.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: apps/v1beta1
17 kind: StatefulSet
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   serviceName: {{ .Values.service.name }}
28   replicas: {{ .Values.replicaCount }}
29   updateStrategy:
30     type: RollingUpdate
31     rollingUpdate:
32       maxUnavailable: {{ .Values.maxUnavailable }}
33   podManagementPolicy: Parallel
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ .Release.Name }}
39     spec:
40       podAntiAffinity:
41          preferredDuringSchedulingIgnoredDuringExecution:
42          - weight: 1
43            podAffinityTerm:
44              labelSelector:
45                 matchExpressions:
46                   - key: "app"
47                     operator: In
48                     values:
49                     - {{ include "common.name" . }}
50              topologyKey: "kubernetes.io/hostname"
51       {{- if .Values.nodeAffinity }}
52       nodeAffinity:
53         {{ toYaml .Values.nodeAffinity | indent 10 }}
54       {{- end }}
55       initContainers:
56       - name: {{ include "common.name" . }}-permission-fixer
57         command:
58         - sh
59         - -exec
60         - >
61           chown -R 1000:1000 /tmp/zookeeper/apikeys;
62         image: "{{ .Values.busyBoxRepository }}/{{ .Values.busyBoxImage }}"
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         volumeMounts:
65         - mountPath: /tmp/zookeeper/apikeys
66           name: zookeeper-data
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.clientPort }}
75           name: {{ .Values.service.clientPortName }}
76         - containerPort: {{ .Values.service.serverPort }}
77           name: {{ .Values.service.serverPortName }}
78         - containerPort: {{ .Values.service.leaderElectionPort }}
79           name: {{ .Values.service.leaderElectionPortName }}
80         {{ if eq .Values.liveness.enabled true }}
81         livenessProbe:
82           exec:
83             command:
84             - sh
85             - -c
86             - "zookeeper-ready.sh 2181"
87           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
88           periodSeconds: {{ .Values.liveness.periodSeconds }}
89           timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
90         {{ end }}
91         readinessProbe:
92           exec:
93             command:
94             - sh
95             - -c
96             - "zookeeper-ready.sh 2181"
97           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
98           periodSeconds: {{ .Values.readiness.periodSeconds }}
99           timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
100         env:
101         - name: ZK_REPLICAS
102           value: "{{ .Values.replicaCount }}"
103         - name: ZK_INIT_LIMIT
104           value: "{{ .Values.zk.initLimit }}"
105         - name: ZK_SYNC_LIMIT
106           value: "{{ .Values.zk.syncLimit }}"
107         volumeMounts:
108         - mountPath: /etc/localtime
109           name: localtime
110           readOnly: true
111         - mountPath: /var/lib/zookeeper/data
112           name: zookeeper-data
113       {{- if .Values.tolerations }}
114       tolerations:
115         {{ toYaml .Values.tolerations | indent 10 }}
116       {{- end }}
117       volumes:
118       - name: localtime
119         hostPath:
120           path: /etc/localtime
121 {{ if not .Values.persistence.enabled }}
122       - name: zookeeper-data
123         emptyDir: {}
124 {{ else }}
125   volumeClaimTemplates:
126     - metadata:
127         name:  zookeeper-data
128         labels:
129           app:  {{ include "common.fullname" . }}
130           chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
131           release: "{{ .Release.Name }}"
132           heritage: "{{ .Release.Service }}"
133       spec:
134         accessModes:
135           - {{ .Values.persistence.accessMode | quote }}
136         resources:
137           requests:
138             storage: {{ .Values.persistence.size | quote }}
139         selector:
140           matchLabels:
141             release: "{{ .Release.Name }}"
142             app: {{ .Values.service.name }}
143             chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
144             heritage: "{{ .Release.Service }}"
145 {{ end }}
146       imagePullSecrets:
147       - name: "{{ include "common.namespace" . }}-docker-registry-key"
148
149