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 }}
30 {{- if or .Values.podAnnotations (and .Values.metrics.serviceMonitor.enabled .Values.metrics.podAnnotations) }}
32 {{- if .Values.podAnnotations }}
33 {{- include "common.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
35 {{- if and .Values.metrics.serviceMonitor.enabled .Values.metrics.podAnnotations }}
36 {{- include "common.tplValue" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
40 hostNetwork: {{ .Values.hostNetwork }}
42 - name: "{{ include "common.namespace" . }}-docker-registry-key"
44 - name: {{ include "common.name" . }}
45 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
46 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47 ports: {{ include "common.containerPorts" . | nindent 8 }}
49 - name: {{ include "common.fullname" . }}-data
50 mountPath: /var/lib/cassandra
52 mountPath: /etc/localtime
54 - name: cassandra-entrypoint
55 mountPath: /docker-entrypoint.sh
56 subPath: docker-entrypoint.sh
57 {{- range $key, $value := .Values.configOverrides }}
58 - name: cassandra-config-{{ $key | replace "." "-" }}
59 mountPath: /etc/cassandra/{{ $key }}
62 {{- if eq .Values.liveness.enabled true }}
68 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
69 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70 periodSeconds: {{ .Values.liveness.periodSeconds }}
71 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
72 successThreshold: {{ .Values.liveness.successThreshold }}
73 failureThreshold: {{ .Values.liveness.failureThreshold }}
80 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
81 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
82 periodSeconds: {{ .Values.readiness.periodSeconds }}
83 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
84 successThreshold: {{ .Values.readiness.successThreshold }}
85 failureThreshold: {{ .Values.readiness.failureThreshold }}
91 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
92 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
93 periodSeconds: {{ .Values.startup.periodSeconds }}
94 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
95 successThreshold: {{ .Values.startup.successThreshold }}
96 failureThreshold: {{ .Values.startup.failureThreshold }}
98 {{- $seed_size := default 1 .Values.replicaCount | int -}}
100 - name: CASSANDRA_SEEDS
101 {{- if .Values.hostNetwork }}
102 value: {{ required "You must fill \".Values.config.seeds\" with list of Cassandra seeds when hostNetwork is set to true" .Values.config.seeds | quote }}
104 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 }}"
106 - name: MAX_HEAP_SIZE
107 value: {{ .Values.config.heap.max }}
109 value: {{ .Values.config.heap.min }}
111 value: {{ .Values.config.jvmOpts | quote }}
112 - name: CASSANDRA_CLUSTER_NAME
113 value: {{ .Values.config.clusterName | quote }}
115 value: {{ .Values.config.dataCenter | quote }}
116 - name: CASSANDRA_RACK
117 value: {{ .Values.config.rackName | quote }}
118 - name: CASSANDRA_AUTO_BOOTSTRAP
119 value: {{ .Values.config.autoBootstrap | quote }}
120 - name: CASSANDRA_START_RPC
121 value: {{ default "true" .Values.config.start_rpc | quote }}
122 - name: CASSANDRA_ENDPOINT_SNITCH
123 value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }}
124 - name: CASSANDRA_AUTHENTICATOR
125 value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }}
129 fieldPath: status.podIP
133 {{- if not .Values.persistence.enabled }}
134 command: ["/bin/sh", "-c", "exec nodetool decommission"]
136 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
138 resources: {{ toYaml .Values.resources | nindent 10 }}
139 {{- if .Values.metrics.serviceMonitor.enabled }}
140 - name: {{ include "common.name" . }}-metrics
141 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.metrics.image }}
142 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.metrics.pullPolicy | quote}}
143 {{- if (.Values.metrics.enabled) }}
145 {{- range $index, $metricPort := .Values.metrics.ports }}
146 - name: {{ $metricPort.name }}
147 containerPort: {{ $metricPort.port }}
152 path: {{ .Values.metrics.livenessProbe.httpGet.path }}
153 port: {{ .Values.metrics.livenessProbe.httpGet.port }}
154 initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
155 periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
156 timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
157 successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
158 failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
161 path: {{ .Values.metrics.readinessProbe.httpGet.path }}
162 port: {{ .Values.metrics.readinessProbe.httpGet.port }}
163 initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
164 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
165 timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
166 successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
167 failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
169 {{ include "common.containerSecurityContext" . | indent 10 | trim }}
170 {{- if .Values.metrics.resources }}
171 resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
174 {{- if .Values.nodeSelector }}
175 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
177 {{- if .Values.affinity }}
178 affinity: {{ toYaml .Values.affinity | nindent 8 }}
180 serviceAccountName: {{ include "common.fullname" (dict "suffix" "nothing" "dot" . )}}
185 {{- range $key, $value := .Values.configOverrides }}
186 - name: cassandra-config-{{ $key | replace "." "-" }}
188 name: {{ include "common.fullname" . }}-configOverrides
190 - name: cassandra-entrypoint
192 name: {{ include "common.fullname" . }}-entrypoint
194 {{- if not .Values.persistence.enabled }}
195 - name: {{ include "common.fullname" . }}-data
198 volumeClaimTemplates:
200 name: {{ include "common.fullname" . }}-data
202 name: {{ include "common.fullname" . }}
203 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
204 release: "{{ include "common.release" . }}"
205 heritage: "{{ .Release.Service }}"
208 {{- if .Values.backup.enabled }}
213 storageClassName: {{ include "common.storageClass" . }}
216 storage: {{ .Values.persistence.size | quote }}