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.k8ssandraOperator.enabled }}
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 }}
33 - name: "{{ include "common.namespace" . }}-docker-registry-key"
35 - name: {{ include "common.name" . }}
36 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
37 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38 ports: {{ include "common.containerPorts" . | nindent 8 }}
40 - name: {{ include "common.fullname" . }}-data
41 mountPath: /var/lib/cassandra
43 mountPath: /etc/localtime
45 - name: cassandra-entrypoint
46 mountPath: /docker-entrypoint.sh
47 subPath: docker-entrypoint.sh
48 {{- range $key, $value := .Values.configOverrides }}
49 - name: cassandra-config-{{ $key | replace "." "-" }}
50 mountPath: /etc/cassandra/{{ $key }}
53 {{- if eq .Values.liveness.enabled true }}
59 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
60 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
61 periodSeconds: {{ .Values.liveness.periodSeconds }}
62 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
63 successThreshold: {{ .Values.liveness.successThreshold }}
64 failureThreshold: {{ .Values.liveness.failureThreshold }}
71 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
72 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
73 periodSeconds: {{ .Values.readiness.periodSeconds }}
74 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
75 successThreshold: {{ .Values.readiness.successThreshold }}
76 failureThreshold: {{ .Values.readiness.failureThreshold }}
82 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
83 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
84 periodSeconds: {{ .Values.startup.periodSeconds }}
85 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
86 successThreshold: {{ .Values.startup.successThreshold }}
87 failureThreshold: {{ .Values.startup.failureThreshold }}
89 {{- $seed_size := default 1 .Values.replicaCount | int -}}
91 - name: CASSANDRA_SEEDS
92 {{- if .Values.hostNetwork }}
93 value: {{ required "You must fill \".Values.config.seeds\" with list of Cassandra seeds when hostNetwork is set to true" .Values.config.seeds | quote }}
95 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 }}"
98 value: {{ .Values.config.heap.max }}
100 value: {{ .Values.config.heap.min }}
102 value: {{ .Values.config.jvmOpts | quote }}
103 - name: CASSANDRA_CLUSTER_NAME
104 value: {{ .Values.config.clusterName | quote }}
106 value: {{ .Values.config.dataCenter | quote }}
107 - name: CASSANDRA_RACK
108 value: {{ .Values.config.rackName | quote }}
109 - name: CASSANDRA_AUTO_BOOTSTRAP
110 value: {{ .Values.config.autoBootstrap | quote }}
111 - name: CASSANDRA_START_RPC
112 value: {{ default "true" .Values.config.start_rpc | quote }}
113 - name: CASSANDRA_ENDPOINT_SNITCH
114 value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }}
115 - name: CASSANDRA_AUTHENTICATOR
116 value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }}
120 fieldPath: status.podIP
124 {{- if not .Values.persistence.enabled }}
125 command: ["/bin/sh", "-c", "exec nodetool decommission"]
127 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
129 resources: {{ toYaml .Values.resources | nindent 10 }}
130 {{- if .Values.metrics.serviceMonitor.enabled }}
131 - name: {{ include "common.name" . }}-metrics
132 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.metrics.image }}
133 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.metrics.pullPolicy | quote}}
134 {{- if (.Values.metrics.enabled) }}
136 {{- range $index, $metricPort := .Values.metrics.ports }}
137 - name: {{ $metricPort.name }}
138 containerPort: {{ $metricPort.port }}
143 path: {{ .Values.metrics.livenessProbe.httpGet.path }}
144 port: {{ .Values.metrics.livenessProbe.httpGet.port }}
145 initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
146 periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
147 timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
148 successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
149 failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
152 path: {{ .Values.metrics.readinessProbe.httpGet.path }}
153 port: {{ .Values.metrics.readinessProbe.httpGet.port }}
154 initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
155 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
156 timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
157 successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
158 failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
160 {{ include "common.containerSecurityContext" . | indent 10 | trim }}
161 {{- if .Values.metrics.resources }}
162 resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
165 {{- if .Values.nodeSelector }}
166 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
168 {{- if .Values.affinity }}
169 affinity: {{ toYaml .Values.affinity | nindent 8 }}
171 serviceAccountName: {{ include "common.fullname" (dict "suffix" "nothing" "dot" . )}}
176 {{- range $key, $value := .Values.configOverrides }}
177 - name: cassandra-config-{{ $key | replace "." "-" }}
179 name: {{ include "common.fullname" . }}-configOverrides
181 - name: cassandra-entrypoint
183 name: {{ include "common.fullname" . }}-entrypoint
185 {{- if not .Values.persistence.enabled }}
186 - name: {{ include "common.fullname" . }}-data
189 volumeClaimTemplates:
191 name: {{ include "common.fullname" . }}-data
193 name: {{ include "common.fullname" . }}
194 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
195 release: "{{ include "common.release" . }}"
196 heritage: "{{ .Release.Service }}"
199 {{- if .Values.backup.enabled }}
204 storageClassName: {{ include "common.storageClass" . }}
207 storage: {{ .Values.persistence.size | quote }}