blob: 2a1fb4f59e8fe27e930dcc47f5e32c04fc29d3a8 [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:
44 containers:
45 - name: {{ include "common.name" . }}
Sylvain Desbureaux589ecb92020-11-19 17:19:06 +010046 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040047 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48 ports:
49 - containerPort: {{ .Values.service.internalPort }}
50 - containerPort: {{ .Values.service.internalPort2 }}
51 - containerPort: {{ .Values.service.internalPort3 }}
52 {{- if eq .Values.liveness.enabled true }}
53 livenessProbe:
54 exec:
55 command:
56 - /bin/bash
57 - -c
58 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
59 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux226cbae2021-02-24 10:40:15 +010061 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
62 successThreshold: {{ .Values.liveness.successThreshold }}
63 failureThreshold: {{ .Values.liveness.failureThreshold }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040064 {{ end -}}
65 readinessProbe:
66 exec:
67 command:
68 - /bin/bash
69 - -c
70 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
71 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
Yang Xuee3fe4d2019-04-12 11:35:17 -040072 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux226cbae2021-02-24 10:40:15 +010073 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
74 successThreshold: {{ .Values.readiness.successThreshold }}
75 failureThreshold: {{ .Values.readiness.failureThreshold }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -040076 lifecycle:
77 preStop:
78 exec:
79 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
80 env:
81 {{- $seed_size := default 1 .Values.replicaCount | int -}}
82 {{- $global := . }}
83 - name: MAX_HEAP_SIZE
84 value: {{ .Values.config.heap.max }}
85 - name: HEAP_NEWSIZE
86 value: {{ .Values.config.heap.min }}
87 - name: CASSANDRA_SEEDS
88 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 }}"
89 - name: JVM_OPTS
90 value: {{ .Values.config.jvmOpts | quote }}
91 - name: CASSANDRA_CLUSTER_NAME
92 value: {{ .Values.config.clusterName | quote }}
93 - name: CASSANDRA_DC
94 value: {{ .Values.config.dataCenter | quote }}
95 - name: CASSANDRA_RACK
96 value: {{ .Values.config.rackName | quote }}
97 - name: CASSANDRA_AUTO_BOOTSTRAP
98 value: {{ .Values.config.autoBootstrap | quote }}
99 - name: POD_IP
100 valueFrom:
101 fieldRef:
102 fieldPath: status.podIP
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100103{{- if .Values.persistence.enabled }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400104 volumeMounts:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100105 - name: {{ include "common.fullname" . }}-data
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400106 mountPath: /var/lib/cassandra
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100107{{- end }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400108 resources:
Sylvain Desbureaux5ad860d2019-10-29 18:00:15 +0100109{{ include "common.resources" . | indent 12 }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400110 volumes:
111 - name: localtime
112 hostPath:
113 path: /etc/localtime
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100114{{- if .Values.persistence.enabled }}
Nelson,Thomas(tn1381)(arthurdent3)4807fdf2018-09-19 16:52:36 -0400115 volumeClaimTemplates:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100116 - metadata:
117 name: {{ include "common.fullname" . }}-data
118 labels:
119 name: {{ include "common.fullname" . }}
120 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100121 release: "{{ include "common.release" . }}"
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100122 heritage: "{{ .Release.Service }}"
123 spec:
124 accessModes:
125 - {{ .Values.persistence.accessMode | quote }}
126 storageClassName: {{ include "common.storageClass" . }}
127 resources:
128 requests:
129 storage: {{ .Values.persistence.size | quote }}
130{{- end }}