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