blob: 7162926e807bedb70acdffec7d966ee6c281fca9 [file] [log] [blame]
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -04001{{/*
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +01002# Copyright © 2019 AT&T, Amdocs, Bell Canada, Orange
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -04003#
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.
15*/}}
16
17
milaszki3f279642020-07-07 12:38:11 +000018apiVersion: apps/v1
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040019kind: StatefulSet
20metadata:
21 name: {{ include "common.fullname" . }}
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040027 heritage: {{ .Release.Service }}
28spec:
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040029 serviceName: {{ include "common.servicename" . }}
30 replicas: {{ .Values.replicaCount }}
milaszki3f279642020-07-07 12:38:11 +000031 selector:
32 matchLabels:
33 app: {{ include "common.name" . }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040034 podManagementPolicy: {{ .Values.podManagementPolicy }}
35 updateStrategy:
36 type: {{ .Values.updateStrategy.type }}
37 template:
38 metadata:
39 labels:
40 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010041 release: {{ include "common.release" . }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040042 name: {{ include "common.name" . }}
43 spec:
andreas-geisslerf84cccd2021-07-07 15:40:41 +020044 imagePullSecrets:
45 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040046 containers:
47 - name: {{ include "common.name" . }}
Sylvain Desbureaux589ecb92020-11-19 17:19:06 +010048 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040049 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50 ports:
51 - containerPort: {{ .Values.service.internalPort }}
52 - containerPort: {{ .Values.service.internalPort2 }}
53 - containerPort: {{ .Values.service.internalPort3 }}
54 {{- if eq .Values.liveness.enabled true }}
55 livenessProbe:
56 exec:
57 command:
58 - /bin/bash
59 - -c
60 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
61 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
62 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux226cbae2021-02-24 10:40:15 +010063 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
64 successThreshold: {{ .Values.liveness.successThreshold }}
65 failureThreshold: {{ .Values.liveness.failureThreshold }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040066 {{ end -}}
67 readinessProbe:
68 exec:
69 command:
70 - /bin/bash
71 - -c
72 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
73 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
Yang Xuee3fe4d2019-04-12 11:35:17 -040074 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux226cbae2021-02-24 10:40:15 +010075 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
76 successThreshold: {{ .Values.readiness.successThreshold }}
77 failureThreshold: {{ .Values.readiness.failureThreshold }}
Sylvain Desbureaux60f25bd2021-05-05 10:50:55 +020078 startupProbe:
79 exec:
80 command:
81 - /bin/bash
82 - -c
83 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
84 initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
85 periodSeconds: {{ .Values.startup.periodSeconds }}
86 timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
87 successThreshold: {{ .Values.startup.successThreshold }}
88 failureThreshold: {{ .Values.startup.failureThreshold }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040089 lifecycle:
90 preStop:
91 exec:
92 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
93 env:
94 {{- $seed_size := default 1 .Values.replicaCount | int -}}
95 {{- $global := . }}
96 - name: MAX_HEAP_SIZE
97 value: {{ .Values.config.heap.max }}
98 - name: HEAP_NEWSIZE
99 value: {{ .Values.config.heap.min }}
100 - name: CASSANDRA_SEEDS
101 value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }}{{- if (lt ( add 1 $i ) $seed_size ) }},{{- end }}{{- end }}"
102 - name: JVM_OPTS
103 value: {{ .Values.config.jvmOpts | quote }}
104 - name: CASSANDRA_CLUSTER_NAME
105 value: {{ .Values.config.clusterName | quote }}
106 - name: CASSANDRA_DC
107 value: {{ .Values.config.dataCenter | quote }}
108 - name: CASSANDRA_RACK
109 value: {{ .Values.config.rackName | quote }}
110 - name: CASSANDRA_AUTO_BOOTSTRAP
111 value: {{ .Values.config.autoBootstrap | quote }}
112 - name: POD_IP
113 valueFrom:
114 fieldRef:
115 fieldPath: status.podIP
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100116{{- if .Values.persistence.enabled }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400117 volumeMounts:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100118 - name: {{ include "common.fullname" . }}-data
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400119 mountPath: /var/lib/cassandra
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100120{{- end }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100121 resources: {{ include "common.resources" . | nindent 10 }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400122 volumes:
123 - name: localtime
124 hostPath:
125 path: /etc/localtime
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100126{{- if .Values.persistence.enabled }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400127 volumeClaimTemplates:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100128 - metadata:
129 name: {{ include "common.fullname" . }}-data
130 labels:
131 name: {{ include "common.fullname" . }}
132 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100133 release: "{{ include "common.release" . }}"
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100134 heritage: "{{ .Release.Service }}"
135 spec:
136 accessModes:
137 - {{ .Values.persistence.accessMode | quote }}
138 storageClassName: {{ include "common.storageClass" . }}
139 resources:
140 requests:
141 storage: {{ .Values.persistence.size | quote }}
142{{- end }}