Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright © 2018 AT&T, Amdocs, Bell Canada Intellectual Property. All rights reserved. |
| 3 | # |
| 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 | |
| 18 | apiVersion: apps/v1beta1 |
| 19 | kind: StatefulSet |
| 20 | metadata: |
| 21 | name: {{ include "common.fullname" . }} |
| 22 | namespace: {{ include "common.namespace" . }} |
| 23 | labels: |
| 24 | app: {{ include "common.name" . }} |
| 25 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 26 | release: {{ .Release.Name }} |
| 27 | heritage: {{ .Release.Service }} |
| 28 | spec: |
| 29 | podAntiAffinity: |
| 30 | preferredDuringSchedulingIgnoredDuringExecution: |
| 31 | - weight: 1 |
| 32 | podAffinityTerm: |
| 33 | labelSelector: |
| 34 | matchExpressions: |
| 35 | - key: app |
| 36 | operator: In |
| 37 | values: |
| 38 | - {{ .Chart.Name }} |
| 39 | topologyKey: kubernetes.io/hostname |
| 40 | serviceName: {{ include "common.servicename" . }} |
| 41 | replicas: {{ .Values.replicaCount }} |
| 42 | podManagementPolicy: {{ .Values.podManagementPolicy }} |
| 43 | updateStrategy: |
| 44 | type: {{ .Values.updateStrategy.type }} |
| 45 | template: |
| 46 | metadata: |
| 47 | labels: |
| 48 | app: {{ include "common.name" . }} |
| 49 | release: {{ .Release.Name }} |
| 50 | name: {{ include "common.name" . }} |
| 51 | spec: |
| 52 | containers: |
| 53 | - name: {{ include "common.name" . }} |
| 54 | image: "{{ .Values.global.repository }}/{{ .Values.image.image }}" |
| 55 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 56 | ports: |
| 57 | - containerPort: {{ .Values.service.internalPort }} |
| 58 | - containerPort: {{ .Values.service.internalPort2 }} |
| 59 | - containerPort: {{ .Values.service.internalPort3 }} |
| 60 | {{- if eq .Values.liveness.enabled true }} |
| 61 | livenessProbe: |
| 62 | exec: |
| 63 | command: |
| 64 | - /bin/bash |
| 65 | - -c |
| 66 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 67 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 68 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 69 | {{ end -}} |
| 70 | readinessProbe: |
| 71 | exec: |
| 72 | command: |
| 73 | - /bin/bash |
| 74 | - -c |
| 75 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 76 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
Yang Xu | ee3fe4d | 2019-04-12 11:35:17 -0400 | [diff] [blame] | 77 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 78 | lifecycle: |
| 79 | preStop: |
| 80 | exec: |
| 81 | command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
| 82 | env: |
| 83 | {{- $seed_size := default 1 .Values.replicaCount | int -}} |
| 84 | {{- $global := . }} |
| 85 | - name: MAX_HEAP_SIZE |
| 86 | value: {{ .Values.config.heap.max }} |
| 87 | - name: HEAP_NEWSIZE |
| 88 | value: {{ .Values.config.heap.min }} |
| 89 | - name: CASSANDRA_SEEDS |
| 90 | 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 }}" |
| 91 | - name: JVM_OPTS |
| 92 | value: {{ .Values.config.jvmOpts | quote }} |
| 93 | - name: CASSANDRA_CLUSTER_NAME |
| 94 | value: {{ .Values.config.clusterName | quote }} |
| 95 | - name: CASSANDRA_DC |
| 96 | value: {{ .Values.config.dataCenter | quote }} |
| 97 | - name: CASSANDRA_RACK |
| 98 | value: {{ .Values.config.rackName | quote }} |
| 99 | - name: CASSANDRA_AUTO_BOOTSTRAP |
| 100 | value: {{ .Values.config.autoBootstrap | quote }} |
| 101 | - name: POD_IP |
| 102 | valueFrom: |
| 103 | fieldRef: |
| 104 | fieldPath: status.podIP |
| 105 | volumeMounts: |
Thomas Nelson Jr arthuerdent3 | da1813f | 2018-10-29 21:03:59 +0000 | [diff] [blame] | 106 | - name: {{ template "common.name" . }}-data |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 107 | mountPath: /var/lib/cassandra |
| 108 | resources: |
Sylvain Desbureaux | 5ad860d | 2019-10-29 18:00:15 +0100 | [diff] [blame] | 109 | {{ include "common.resources" . | indent 12 }} |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 110 | volumes: |
| 111 | - name: localtime |
| 112 | hostPath: |
| 113 | path: /etc/localtime |
| 114 | {{- if not .Values.persistence.enabled }} |
Thomas Nelson Jr arthuerdent3 | da1813f | 2018-10-29 21:03:59 +0000 | [diff] [blame] | 115 | - name: {{ template "common.name" . }}-data |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 116 | emptyDir: {} |
| 117 | {{- else }} |
| 118 | volumeClaimTemplates: |
| 119 | - metadata: |
Thomas Nelson Jr arthuerdent3 | da1813f | 2018-10-29 21:03:59 +0000 | [diff] [blame] | 120 | name: {{ template "common.name" . }}-data |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 121 | labels: |
| 122 | app: {{ template "common.fullname" . }} |
| 123 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 124 | release: "{{ .Release.Name }}" |
| 125 | heritage: "{{ .Release.Service }}" |
| 126 | annotations: |
| 127 | volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }} |
| 128 | spec: |
| 129 | storageClassName: {{ .Values.persistence.storageClass }} |
| 130 | accessModes: |
| 131 | - {{ .Values.persistence.accessMode | quote }} |
| 132 | resources: |
| 133 | requests: |
| 134 | storage: {{ .Values.persistence.size | quote }} |
Alexis de Talhouët | 634b455 | 2018-10-28 21:56:33 -0400 | [diff] [blame] | 135 | selector: |
| 136 | matchLabels: |
Pawel Wieczorek | b2def01 | 2019-01-17 19:22:37 +0100 | [diff] [blame] | 137 | app: {{ include "common.name" . }} |
Alexis de Talhouët | 634b455 | 2018-10-28 21:56:33 -0400 | [diff] [blame] | 138 | release: "{{ .Release.Name }}" |
Nelson,Thomas(tn1381)(arthurdent3) | 4807fdf | 2018-09-19 16:52:36 -0400 | [diff] [blame] | 139 | {{- end }} |
Sylvain Desbureaux | b2f054c | 2018-12-20 11:11:50 +0100 | [diff] [blame] | 140 | imagePullSecrets: |
| 141 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |