blob: 5a5b220e619a9542edc8f3083f36241a70d080ea [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
99 defaultMode: 0755
100 - name: localtime
101 hostPath:
102 path: /etc/localtime
103 imagePullSecrets:
104 - name: "{{ include "common.namespace" . }}-docker-registry-key"
105 volumeClaimTemplates:
106 - metadata:
107 name: {{ include "common.fullname" . }}-data
108 labels:
109 name: {{ include "common.fullname" . }}
110 spec:
111 accessModes: [ {{ .Values.persistence.accessMode }} ]
112 storageClassName: manual
113 resources:
114 requests:
115 storage: {{ .Values.persistence.size }}
Alexis de Talhouët634b4552018-10-28 21:56:33 -0400116 selector:
117 matchLabels:
118 name: {{ include "common.fullname" . }}