BorislavG | 3c751b3 | 2018-03-26 21:13:34 +0300 | [diff] [blame] | 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: {{ .Release.Name }} |
| 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: {{ .Release.Name }} |
| 34 | spec: |
| 35 | initContainers: |
| 36 | containers: |
| 37 | - name: {{ include "common.name" . }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 38 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
BorislavG | 3c751b3 | 2018-03-26 21:13:34 +0300 | [diff] [blame] | 39 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 40 | command: |
| 41 | - /bin/sh |
| 42 | - -c |
| 43 | - | |
Lusheng Ji | a994d45 | 2018-04-26 16:37:17 -0400 | [diff] [blame] | 44 | /opt/scripts/redis-cluster-config.sh |
BorislavG | 3c751b3 | 2018-03-26 21:13:34 +0300 | [diff] [blame] | 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 | {{ toYaml .Values.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 | 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 }} |