Jakub Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 1 | {{/* |
Suresh Charan | e1a70a1 | 2022-01-13 06:56:53 -0500 | [diff] [blame] | 2 | # Copyright © 2022 Amdocs, AT&T, Bell Canada, Bitnami |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [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. |
Jakub Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 15 | */}} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 16 | |
Andreas Geissler | cfd8434 | 2023-08-16 17:18:49 +0200 | [diff] [blame] | 17 | {{- if not .Values.global.cassandra.useOperator }} |
Sylvain Desbureaux | 60c7480 | 2019-12-12 14:35:01 +0100 | [diff] [blame] | 18 | apiVersion: apps/v1 |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 19 | kind: StatefulSet |
Sylvain Desbureaux | 60c7480 | 2019-12-12 14:35:01 +0100 | [diff] [blame] | 20 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 21 | spec: |
Sylvain Desbureaux | 60c7480 | 2019-12-12 14:35:01 +0100 | [diff] [blame] | 22 | selector: {{- include "common.selectors" . | nindent 4 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 23 | serviceName: {{ include "common.servicename" . }} |
| 24 | replicas: {{ .Values.replicaCount }} |
| 25 | podManagementPolicy: {{ .Values.podManagementPolicy }} |
| 26 | updateStrategy: |
| 27 | type: {{ .Values.updateStrategy.type }} |
| 28 | template: |
Sylvain Desbureaux | 60c7480 | 2019-12-12 14:35:01 +0100 | [diff] [blame] | 29 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 30 | spec: |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 31 | hostNetwork: {{ .Values.hostNetwork }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 32 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 33 | containers: |
| 34 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 7743d8b | 2020-11-19 16:45:23 +0100 | [diff] [blame] | 35 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 36 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sylvain Desbureaux | 60c7480 | 2019-12-12 14:35:01 +0100 | [diff] [blame] | 37 | ports: {{ include "common.containerPorts" . | nindent 8 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 38 | volumeMounts: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 39 | - name: {{ include "common.fullname" . }}-data |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 40 | mountPath: /var/lib/cassandra |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 41 | - name: localtime |
| 42 | mountPath: /etc/localtime |
| 43 | readOnly: true |
mahendrr | 8b20f77 | 2019-05-03 06:50:10 +0000 | [diff] [blame] | 44 | - name: cassandra-entrypoint |
| 45 | mountPath: /docker-entrypoint.sh |
| 46 | subPath: docker-entrypoint.sh |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 47 | {{- range $key, $value := .Values.configOverrides }} |
| 48 | - name: cassandra-config-{{ $key | replace "." "-" }} |
| 49 | mountPath: /etc/cassandra/{{ $key }} |
| 50 | subPath: {{ $key }} |
| 51 | {{- end }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 52 | {{- if eq .Values.liveness.enabled true }} |
| 53 | livenessProbe: |
| 54 | exec: |
Sylvain Desbureaux | 7743d8b | 2020-11-19 16:45:23 +0100 | [diff] [blame] | 55 | command: |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 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 }} |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 61 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
| 62 | successThreshold: {{ .Values.liveness.successThreshold }} |
| 63 | failureThreshold: {{ .Values.liveness.failureThreshold }} |
Joey Sullivan | bec0c98 | 2019-06-11 10:53:16 -0400 | [diff] [blame] | 64 | {{ end }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 65 | readinessProbe: |
| 66 | exec: |
| 67 | command: |
| 68 | - /bin/bash |
| 69 | - -c |
| 70 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 71 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 72 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 73 | timeoutSeconds: {{ .Values.readiness.timeoutSeconds }} |
| 74 | successThreshold: {{ .Values.readiness.successThreshold }} |
| 75 | failureThreshold: {{ .Values.readiness.failureThreshold }} |
Sylvain Desbureaux | e7616c3 | 2021-05-05 10:47:58 +0200 | [diff] [blame] | 76 | startupProbe: |
| 77 | exec: |
| 78 | command: |
| 79 | - /bin/bash |
| 80 | - -c |
| 81 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 82 | initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }} |
| 83 | periodSeconds: {{ .Values.startup.periodSeconds }} |
| 84 | timeoutSeconds: {{ .Values.startup.timeoutSeconds }} |
| 85 | successThreshold: {{ .Values.startup.successThreshold }} |
| 86 | failureThreshold: {{ .Values.startup.failureThreshold }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 87 | env: |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 88 | {{- $seed_size := default 1 .Values.replicaCount | int -}} |
| 89 | {{- $global := . }} |
| 90 | - name: CASSANDRA_SEEDS |
| 91 | {{- if .Values.hostNetwork }} |
| 92 | value: {{ required "You must fill \".Values.config.seeds\" with list of Cassandra seeds when hostNetwork is set to true" .Values.config.seeds | quote }} |
| 93 | {{- else }} |
| 94 | value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ template "common.servicename" $global }}.{{ $global.Release.Namespace }}.svc.{{ $global.Values.config.cluster_domain }}{{- if (lt ( add1 $i ) $seed_size ) }},{{- end }}{{- end }}" |
| 95 | {{- end }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 96 | - name: MAX_HEAP_SIZE |
| 97 | value: {{ .Values.config.heap.max }} |
| 98 | - name: HEAP_NEWSIZE |
| 99 | value: {{ .Values.config.heap.min }} |
| 100 | - name: JVM_OPTS |
| 101 | value: {{ .Values.config.jvmOpts | quote }} |
| 102 | - name: CASSANDRA_CLUSTER_NAME |
| 103 | value: {{ .Values.config.clusterName | quote }} |
| 104 | - name: CASSANDRA_DC |
| 105 | value: {{ .Values.config.dataCenter | quote }} |
| 106 | - name: CASSANDRA_RACK |
| 107 | value: {{ .Values.config.rackName | quote }} |
| 108 | - name: CASSANDRA_AUTO_BOOTSTRAP |
| 109 | value: {{ .Values.config.autoBootstrap | quote }} |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 110 | - name: CASSANDRA_START_RPC |
| 111 | value: {{ default "true" .Values.config.start_rpc | quote }} |
| 112 | - name: CASSANDRA_ENDPOINT_SNITCH |
Mahendra Raghuwanshi | a9a4f31 | 2019-03-19 06:05:47 +0000 | [diff] [blame] | 113 | value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }} |
mahendrr | 8b20f77 | 2019-05-03 06:50:10 +0000 | [diff] [blame] | 114 | - name: CASSANDRA_AUTHENTICATOR |
| 115 | value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 116 | - name: POD_IP |
| 117 | valueFrom: |
| 118 | fieldRef: |
| 119 | fieldPath: status.podIP |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 120 | lifecycle: |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 121 | preStop: |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 122 | exec: |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 123 | {{- if not .Values.persistence.enabled }} |
| 124 | command: ["/bin/sh", "-c", "exec nodetool decommission"] |
| 125 | {{- else }} |
| 126 | command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
| 127 | {{- end }} |
Sylvain Desbureaux | 77c848a | 2020-09-23 14:21:30 +0200 | [diff] [blame] | 128 | resources: {{ toYaml .Values.resources | nindent 10 }} |
Suresh Charan | e1a70a1 | 2022-01-13 06:56:53 -0500 | [diff] [blame] | 129 | {{- if .Values.metrics.serviceMonitor.enabled }} |
| 130 | - name: {{ include "common.name" . }}-metrics |
| 131 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.metrics.image }} |
| 132 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.metrics.pullPolicy | quote}} |
| 133 | {{- if (.Values.metrics.enabled) }} |
| 134 | ports: |
| 135 | {{- range $index, $metricPort := .Values.metrics.ports }} |
| 136 | - name: {{ $metricPort.name }} |
| 137 | containerPort: {{ $metricPort.port }} |
| 138 | protocol: TCP |
| 139 | {{- end }} |
| 140 | livenessProbe: |
| 141 | httpGet: |
| 142 | path: {{ .Values.metrics.livenessProbe.httpGet.path }} |
| 143 | port: {{ .Values.metrics.livenessProbe.httpGet.port }} |
| 144 | initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }} |
| 145 | periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }} |
| 146 | timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }} |
| 147 | successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }} |
| 148 | failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }} |
| 149 | readinessProbe: |
| 150 | httpGet: |
| 151 | path: {{ .Values.metrics.readinessProbe.httpGet.path }} |
| 152 | port: {{ .Values.metrics.readinessProbe.httpGet.port }} |
| 153 | initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }} |
| 154 | periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }} |
| 155 | timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }} |
| 156 | successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }} |
| 157 | failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }} |
| 158 | {{- end }} |
| 159 | {{ include "common.containerSecurityContext" . | indent 10 | trim }} |
| 160 | {{- if .Values.metrics.resources }} |
| 161 | resources: {{- toYaml .Values.metrics.resources | nindent 10 }} |
| 162 | {{- end }} |
| 163 | {{- end }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 164 | {{- if .Values.nodeSelector }} |
Sylvain Desbureaux | 77c848a | 2020-09-23 14:21:30 +0200 | [diff] [blame] | 165 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 166 | {{- end -}} |
| 167 | {{- if .Values.affinity }} |
Sylvain Desbureaux | 77c848a | 2020-09-23 14:21:30 +0200 | [diff] [blame] | 168 | affinity: {{ toYaml .Values.affinity | nindent 8 }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 169 | {{- end }} |
farida azmy | 661c81a | 2021-03-09 11:38:20 +0200 | [diff] [blame] | 170 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "nothing" "dot" . )}} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 171 | volumes: |
| 172 | - name: localtime |
| 173 | hostPath: |
| 174 | path: /etc/localtime |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 175 | {{- range $key, $value := .Values.configOverrides }} |
| 176 | - name: cassandra-config-{{ $key | replace "." "-" }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 177 | configMap: |
Mahendra Raghuwanshi | f59d925 | 2019-02-20 06:54:46 +0000 | [diff] [blame] | 178 | name: {{ include "common.fullname" . }}-configOverrides |
| 179 | {{- end }} |
mahendrr | 8b20f77 | 2019-05-03 06:50:10 +0000 | [diff] [blame] | 180 | - name: cassandra-entrypoint |
| 181 | configMap: |
| 182 | name: {{ include "common.fullname" . }}-entrypoint |
| 183 | defaultMode: 0755 |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 184 | {{- if not .Values.persistence.enabled }} |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 185 | - name: {{ include "common.fullname" . }}-data |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 186 | emptyDir: {} |
| 187 | {{- else }} |
| 188 | volumeClaimTemplates: |
| 189 | - metadata: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 190 | name: {{ include "common.fullname" . }}-data |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 191 | labels: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 192 | name: {{ include "common.fullname" . }} |
| 193 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 194 | release: "{{ include "common.release" . }}" |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 195 | heritage: "{{ .Release.Service }}" |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 196 | spec: |
| 197 | accessModes: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 198 | {{- if .Values.backup.enabled }} |
| 199 | - ReadWriteMany |
| 200 | {{- else }} |
| 201 | - ReadWriteOnce |
| 202 | {{- end }} |
| 203 | storageClassName: {{ include "common.storageClass" . }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 204 | resources: |
| 205 | requests: |
| 206 | storage: {{ .Values.persistence.size | quote }} |
prpatel | afedf2c | 2018-09-07 15:28:38 +0000 | [diff] [blame] | 207 | {{- end }} |
dasarathi528024 | 65e8f78 | 2023-05-03 09:51:20 +0000 | [diff] [blame] | 208 | {{- end }} |