blob: d5fa6340d3322ab1ac798a5b5578b556e862ee85 [file] [log] [blame]
BorislavG3c751b32018-03-26 21:13:34 +03001{{/*
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*/}}
16apiVersion: apps/v1beta1
17kind: StatefulSet
18metadata:
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 }}
26spec:
27 serviceName: {{ .Values.service.name }}
28 replicas: {{ .Values.replicaCount }}
29 template:
30 metadata:
31 labels:
32 app: {{ include "common.name" . }}
33 release: {{ .Release.Name }}
34 spec:
35 initContainers:
36 containers:
37 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000038 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
BorislavG3c751b32018-03-26 21:13:34 +030039 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40 command:
41 - /bin/sh
42 - -c
43 - |
Lusheng Jia994d452018-04-26 16:37:17 -040044 /opt/scripts/redis-cluster-config.sh
BorislavG3c751b32018-03-26 21:13:34 +030045 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:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000080{{ include "common.resources" . | indent 12 }}
BorislavG3c751b32018-03-26 21:13:34 +030081 {{- 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
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +010099 defaultMode: 0755
BorislavG3c751b32018-03-26 21:13:34 +0300100 - name: localtime
101 hostPath:
102 path: /etc/localtime
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +0100103 {{- if not .Values.persistence.enabled }}
104 - name: {{ include "common.fullname" . }}-data
105 emptyDir: {}
106 {{- end }}
BorislavG3c751b32018-03-26 21:13:34 +0300107 imagePullSecrets:
108 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +0100109 {{- if .Values.persistence.enabled }}
BorislavG3c751b32018-03-26 21:13:34 +0300110 volumeClaimTemplates:
111 - metadata:
112 name: {{ include "common.fullname" . }}-data
113 labels:
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +0100114 name: {{ include "common.fullname" . }}
BorislavG3c751b32018-03-26 21:13:34 +0300115 spec:
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +0100116 accessModes:
117 - {{ .Values.persistence.accessMode | quote }}
118 storageClassName: {{ include "common.storageClass" . }}
BorislavG3c751b32018-03-26 21:13:34 +0300119 resources:
120 requests:
Sylvain Desbureaux03c36f92019-11-29 15:22:29 +0100121 storage: {{ .Values.persistence.size | quote}}
122 {{- end }}