vaibhavjayas | 5ca5465 | 2018-07-31 09:23:16 +0000 | [diff] [blame] | 1 | # Copyright © 2018 Amdocs, Bell Canada |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 15 | apiVersion: apps/v1beta1 |
| 16 | kind: StatefulSet |
| 17 | metadata: |
| 18 | name: {{ include "common.fullname" . }} |
| 19 | namespace: {{ include "common.namespace" . }} |
| 20 | labels: |
| 21 | app: {{ include "common.fullname" . }} |
| 22 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 23 | release: "{{ .Release.Name }}" |
| 24 | heritage: "{{ .Release.Service }}" |
| 25 | spec: |
| 26 | # serviceName: {{ include "common.fullname" . }} |
| 27 | serviceName: {{ .Values.service.name }} |
| 28 | replicas: {{ .Values.replicaCount }} |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
| 32 | app: {{ include "common.fullname" . }} |
Hector Anapan-Lavalle | 3d8a6a1 | 2018-08-07 21:31:05 -0400 | [diff] [blame] | 33 | release: {{ .Release.Name }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 34 | annotations: |
| 35 | pod.alpha.kubernetes.io/initialized: "true" |
| 36 | spec: |
| 37 | {{- if .Values.nodeSelector }} |
| 38 | nodeSelector: |
| 39 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 40 | {{- end }} |
| 41 | volumes: |
| 42 | {{- if .Values.externalConfig }} |
| 43 | - name: config |
| 44 | configMap: |
| 45 | name: {{ include "common.fullname" . }}-externalconfig |
| 46 | {{- end}} |
| 47 | - name: localtime |
| 48 | hostPath: |
| 49 | path: /etc/localtime |
| 50 | imagePullSecrets: |
| 51 | - name: {{ include "common.namespace" . }}-docker-registry-key |
| 52 | containers: |
| 53 | - name: {{ include "common.fullname" . }} |
| 54 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 55 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}} |
| 56 | env: |
| 57 | - name: POD_NAMESPACE |
| 58 | valueFrom: |
| 59 | fieldRef: |
| 60 | apiVersion: v1 |
| 61 | fieldPath: metadata.namespace |
| 62 | - name: MYSQL_USER |
| 63 | value: {{ default "" .Values.config.userName | quote }} |
| 64 | - name: MYSQL_PASSWORD |
| 65 | valueFrom: |
| 66 | secretKeyRef: |
| 67 | name: {{ template "common.fullname" . }} |
| 68 | key: user-password |
| 69 | - name: MYSQL_DATABASE |
| 70 | value: {{ default "" .Values.config.mysqlDatabase | quote }} |
| 71 | - name: MYSQL_ROOT_PASSWORD |
| 72 | valueFrom: |
| 73 | secretKeyRef: |
| 74 | name: {{ template "common.fullname" . }} |
| 75 | key: db-root-password |
| 76 | ports: |
| 77 | - containerPort: {{ .Values.service.internalPort }} |
| 78 | name: {{ .Values.service.name }} |
| 79 | - containerPort: {{ .Values.service.sstPort }} |
| 80 | name: {{ .Values.service.sstName }} |
| 81 | - containerPort: {{ .Values.service.replicationPort }} |
| 82 | name: {{ .Values.service.replicationName }} |
| 83 | - containerPort: {{ .Values.service.istPort }} |
| 84 | name: {{ .Values.service.istName }} |
| 85 | readinessProbe: |
| 86 | exec: |
| 87 | command: |
| 88 | - /usr/share/container-scripts/mysql/readiness-probe.sh |
| 89 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 90 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 91 | {{- if eq .Values.liveness.enabled true }} |
| 92 | livenessProbe: |
| 93 | exec: |
| 94 | command: ["mysqladmin", "ping"] |
| 95 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 96 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 97 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
| 98 | {{- end }} |
| 99 | resources: |
| 100 | {{ toYaml .Values.resources | indent 12 }} |
| 101 | volumeMounts: |
| 102 | {{- if .Values.externalConfig }} |
| 103 | - mountPath: /etc/config |
| 104 | name: config |
| 105 | {{- end}} |
| 106 | - mountPath: /etc/localtime |
| 107 | name: localtime |
| 108 | readOnly: true |
| 109 | {{- if .Values.persistence.enabled }} |
| 110 | - mountPath: /var/lib/mysql |
| 111 | name: {{ include "common.fullname" . }}-data |
| 112 | subPath: data |
| 113 | initContainers: |
| 114 | - name: mariadb-galera-prepare |
| 115 | image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}" |
| 116 | command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"] |
| 117 | volumeMounts: |
| 118 | - name: {{ include "common.fullname" . }}-data |
| 119 | mountPath: /var/lib/mysql |
| 120 | volumeClaimTemplates: |
| 121 | - metadata: |
| 122 | name: {{ include "common.fullname" . }}-data |
| 123 | annotations: |
| 124 | {{- if .Values.persistence.storageClass }} |
| 125 | volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} |
| 126 | {{- else }} |
| 127 | volume.alpha.kubernetes.io/storage-class: default |
| 128 | {{- end }} |
| 129 | spec: |
| 130 | accessModes: |
| 131 | - {{ .Values.persistence.accessMode | quote }} |
| 132 | resources: |
| 133 | requests: |
| 134 | storage: {{ .Values.persistence.size | quote }} |
| 135 | {{- end }} |