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