mirror of
https://github.com/Telecominfraproject/wlan-cloud-helm.git
synced 2025-10-29 09:42:29 +00:00
- Also updated SSC to work with Cassandra in SSL mode. - Created Schema in Cassandra on SSC startup
307 lines
12 KiB
YAML
307 lines
12 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "common.fullname" . }}
|
|
namespace: {{ include "common.namespace" . }}
|
|
labels: {{- include "common.labels" . | nindent 4 }}
|
|
spec:
|
|
selector:
|
|
matchLabels: {{- include "common.selectorLabels" . | nindent 6 }}
|
|
serviceName: {{ include "common.fullname" . }}-headless
|
|
replicas: {{ .Values.cluster.replicaCount }}
|
|
updateStrategy:
|
|
type: {{ .Values.statefulset.updateStrategy }}
|
|
{{- if (eq "Recreate" .Values.statefulset.updateStrategy) }}
|
|
rollingUpdate: null
|
|
{{- else if .Values.statefulset.rollingUpdatePartition }}
|
|
rollingUpdate:
|
|
partition: {{ .Values.statefulset.rollingUpdatePartition }}
|
|
{{- end }}
|
|
template:
|
|
metadata:
|
|
labels: {{- include "common.labels" . | nindent 8 }}
|
|
{{- if .Values.podLabels }}
|
|
{{- toYaml .Values.podLabels | nindent 8 }}
|
|
{{- end }}
|
|
{{- if or .Values.podAnnotations (and .Values.metrics.enabled .Values.metrics.podAnnotations) }}
|
|
annotations:
|
|
{{- if .Values.podAnnotations }}
|
|
{{- toYaml .Values.podAnnotations | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.metrics.podAnnotations }}
|
|
{{- toYaml .Values.metrics.podAnnotations | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "cassandra.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "cassandra.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "cassandra.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.securityContext.enabled }}
|
|
securityContext:
|
|
fsGroup: {{ .Values.securityContext.fsGroup }}
|
|
runAsUser: {{ .Values.securityContext.runAsUser }}
|
|
{{- end }}
|
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
|
initContainers:
|
|
- name: volume-permissions
|
|
image: {{ include "cassandra.volumePermissions.image" . }}
|
|
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
|
command:
|
|
- /bin/bash
|
|
- -ec
|
|
- |
|
|
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /bitnami/cassandra
|
|
securityContext:
|
|
runAsUser: 0
|
|
{{- if .Values.volumePermissions.resources }}
|
|
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /bitnami/cassandra
|
|
{{- end }}
|
|
containers:
|
|
- name: cassandra
|
|
command:
|
|
- bash
|
|
- -ec
|
|
# Node 0 is the password seeder
|
|
- |
|
|
if [[ $HOSTNAME =~ (.*)-0$ ]]; then
|
|
echo "Setting node as password seeder"
|
|
export CASSANDRA_PASSWORD_SEEDER=yes
|
|
else
|
|
# Only node 0 will execute the startup initdb scripts
|
|
export CASSANDRA_IGNORE_INITDB_SCRIPTS=1
|
|
fi
|
|
{{ .Values.entrypoint }} {{ .Values.cmd }}
|
|
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
env:
|
|
- name: BITNAMI_DEBUG
|
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
|
- name: CASSANDRA_CLUSTER_NAME
|
|
value: {{ .Values.cluster.name }}
|
|
- name: CASSANDRA_SEEDS
|
|
{{- $global := . }}
|
|
{{- $replicas := .Values.cluster.seedCount | int }}
|
|
{{- $domain := .Values.cluster.domain }}
|
|
value: "{{- range $i, $e := until $replicas }}{{ include "common.fullname" $global }}-{{ $i }}.{{ include "common.fullname" $global }}-headless.{{ $global.Values.global.nsPrefix }}.svc.{{ $domain }}{{- if (lt ( add1 $i ) $replicas ) }},{{- end }}{{- end }}"
|
|
- name: CASSANDRA_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ if .Values.dbUser.existingSecret }}{{ .Values.dbUser.existingSecret }}{{- else }}{{ include "common.fullname" . }}{{- end }}
|
|
key: cassandra-password
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
- name: CASSANDRA_USER
|
|
value: {{ .Values.dbUser.user | quote }}
|
|
- name: CASSANDRA_NUM_TOKENS
|
|
value: {{ .Values.cluster.numTokens | quote }}
|
|
- name: CASSANDRA_DATACENTER
|
|
value: {{ .Values.cluster.datacenter }}
|
|
- name: CASSANDRA_ENDPOINT_SNITCH
|
|
value: {{ .Values.cluster.endpointSnitch }}
|
|
{{- if .Values.tlsEncryptionSecretName }}
|
|
- name: CASSANDRA_INTERNODE_ENCRYPTION
|
|
value: {{ .Values.cluster.internodeEncryption | quote }}
|
|
- name: CASSANDRA_CLIENT_ENCRYPTION
|
|
value: {{ .Values.cluster.clientEncryption | quote }}
|
|
- name: CASSANDRA_TRUSTSTORE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.tlsEncryptionSecretName }}
|
|
key: truststore-password
|
|
- name: CASSANDRA_KEYSTORE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.tlsEncryptionSecretName }}
|
|
key: keystore-password
|
|
{{- end }}
|
|
- name: CASSANDRA_RACK
|
|
value: {{ .Values.cluster.rack }}
|
|
{{- if .Values.jvm.maxHeapSize }}
|
|
- name: MAX_HEAP_SIZE
|
|
value: {{ .Values.jvm.maxHeapSize | quote }}
|
|
{{- end }}
|
|
{{- if .Values.jvm.newHeapSize }}
|
|
- name: HEAP_NEWSIZE
|
|
value: {{ .Values.jvm.newHeapSize | quote }}
|
|
{{- end }}
|
|
{{- if .Values.jvm.extraOpts }}
|
|
- name: JVM_EXTRA_OPTS
|
|
value: {{ .Values.jvm.extraOpts | quote }}
|
|
{{- end }}
|
|
- name: CASSANDRA_ENABLE_RPC
|
|
value: {{ .Values.cluster.enableRPC | quote }}
|
|
{{- if .Values.cluster.enableUDF }}
|
|
- name: CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS
|
|
value: {{ .Values.cluster.enableUDF | quote }}
|
|
{{- end }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
exec:
|
|
command: ["/bin/sh", "-c", "nodetool status"]
|
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
exec:
|
|
command: ["/bin/sh", "-c", "nodetool status | grep -E \"^UN\\s+${POD_IP}\""]
|
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
|
{{- end }}
|
|
{{- if not .Values.persistence.enabled }}
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- bash
|
|
- -ec
|
|
- nodetool decommission
|
|
{{- end }}
|
|
ports:
|
|
- name: intra
|
|
containerPort: 7000
|
|
- name: tls
|
|
containerPort: 7001
|
|
- name: jmx
|
|
containerPort: 7199
|
|
- name: cql
|
|
containerPort: 9042
|
|
{{- if .Values.cluster.enableRPC }}
|
|
- name: thrift
|
|
containerPort: 9160
|
|
{{- end }}
|
|
{{- if .Values.resources }}
|
|
resources: {{ toYaml .Values.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /bitnami/cassandra
|
|
{{- if .Values.tlsEncryptionSecretName }}
|
|
- name: encryption-secrets
|
|
mountPath: /bitnami/cassandra/secrets
|
|
{{- end }}
|
|
{{- if .Values.initDBConfigMap }}
|
|
- name: init-db-cm
|
|
mountPath: /docker-entrypoint-initdb.d/configmap
|
|
{{- end }}
|
|
{{- if .Values.initDBSecret }}
|
|
- name: init-db-secret
|
|
mountPath: /docker-entrypoint-initdb.d/secret
|
|
{{- end }}
|
|
{{ if .Values.existingConfiguration }}
|
|
- name: configurations
|
|
mountPath: /bitnami/cassandra/conf
|
|
{{- end }}
|
|
- mountPath: /opt/tip-wlan/certs/cacert.pem
|
|
name: cassandra-client-certificates
|
|
subPath: cacert.pem
|
|
- mountPath: /opt/tip-wlan/certs/cassandraservercert.pem
|
|
name: cassandra-client-certificates
|
|
subPath: cassandraservercert.pem
|
|
- mountPath: /opt/tip-wlan/certs/cassandraserverkey_dec.pem
|
|
name: cassandra-client-certificates
|
|
subPath: cassandraserverkey_dec.pem
|
|
{{- if .Values.metrics.enabled }}
|
|
- name: metrics
|
|
image: {{ include "cassandra.metrics.image" . }}
|
|
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
|
ports:
|
|
- name: metrics
|
|
containerPort: 8080
|
|
protocol: TCP
|
|
- name: jmx
|
|
containerPort: 5555
|
|
{{- if .Values.metrics.resources }}
|
|
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
|
{{- end }}
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: metrics
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /metrics
|
|
port: metrics
|
|
initialDelaySeconds: 20
|
|
timeoutSeconds: 45
|
|
{{- end }}
|
|
{{- if .Values.image.pullSecrets }}
|
|
imagePullSecrets:
|
|
- name: {{ .Values.image.pullSecrets }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: cassandra-client-certificates
|
|
secret:
|
|
secretName: {{ include "common.fullname" . }}-client-certs
|
|
{{- if .Values.tlsEncryptionSecretName }}
|
|
- name: encryption-secrets
|
|
secret:
|
|
secretName: {{ .Values.tlsEncryptionSecretName }}
|
|
items:
|
|
- key: keystore
|
|
path: keystore
|
|
- key: truststore
|
|
path: truststore
|
|
{{- end }}
|
|
{{- if .Values.existingConfiguration }}
|
|
- name: configurations
|
|
configMap:
|
|
name: {{ tpl .Values.existingConfiguration $ }}
|
|
{{- end }}
|
|
{{- if .Values.initDBConfigMap }}
|
|
- name: init-db-cm
|
|
configMap:
|
|
name: {{ tpl .Values.initDBConfigMap $ }}
|
|
{{- end }}
|
|
{{- if .Values.initDBSecret }}
|
|
- name: init-db-secret
|
|
configMap:
|
|
name: {{ tpl .Values.initDBSecret $ }}
|
|
{{- end }}
|
|
{{- if not .Values.persistence.enabled }}
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- else }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
app: {{ include "common.name" . }}
|
|
release: {{ .Release.Name }}
|
|
{{- if .Values.persistence.annotations }}
|
|
annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes:
|
|
{{- range .Values.persistence.accessModes }}
|
|
- {{ . | quote }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.persistence.size | quote }}
|
|
{{- if .Values.persistence.storageClass }}
|
|
{{- if (eq "-" .Values.persistence.storageClass) }}
|
|
storageClassName: ""
|
|
{{- else }}
|
|
storageClassName: "{{ .Values.persistence.storageClass }}"
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|