176 lines
7.0 KiB
YAML
176 lines
7.0 KiB
YAML
{{- if eq (include "valkey.internal.enabled" .) "true" }}
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ template "valkey.appName" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{ include "valkey.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.valkey.internal.clusterSize }}
|
|
serviceName: {{ template "valkey.appName" . }}-headless
|
|
selector:
|
|
matchLabels:
|
|
{{ include "valkey.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.valkey.internal.podAnnotations }}
|
|
annotations:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{ include "valkey.selectorLabels" . | nindent 8 }}
|
|
dplane: valkey
|
|
spec:
|
|
terminationGracePeriodSeconds: {{ .Values.valkey.internal.terminationGracePeriodSeconds }}
|
|
{{- with .Values.global.image.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.valkey.internal.serviceAccount.enabled }}
|
|
serviceAccountName: {{ include "valkey.serviceAccountName" . }}
|
|
{{- end }}
|
|
{{- if .Values.valkey.internal.podSecurityContextEnabled }}
|
|
securityContext: {{ toYaml .Values.valkey.internal.podSecurityContext | nindent 8 }}
|
|
{{- end }}
|
|
|
|
dnsConfig:
|
|
options:
|
|
- name: use-vc
|
|
|
|
containers:
|
|
- name: {{ template "valkey.appName" . }}
|
|
securityContext:
|
|
{{ toYaml .Values.valkey.internal.securityContext | nindent 12 }}
|
|
image: "{{ default .Values.global.image.repository .Values.valkey.internal.image.repository }}/{{ .Values.valkey.internal.image.name }}:{{ .Values.valkey.internal.image.buildTag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
|
|
ports:
|
|
- name: valkey-client
|
|
containerPort: 6379
|
|
- name: valkey-cluster
|
|
containerPort: 16379
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- "/bin/sh"
|
|
- "-c"
|
|
- >
|
|
timeout 40 /scripts/pre-stop.sh || echo 'preStop timeout reached - continuing with shutdown'
|
|
|
|
{{- if .Values.valkey.internal.startupProbe.enabled }}
|
|
startupProbe:
|
|
initialDelaySeconds: {{ .Values.valkey.internal.startupProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.valkey.internal.startupProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.valkey.internal.startupProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.valkey.internal.startupProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.valkey.internal.startupProbe.failureThreshold }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- /scripts/health-check.sh startup {{ .Values.valkey.internal.startupProbe.timeoutSeconds }}
|
|
{{- end }}
|
|
{{- if .Values.valkey.internal.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
initialDelaySeconds: {{ .Values.valkey.internal.livenessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.valkey.internal.livenessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.valkey.internal.livenessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.valkey.internal.livenessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.valkey.internal.livenessProbe.failureThreshold }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- /scripts/health-check.sh liveness {{ .Values.valkey.internal.livenessProbe.timeoutSeconds }}
|
|
{{- end }}
|
|
|
|
{{- if .Values.valkey.internal.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
initialDelaySeconds: {{ .Values.valkey.internal.readinessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.valkey.internal.readinessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.valkey.internal.readinessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.valkey.internal.readinessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.valkey.internal.readinessProbe.failureThreshold }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- /scripts/health-check.sh readiness {{ .Values.valkey.internal.readinessProbe.timeoutSeconds }}
|
|
{{- end }}
|
|
command:
|
|
- "/bin/sh"
|
|
- "-c"
|
|
- >
|
|
/scripts/start-valkey.sh
|
|
env:
|
|
- name: VALKEY_DIR
|
|
value: "{{ .Values.valkey.internal.valkeyDir }}"
|
|
- name: REDISCLI_AUTH
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.common.datagridCredentials.name }}
|
|
key: datagrid_password
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
- name: CLUSTER_SIZE
|
|
value: "{{ .Values.valkey.internal.clusterSize }}"
|
|
- name: REPLICAS_PER_MASTER
|
|
value: "{{ .Values.valkey.internal.replicasPerMaster }}"
|
|
- name: VALKEY_PORT
|
|
value: "6379"
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
resources:
|
|
{{- toYaml .Values.valkey.internal.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- name: {{ .Values.valkey.internal.persistence.claimTemplateName }}
|
|
mountPath: {{ .Values.valkey.internal.valkeyDir }}
|
|
- name: config
|
|
mountPath: /config
|
|
envFrom:
|
|
{{- if .Values.common.email_authentication }}
|
|
- secretRef:
|
|
name: {{ .Values.common.fromMail.name }}
|
|
{{- end }}
|
|
- secretRef:
|
|
name: {{ .Values.common.datagridCredentials.name }}
|
|
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ template "valkey.appName" . }}-config
|
|
|
|
{{- with .Values.valkey.internal.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.valkey.internal.affinity }}
|
|
affinity:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.valkey.internal.tolerations }}
|
|
tolerations:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: {{ .Values.valkey.internal.persistence.claimTemplateName }}
|
|
labels:
|
|
{{ include "valkey.selectorLabels" . | nindent 10 }}
|
|
spec:
|
|
accessModes:
|
|
- {{ .Values.valkey.internal.persistence.claimTemplateAccessModes }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.valkey.internal.persistence.claimTemplateRequestStorage }}
|
|
{{- if .Values.valkey.internal.persistence.claimTemplateStorageClass }}
|
|
storageClassName: {{ .Values.valkey.internal.persistence.claimTemplateStorageClass }}
|
|
{{- end }}
|
|
{{- end }}
|