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" . }} |
| 38 | image: "{{ .Values.repository | default .Values.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 | /usr/local/bin/redis-server-config.sh |
| 46 | ports: |
| 47 | - containerPort: {{ .Values.service.internalPort }} |
| 48 | name: {{ .Values.service.name }} |
| 49 | - containerPort: {{ .Values.service.internalPort2 }} |
| 50 | name: {{ .Values.service.name2 }} |
| 51 | # disable liveness probe when breakpoints set in debugger |
| 52 | # so K8s doesn't restart unresponsive container |
| 53 | {{- if eq .Values.liveness.enabled true }} |
| 54 | livenessProbe: |
| 55 | exec: |
| 56 | command: |
| 57 | - sh |
| 58 | - -c |
| 59 | - "redis-cli -h $(hostname) ping" |
| 60 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 61 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 62 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
| 63 | {{end -}} |
| 64 | readinessProbe: |
| 65 | tcpSocket: |
| 66 | port: {{ .Values.service.internalPort }} |
| 67 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 68 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 69 | env: |
| 70 | volumeMounts: |
| 71 | - mountPath: /etc/localtime |
| 72 | name: localtime |
| 73 | readOnly: true |
| 74 | - mountPath: /conf |
| 75 | name: {{ include "common.fullname" . }}-config |
| 76 | - mountPath: /data |
| 77 | name: {{ include "common.fullname" . }}-data |
| 78 | - mountPath: /opt/scripts |
| 79 | name: {{ include "common.fullname" . }}-scripts |
| 80 | resources: |
| 81 | {{ toYaml .Values.resources | indent 12 }} |
| 82 | {{- if .Values.nodeSelector }} |
| 83 | nodeSelector: |
| 84 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 85 | {{- end -}} |
| 86 | {{- if .Values.affinity }} |
| 87 | affinity: |
| 88 | {{ toYaml .Values.affinity | indent 10 }} |
| 89 | {{- end }} |
| 90 | volumes: |
| 91 | - name: {{ include "common.fullname" . }}-config |
| 92 | configMap: |
| 93 | name: {{ include "common.fullname" . }} |
| 94 | items: |
| 95 | - key: redis.conf |
| 96 | path: redis.conf |
| 97 | - name: {{ include "common.fullname" . }}-scripts |
| 98 | configMap: |
| 99 | name: {{ include "common.fullname" . }}-scripts |
| 100 | defaultMode: 0755 |
| 101 | - name: localtime |
| 102 | hostPath: |
| 103 | path: /etc/localtime |
| 104 | imagePullSecrets: |
| 105 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 106 | volumeClaimTemplates: |
| 107 | - metadata: |
| 108 | name: {{ include "common.fullname" . }}-data |
| 109 | labels: |
| 110 | name: {{ include "common.fullname" . }} |
| 111 | spec: |
| 112 | accessModes: [ {{ .Values.persistence.accessMode }} ] |
| 113 | storageClassName: manual |
| 114 | resources: |
| 115 | requests: |
| 116 | storage: {{ .Values.persistence.size }} |