2 # Copyright © 2022 Amdocs, AT&T, Bell Canada, Bitnami
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 {{- if not .Values.global.cassandra.useOperator }}
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 selector: {{- include "common.selectors" . | nindent 4 }}
23 serviceName: {{ include "common.servicename" . }}
24 replicas: {{ .Values.replicaCount }}
25 podManagementPolicy: {{ .Values.podManagementPolicy }}
27 type: {{ .Values.updateStrategy.type }}
29 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
31 hostNetwork: {{ .Values.hostNetwork }}
32 {{- include "common.imagePullSecrets" . | nindent 6 }}
34 - name: {{ include "common.name" . }}
35 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
36 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
37 ports: {{ include "common.containerPorts" . | nindent 8 }}
39 - name: {{ include "common.fullname" . }}-data
40 mountPath: /var/lib/cassandra
42 mountPath: /etc/localtime
44 - name: cassandra-entrypoint
45 mountPath: /docker-entrypoint.sh
46 subPath: docker-entrypoint.sh
47 {{- range $key, $value := .Values.configOverrides }}
48 - name: cassandra-config-{{ $key | replace "." "-" }}
49 mountPath: /etc/cassandra/{{ $key }}
52 {{- if eq .Values.liveness.enabled true }}
58 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
59 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60 periodSeconds: {{ .Values.liveness.periodSeconds }}
61 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
62 successThreshold: {{ .Values.liveness.successThreshold }}
63 failureThreshold: {{ .Values.liveness.failureThreshold }}
70 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
71 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72 periodSeconds: {{ .Values.readiness.periodSeconds }}
73 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
74 successThreshold: {{ .Values.readiness.successThreshold }}
75 failureThreshold: {{ .Values.readiness.failureThreshold }}
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 }}
88 {{- $seed_size := default 1 .Values.replicaCount | int -}}
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 }}
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 }}"
97 value: {{ .Values.config.heap.max }}
99 value: {{ .Values.config.heap.min }}
101 value: {{ .Values.config.jvmOpts | quote }}
102 - name: CASSANDRA_CLUSTER_NAME
103 value: {{ .Values.config.clusterName | quote }}
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 }}
110 - name: CASSANDRA_START_RPC
111 value: {{ default "true" .Values.config.start_rpc | quote }}
112 - name: CASSANDRA_ENDPOINT_SNITCH
113 value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }}
114 - name: CASSANDRA_AUTHENTICATOR
115 value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }}
119 fieldPath: status.podIP
123 {{- if not .Values.persistence.enabled }}
124 command: ["/bin/sh", "-c", "exec nodetool decommission"]
126 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
128 resources: {{ toYaml .Values.resources | nindent 10 }}
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) }}
135 {{- range $index, $metricPort := .Values.metrics.ports }}
136 - name: {{ $metricPort.name }}
137 containerPort: {{ $metricPort.port }}
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 }}
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 }}
159 {{ include "common.containerSecurityContext" . | indent 10 | trim }}
160 {{- if .Values.metrics.resources }}
161 resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
164 {{- if .Values.nodeSelector }}
165 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
167 {{- if .Values.affinity }}
168 affinity: {{ toYaml .Values.affinity | nindent 8 }}
170 serviceAccountName: {{ include "common.fullname" (dict "suffix" "nothing" "dot" . )}}
175 {{- range $key, $value := .Values.configOverrides }}
176 - name: cassandra-config-{{ $key | replace "." "-" }}
178 name: {{ include "common.fullname" . }}-configOverrides
180 - name: cassandra-entrypoint
182 name: {{ include "common.fullname" . }}-entrypoint
184 {{- if not .Values.persistence.enabled }}
185 - name: {{ include "common.fullname" . }}-data
188 volumeClaimTemplates:
190 name: {{ include "common.fullname" . }}-data
192 name: {{ include "common.fullname" . }}
193 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
194 release: "{{ include "common.release" . }}"
195 heritage: "{{ .Release.Service }}"
198 {{- if .Values.backup.enabled }}
203 storageClassName: {{ include "common.storageClass" . }}
206 storage: {{ .Values.persistence.size | quote }}