vagrant | 1a3a355 | 2018-03-10 23:56:32 +0000 | [diff] [blame] | 1 | apiVersion: apps/v1beta1 |
| 2 | kind: StatefulSet |
| 3 | metadata: |
| 4 | name: {{ include "common.fullname" . }} |
| 5 | namespace: {{ include "common.namespace" . }} |
| 6 | labels: |
| 7 | app: {{ include "common.name" . }} |
| 8 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 9 | release: {{ .Release.Name }} |
| 10 | heritage: {{ .Release.Service }} |
| 11 | spec: |
BorislavG | 26b650f | 2018-05-13 17:11:01 +0000 | [diff] [blame] | 12 | serviceName: {{ include "common.servicename" . }} |
vagrant | 1a3a355 | 2018-03-10 23:56:32 +0000 | [diff] [blame] | 13 | replicas: {{ .Values.replicaCount }} |
| 14 | podManagementPolicy: {{ .Values.podManagementPolicy }} |
| 15 | updateStrategy: |
| 16 | type: {{ .Values.updateStrategy.type }} |
| 17 | template: |
| 18 | metadata: |
| 19 | labels: |
| 20 | app: {{ include "common.name" . }} |
| 21 | release: {{ .Release.Name }} |
| 22 | name: {{ include "common.name" . }} |
| 23 | spec: |
| 24 | containers: |
| 25 | - name: {{ include "common.name" . }} |
| 26 | image: {{ .Values.image }} |
| 27 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 28 | ports: |
| 29 | - containerPort: {{ .Values.service.internalPort }} |
| 30 | - containerPort: {{ .Values.service.internalPort2 }} |
| 31 | - containerPort: {{ .Values.service.internalPort3 }} |
vagrant | 1a3a355 | 2018-03-10 23:56:32 +0000 | [diff] [blame] | 32 | {{- if eq .Values.liveness.enabled true }} |
| 33 | livenessProbe: |
| 34 | exec: |
| 35 | command: |
| 36 | - /bin/bash |
| 37 | - -c |
| 38 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 39 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 40 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 41 | {{ end -}} |
| 42 | readinessProbe: |
| 43 | exec: |
| 44 | command: |
| 45 | - /bin/bash |
| 46 | - -c |
| 47 | - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }' |
| 48 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 49 | timeoutSeconds: {{ .Values.liveness.periodSeconds }} |
| 50 | lifecycle: |
| 51 | preStop: |
| 52 | exec: |
| 53 | command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
| 54 | env: |
| 55 | {{- $seed_size := default 1 .Values.replicaCount | int -}} |
| 56 | {{- $global := . }} |
| 57 | - name: MAX_HEAP_SIZE |
| 58 | value: {{ .Values.config.heap.max }} |
| 59 | - name: HEAP_NEWSIZE |
| 60 | value: {{ .Values.config.heap.min }} |
| 61 | - name: CASSANDRA_SEEDS |
BorislavG | 26b650f | 2018-05-13 17:11:01 +0000 | [diff] [blame] | 62 | value: "{{- range $i, $e := until $seed_size }}{{ template "common.fullname" $global }}-{{ $i }}.{{ include "common.servicename" $global }},{{- end }}" |
vagrant | 1a3a355 | 2018-03-10 23:56:32 +0000 | [diff] [blame] | 63 | - name: JVM_OPTS |
| 64 | value: {{ .Values.config.jvmOpts | quote }} |
| 65 | - name: CASSANDRA_CLUSTER_NAME |
| 66 | value: {{ .Values.config.clusterName | quote }} |
| 67 | - name: CASSANDRA_DC |
| 68 | value: {{ .Values.config.dataCenter | quote }} |
| 69 | - name: CASSANDRA_RACK |
| 70 | value: {{ .Values.config.rackName | quote }} |
| 71 | - name: CASSANDRA_AUTO_BOOTSTRAP |
| 72 | value: {{ .Values.config.autoBootstrap | quote }} |
| 73 | - name: POD_IP |
| 74 | valueFrom: |
| 75 | fieldRef: |
| 76 | fieldPath: status.podIP |
| 77 | volumeMounts: |
| 78 | - name: cassandra-data |
Daniel Silverthorn | fc1a188 | 2018-05-01 18:51:42 +0000 | [diff] [blame] | 79 | mountPath: /var/lib/cassandra |
vagrant | 1a3a355 | 2018-03-10 23:56:32 +0000 | [diff] [blame] | 80 | resources: |
| 81 | {{ toYaml .Values.resources | indent 10 }} |
| 82 | {{- if .Values.nodeSelector }} |
| 83 | nodeSelector: |
| 84 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 85 | {{- end -}} |
| 86 | {{- if .Values.affinity }} |
| 87 | affinity: |
| 88 | {{ toYaml .Values.affinity | indent 8 }} |
| 89 | {{- end }} |
| 90 | volumes: |
| 91 | - name: localtime |
| 92 | hostPath: |
| 93 | path: /etc/localtime |
| 94 | {{- if not .Values.persistence.enabled }} |
| 95 | - name: cassandra-data |
| 96 | emptyDir: {} |
| 97 | {{- else }} |
| 98 | volumeClaimTemplates: |
| 99 | - metadata: |
| 100 | name: cassandra-data |
| 101 | labels: |
| 102 | app: {{ template "common.fullname" . }} |
| 103 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 104 | release: "{{ .Release.Name }}" |
| 105 | heritage: "{{ .Release.Service }}" |
| 106 | annotations: |
| 107 | volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }} |
| 108 | spec: |
| 109 | accessModes: |
| 110 | - {{ .Values.persistence.accessMode | quote }} |
| 111 | resources: |
| 112 | requests: |
| 113 | storage: {{ .Values.persistence.size | quote }} |
| 114 | {{- end }} |