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.
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 selector: {{- include "common.selectors" . | nindent 4 }}
22 serviceName: {{ include "common.servicename" . }}
23 replicas: {{ .Values.replicaCount }}
24 podManagementPolicy: {{ .Values.podManagementPolicy }}
26 type: {{ .Values.updateStrategy.type }}
28 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
29 {{- if or .Values.podAnnotations (and .Values.metrics.serviceMonitor.enabled .Values.metrics.podAnnotations) }}
31 {{- if .Values.podAnnotations }}
32 {{- include "common.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
34 {{- if and .Values.metrics.serviceMonitor.enabled .Values.metrics.podAnnotations }}
35 {{- include "common.tplValue" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
39 hostNetwork: {{ .Values.hostNetwork }}
41 - name: "{{ include "common.namespace" . }}-docker-registry-key"
43 - name: {{ include "common.name" . }}
44 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
45 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46 ports: {{ include "common.containerPorts" . | nindent 8 }}
48 - name: {{ include "common.fullname" . }}-data
49 mountPath: /var/lib/cassandra
51 mountPath: /etc/localtime
53 - name: cassandra-entrypoint
54 mountPath: /docker-entrypoint.sh
55 subPath: docker-entrypoint.sh
56 {{- range $key, $value := .Values.configOverrides }}
57 - name: cassandra-config-{{ $key | replace "." "-" }}
58 mountPath: /etc/cassandra/{{ $key }}
61 {{- if eq .Values.liveness.enabled true }}
67 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
68 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
69 periodSeconds: {{ .Values.liveness.periodSeconds }}
70 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
71 successThreshold: {{ .Values.liveness.successThreshold }}
72 failureThreshold: {{ .Values.liveness.failureThreshold }}
79 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
80 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
81 periodSeconds: {{ .Values.readiness.periodSeconds }}
82 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
83 successThreshold: {{ .Values.readiness.successThreshold }}
84 failureThreshold: {{ .Values.readiness.failureThreshold }}
90 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
91 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
92 periodSeconds: {{ .Values.startup.periodSeconds }}
93 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
94 successThreshold: {{ .Values.startup.successThreshold }}
95 failureThreshold: {{ .Values.startup.failureThreshold }}
97 {{- $seed_size := default 1 .Values.replicaCount | int -}}
99 - name: CASSANDRA_SEEDS
100 {{- if .Values.hostNetwork }}
101 value: {{ required "You must fill \".Values.config.seeds\" with list of Cassandra seeds when hostNetwork is set to true" .Values.config.seeds | quote }}
103 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 }}"
105 - name: MAX_HEAP_SIZE
106 value: {{ .Values.config.heap.max }}
108 value: {{ .Values.config.heap.min }}
110 value: {{ .Values.config.jvmOpts | quote }}
111 - name: CASSANDRA_CLUSTER_NAME
112 value: {{ .Values.config.clusterName | quote }}
114 value: {{ .Values.config.dataCenter | quote }}
115 - name: CASSANDRA_RACK
116 value: {{ .Values.config.rackName | quote }}
117 - name: CASSANDRA_AUTO_BOOTSTRAP
118 value: {{ .Values.config.autoBootstrap | quote }}
119 - name: CASSANDRA_START_RPC
120 value: {{ default "true" .Values.config.start_rpc | quote }}
121 - name: CASSANDRA_ENDPOINT_SNITCH
122 value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }}
123 - name: CASSANDRA_AUTHENTICATOR
124 value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }}
128 fieldPath: status.podIP
132 {{- if not .Values.persistence.enabled }}
133 command: ["/bin/sh", "-c", "exec nodetool decommission"]
135 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
137 resources: {{ toYaml .Values.resources | nindent 10 }}
138 {{- if .Values.metrics.serviceMonitor.enabled }}
139 - name: {{ include "common.name" . }}-metrics
140 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.metrics.image }}
141 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.metrics.pullPolicy | quote}}
142 {{- if (.Values.metrics.enabled) }}
144 {{- range $index, $metricPort := .Values.metrics.ports }}
145 - name: {{ $metricPort.name }}
146 containerPort: {{ $metricPort.port }}
151 path: {{ .Values.metrics.livenessProbe.httpGet.path }}
152 port: {{ .Values.metrics.livenessProbe.httpGet.port }}
153 initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
154 periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
155 timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
156 successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
157 failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
160 path: {{ .Values.metrics.readinessProbe.httpGet.path }}
161 port: {{ .Values.metrics.readinessProbe.httpGet.port }}
162 initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
163 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
164 timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
165 successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
166 failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
168 {{ include "common.containerSecurityContext" . | indent 10 | trim }}
169 {{- if .Values.metrics.resources }}
170 resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
173 {{- if .Values.nodeSelector }}
174 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
176 {{- if .Values.affinity }}
177 affinity: {{ toYaml .Values.affinity | nindent 8 }}
179 serviceAccountName: {{ include "common.fullname" (dict "suffix" "nothing" "dot" . )}}
184 {{- range $key, $value := .Values.configOverrides }}
185 - name: cassandra-config-{{ $key | replace "." "-" }}
187 name: {{ include "common.fullname" . }}-configOverrides
189 - name: cassandra-entrypoint
191 name: {{ include "common.fullname" . }}-entrypoint
193 {{- if not .Values.persistence.enabled }}
194 - name: {{ include "common.fullname" . }}-data
197 volumeClaimTemplates:
199 name: {{ include "common.fullname" . }}-data
201 name: {{ include "common.fullname" . }}
202 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
203 release: "{{ include "common.release" . }}"
204 heritage: "{{ .Release.Service }}"
207 {{- if .Values.backup.enabled }}
212 storageClassName: {{ include "common.storageClass" . }}
215 storage: {{ .Values.persistence.size | quote }}