Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 1 | {{/* |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 2 | # Copyright © 2019 AT&T, Amdocs, Bell Canada, Orange |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 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 | |
| 17 | |
milaszki | 3f27964 | 2020-07-07 12:38:11 +0000 | [diff] [blame^] | 18 | apiVersion: apps/v1 |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 19 | kind: StatefulSet |
| 20 | metadata: |
| 21 | name: {{ include "common.fullname" . }} |
| 22 | namespace: {{ include "common.namespace" . }} |
| 23 | labels: |
| 24 | app: {{ include "common.name" . }} |
| 25 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 26 | release: {{ include "common.release" . }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 27 | heritage: {{ .Release.Service }} |
| 28 | spec: |
| 29 | podAntiAffinity: |
| 30 | preferredDuringSchedulingIgnoredDuringExecution: |
| 31 | - weight: 1 |
| 32 | podAffinityTerm: |
| 33 | labelSelector: |
| 34 | matchExpressions: |
| 35 | - key: app |
| 36 | operator: In |
| 37 | values: |
| 38 | - {{ .Chart.Name }} |
| 39 | topologyKey: kubernetes.io/hostname |
| 40 | serviceName: {{ include "common.servicename" . }} |
| 41 | replicas: {{ .Values.replicaCount }} |
milaszki | 3f27964 | 2020-07-07 12:38:11 +0000 | [diff] [blame^] | 42 | selector: |
| 43 | matchLabels: |
| 44 | app: {{ include "common.name" . }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 45 | podManagementPolicy: {{ .Values.podManagementPolicy }} |
| 46 | updateStrategy: |
| 47 | type: {{ .Values.updateStrategy.type }} |
| 48 | template: |
| 49 | metadata: |
| 50 | labels: |
| 51 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 52 | release: {{ include "common.release" . }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 53 | name: {{ include "common.name" . }} |
| 54 | spec: |
| 55 | containers: |
| 56 | - name: {{ include "common.name" . }} |
| 57 | image: "{{ .Values.global.repository }}/{{ .Values.image.image }}" |
| 58 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 59 | ports: |
| 60 | - containerPort: {{ .Values.service.internalPort }} |
| 61 | - containerPort: {{ .Values.service.internalPort2 }} |
| 62 | - containerPort: {{ .Values.service.internalPort3 }} |
| 63 | {{- if eq .Values.liveness.enabled true }} |
| 64 | livenessProbe: |
| 65 | exec: |
| 66 | command: |
| 67 | - /bin/bash |
| 68 | - -c |
| 69 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 70 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 71 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 72 | {{ end -}} |
| 73 | readinessProbe: |
| 74 | exec: |
| 75 | command: |
| 76 | - /bin/bash |
| 77 | - -c |
| 78 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 79 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
Yang Xu | ee3fe4d | 2019-04-12 11:35:17 -0400 | [diff] [blame] | 80 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 81 | lifecycle: |
| 82 | preStop: |
| 83 | exec: |
| 84 | command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
| 85 | env: |
| 86 | {{- $seed_size := default 1 .Values.replicaCount | int -}} |
| 87 | {{- $global := . }} |
| 88 | - name: MAX_HEAP_SIZE |
| 89 | value: {{ .Values.config.heap.max }} |
| 90 | - name: HEAP_NEWSIZE |
| 91 | value: {{ .Values.config.heap.min }} |
| 92 | - name: CASSANDRA_SEEDS |
| 93 | value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }}{{- if (lt ( add 1 $i ) $seed_size ) }},{{- end }}{{- end }}" |
| 94 | - name: JVM_OPTS |
| 95 | value: {{ .Values.config.jvmOpts | quote }} |
| 96 | - name: CASSANDRA_CLUSTER_NAME |
| 97 | value: {{ .Values.config.clusterName | quote }} |
| 98 | - name: CASSANDRA_DC |
| 99 | value: {{ .Values.config.dataCenter | quote }} |
| 100 | - name: CASSANDRA_RACK |
| 101 | value: {{ .Values.config.rackName | quote }} |
| 102 | - name: CASSANDRA_AUTO_BOOTSTRAP |
| 103 | value: {{ .Values.config.autoBootstrap | quote }} |
| 104 | - name: POD_IP |
| 105 | valueFrom: |
| 106 | fieldRef: |
| 107 | fieldPath: status.podIP |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 108 | {{- if .Values.persistence.enabled }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 109 | volumeMounts: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 110 | - name: {{ include "common.fullname" . }}-data |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 111 | mountPath: /var/lib/cassandra |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 112 | {{- end }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 113 | resources: |
Sylvain Desbureaux | 5ad860d | 2019-10-29 18:00:15 +0100 | [diff] [blame] | 114 | {{ include "common.resources" . | indent 12 }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 115 | volumes: |
| 116 | - name: localtime |
| 117 | hostPath: |
| 118 | path: /etc/localtime |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 119 | {{- if .Values.persistence.enabled }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 120 | volumeClaimTemplates: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 121 | - metadata: |
| 122 | name: {{ include "common.fullname" . }}-data |
| 123 | labels: |
| 124 | name: {{ include "common.fullname" . }} |
| 125 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 126 | release: "{{ include "common.release" . }}" |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 127 | heritage: "{{ .Release.Service }}" |
| 128 | spec: |
| 129 | accessModes: |
| 130 | - {{ .Values.persistence.accessMode | quote }} |
| 131 | storageClassName: {{ include "common.storageClass" . }} |
| 132 | resources: |
| 133 | requests: |
| 134 | storage: {{ .Values.persistence.size | quote }} |
| 135 | {{- end }} |
Sylvain Desbureaux | b2f054c | 2018-12-20 11:11:50 +0100 | [diff] [blame] | 136 | imagePullSecrets: |
| 137 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |