[SDNC] Set STDOUT Log level
[oom.git] / kubernetes / dcaegen2 / components / dcae-redis / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, AT&T, Bell Canada
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: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   serviceName: {{ .Values.service.name }}
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       initContainers:
36       containers:
37         - name: {{ include "common.name" . }}
38           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           command:
41           - /bin/sh
42           - -c
43           - |
44             /opt/scripts/redis-cluster-config.sh
45           ports:
46           - containerPort: {{ .Values.service.internalPort }}
47             name: {{ .Values.service.name }}
48           - containerPort: {{ .Values.service.internalPort2 }}
49             name: {{ .Values.service.name2 }}
50           # disable liveness probe when breakpoints set in debugger
51           # so K8s doesn't restart unresponsive container
52           {{- if eq .Values.liveness.enabled true }}
53           livenessProbe:
54             exec:
55               command:
56               - sh
57               - -c
58               - "redis-cli -h $(hostname) ping"
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
62           {{end -}}
63           readinessProbe:
64             tcpSocket:
65               port: {{ .Values.service.internalPort }}
66             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
67             periodSeconds: {{ .Values.readiness.periodSeconds }}
68           env:
69           volumeMounts:
70           - mountPath: /etc/localtime
71             name: localtime
72             readOnly: true
73           - mountPath: /conf
74             name: {{ include "common.fullname" . }}-config
75           - mountPath: /data
76             name: {{ include "common.fullname" . }}-data
77           - mountPath: /opt/scripts
78             name: {{ include "common.fullname" . }}-scripts
79           resources:
80 {{ include "common.resources" . | indent 12 }}
81         {{- if .Values.nodeSelector }}
82         nodeSelector:
83 {{ toYaml .Values.nodeSelector | indent 10 }}
84         {{- end -}}
85         {{- if .Values.affinity }}
86         affinity:
87 {{ toYaml .Values.affinity | indent 10 }}
88         {{- end }}
89       volumes:
90       - name: {{ include "common.fullname" . }}-config
91         configMap:
92           name: {{ include "common.fullname" . }}
93           items:
94           - key: redis.conf
95             path: redis.conf
96       - name: {{ include "common.fullname" . }}-scripts
97         configMap:
98           name: {{ include "common.fullname" . }}-scripts
99           defaultMode: 0755
100       - name: localtime
101         hostPath:
102           path: /etc/localtime
103       {{- if not .Values.persistence.enabled }}
104       - name: {{ include "common.fullname" . }}-data
105         emptyDir: {}
106       {{- end }}
107       imagePullSecrets:
108       - name: "{{ include "common.namespace" . }}-docker-registry-key"
109   {{- if .Values.persistence.enabled }}
110   volumeClaimTemplates:
111   - metadata:
112       name: {{ include "common.fullname" . }}-data
113       labels:
114         name: {{ include "common.fullname" . }}
115     spec:
116       accessModes:
117       - {{ .Values.persistence.accessMode | quote }}
118       storageClassName: {{ include "common.storageClass" . }}
119       resources:
120         requests:
121           storage: {{ .Values.persistence.size | quote}}
122   {{- end }}