blob: 4a8ae39270420b0d1fb68a7bcddd17d4836e40b0 [file] [log] [blame]
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00001# Copyright © 2018 Amdocs, Bell Canada, AT&T
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
vagrant1a3a3552018-03-10 23:56:32 +000015apiVersion: apps/v1beta1
16kind: StatefulSet
17metadata:
18 name: {{ include "common.fullname" . }}
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.name" . }}
22 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23 release: {{ .Release.Name }}
24 heritage: {{ .Release.Service }}
25spec:
BorislavG26b650f2018-05-13 17:11:01 +000026 serviceName: {{ include "common.servicename" . }}
vagrant1a3a3552018-03-10 23:56:32 +000027 replicas: {{ .Values.replicaCount }}
28 podManagementPolicy: {{ .Values.podManagementPolicy }}
29 updateStrategy:
30 type: {{ .Values.updateStrategy.type }}
31 template:
32 metadata:
33 labels:
34 app: {{ include "common.name" . }}
35 release: {{ .Release.Name }}
36 name: {{ include "common.name" . }}
37 spec:
38 containers:
39 - name: {{ include "common.name" . }}
40 image: {{ .Values.image }}
41 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42 ports:
43 - containerPort: {{ .Values.service.internalPort }}
44 - containerPort: {{ .Values.service.internalPort2 }}
45 - containerPort: {{ .Values.service.internalPort3 }}
vagrant1a3a3552018-03-10 23:56:32 +000046 {{- if eq .Values.liveness.enabled true }}
47 livenessProbe:
48 exec:
49 command:
50 - /bin/bash
51 - -c
52 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
53 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
54 periodSeconds: {{ .Values.liveness.periodSeconds }}
55 {{ end -}}
56 readinessProbe:
57 exec:
58 command:
59 - /bin/bash
60 - -c
61 - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
62 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
63 timeoutSeconds: {{ .Values.liveness.periodSeconds }}
64 lifecycle:
65 preStop:
66 exec:
67 command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
68 env:
69 {{- $seed_size := default 1 .Values.replicaCount | int -}}
70 {{- $global := . }}
71 - name: MAX_HEAP_SIZE
72 value: {{ .Values.config.heap.max }}
73 - name: HEAP_NEWSIZE
74 value: {{ .Values.config.heap.min }}
75 - name: CASSANDRA_SEEDS
BorislavG26b650f2018-05-13 17:11:01 +000076 value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }},{{- end }}"
vagrant1a3a3552018-03-10 23:56:32 +000077 - name: JVM_OPTS
78 value: {{ .Values.config.jvmOpts | quote }}
79 - name: CASSANDRA_CLUSTER_NAME
80 value: {{ .Values.config.clusterName | quote }}
81 - name: CASSANDRA_DC
82 value: {{ .Values.config.dataCenter | quote }}
83 - name: CASSANDRA_RACK
84 value: {{ .Values.config.rackName | quote }}
85 - name: CASSANDRA_AUTO_BOOTSTRAP
86 value: {{ .Values.config.autoBootstrap | quote }}
87 - name: POD_IP
88 valueFrom:
89 fieldRef:
90 fieldPath: status.podIP
91 volumeMounts:
92 - name: cassandra-data
Daniel Silverthornfc1a1882018-05-01 18:51:42 +000093 mountPath: /var/lib/cassandra
vagrant1a3a3552018-03-10 23:56:32 +000094 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000095{{ include "common.resources" . | indent 10 }}
vagrant1a3a3552018-03-10 23:56:32 +000096 {{- if .Values.nodeSelector }}
97 nodeSelector:
98{{ toYaml .Values.nodeSelector | indent 8 }}
99 {{- end -}}
100 {{- if .Values.affinity }}
101 affinity:
102{{ toYaml .Values.affinity | indent 8 }}
103 {{- end }}
104 volumes:
105 - name: localtime
106 hostPath:
107 path: /etc/localtime
108 {{- if not .Values.persistence.enabled }}
109 - name: cassandra-data
110 emptyDir: {}
111 {{- else }}
112 volumeClaimTemplates:
113 - metadata:
114 name: cassandra-data
115 labels:
116 app: {{ template "common.fullname" . }}
117 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
118 release: "{{ .Release.Name }}"
119 heritage: "{{ .Release.Service }}"
120 annotations:
121 volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }}
122 spec:
123 accessModes:
124 - {{ .Values.persistence.accessMode | quote }}
125 resources:
126 requests:
127 storage: {{ .Values.persistence.size | quote }}
Alexis de Talhouët634b4552018-10-28 21:56:33 -0400128 selector:
129 matchLabels:
130 release: "{{ .Release.Name }}"
vagrant1a3a3552018-03-10 23:56:32 +0000131 {{- end }}