Merge "Drop the submodule nexus-repository-helm"
[it/dep.git] / ric-aux / 80-Auxiliary-Functions / helm / message-router / charts / message-router-zookeeper / templates / statefulset.yaml
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #   Copyright (c) 2019 Nokia.                                                  #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17
18
19 apiVersion: apps/v1beta1
20 kind: StatefulSet
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ .Release.Name }}
28     heritage: {{ .Release.Service }}
29 spec:
30   serviceName: {{ .Values.service.name }}
31   replicas: {{ .Values.replicaCount }}
32   updateStrategy:
33     type: RollingUpdate
34     rollingUpdate:
35       maxUnavailable: {{ .Values.maxUnavailable }}
36   podManagementPolicy: Parallel
37   template:
38     metadata:
39       labels:
40         app: {{ include "common.name" . }}
41         release: {{ .Release.Name }}
42     spec:
43       podAntiAffinity:
44          preferredDuringSchedulingIgnoredDuringExecution:
45          - weight: 1
46            podAffinityTerm:
47              labelSelector:
48                 matchExpressions:
49                   - key: "app"
50                     operator: In
51                     values:
52                     - {{ include "common.name" . }}
53              topologyKey: "kubernetes.io/hostname"
54       {{- if .Values.nodeAffinity }}
55       nodeAffinity:
56         {{ toYaml .Values.nodeAffinity | indent 10 }}
57       {{- end }}
58       initContainers:
59       - name: {{ include "common.name" . }}-permission-fixer
60         command:
61         - sh
62         - -exec
63         - >
64           chown -R 1000:1000 /tmp/zookeeper/apikeys;
65         image: "{{ .Values.busyBoxRepository }}/{{ .Values.busyBoxImage }}"
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         volumeMounts:
68         - mountPath: /tmp/zookeeper/apikeys
69           name: zookeeper-data
70       containers:
71       - name: {{ include "common.name" . }}
72         image: "{{ .Values.onapRepository }}/{{ .Values.image }}"
73         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         resources:
75 {{ include "common.resources" . | indent 12 }}
76         ports:
77         - containerPort: {{ .Values.service.clientPort }}
78           name: {{ .Values.service.clientPortName }}
79         - containerPort: {{ .Values.service.serverPort }}
80           name: {{ .Values.service.serverPortName }}
81         - containerPort: {{ .Values.service.leaderElectionPort }}
82           name: {{ .Values.service.leaderElectionPortName }}
83         {{ if eq .Values.liveness.enabled true }}
84         livenessProbe:
85           exec:
86             command:
87             - sh
88             - -c
89             - "zookeeper-ready.sh 2181"
90           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
91           periodSeconds: {{ .Values.liveness.periodSeconds }}
92         {{ end }}
93         readinessProbe:
94           exec:
95             command:
96             - sh
97             - -c
98             - "zookeeper-ready.sh 2181"
99           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
100           periodSeconds: {{ .Values.readiness.periodSeconds }}
101         env:
102         - name: ZK_REPLICAS
103           value: "{{ .Values.replicaCount }}"
104         - name: ZK_INIT_LIMIT
105           value: "{{ .Values.zk.initLimit }}"
106         - name: ZK_SYNC_LIMIT
107           value: "{{ .Values.zk.syncLimit }}"
108         volumeMounts:
109         - mountPath: /etc/localtime
110           name: localtime
111           readOnly: true
112         - mountPath: /var/lib/zookeeper/data
113           name: zookeeper-data
114       {{- if .Values.tolerations }}
115       tolerations:
116         {{ toYaml .Values.tolerations | indent 10 }}
117       {{- end }}
118       volumes:
119       - name: localtime
120         hostPath:
121           path: /etc/localtime
122 {{ if not .Values.persistence.enabled }}
123       - name: zookeeper-data
124         emptyDir: {}
125 {{ else }}
126   volumeClaimTemplates:
127     - metadata:
128         name:  zookeeper-data
129         labels:
130           app:  {{ include "common.fullname" . }}
131           chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
132           release: "{{ .Release.Name }}"
133           heritage: "{{ .Release.Service }}"
134       spec:
135         accessModes:
136           - {{ .Values.persistence.accessMode | quote }}
137         resources:
138           requests:
139             storage: {{ .Values.persistence.size | quote }}
140         selector:
141           matchLabels:
142             release: "{{ .Release.Name }}"
143             app: {{ .Values.service.name }}
144             chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
145             heritage: "{{ .Release.Service }}"
146 {{ end }}
147       imagePullSecrets:
148       - name: "{{ include "common.namespace" . }}-docker-registry-key"
149
150