apiVersion: apps/v1 kind: StatefulSet metadata: labels: app: CHANGE_ME app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: valkey app.kubernetes.io/part-of: valkey app.kubernetes.io/version: 8.1.3 name: valkey-node spec: persistentVolumeClaimRetentionPolicy: whenDeleted: Retain whenScaled: Retain podManagementPolicy: OrderedReady # DO NOT CHANGE THIS LINE HERE, USE THE VARIABLE VALKEY_REPLICAS INSTEAD replicas: 4 # END OF DO NOT CHANGE THIS LINE revisionHistoryLimit: 10 selector: matchLabels: app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/name: valkey app: CHANGE_ME serviceName: valkey-headless updateStrategy: type: RollingUpdate template: metadata: labels: app: CHANGE_ME app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: valkey app.kubernetes.io/version: 8.1.3 helm.sh/chart: valkey-3.0.7 spec: shareProcessNamespace: true affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: labelSelector: matchLabels: app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/name: valkey topologyKey: kubernetes.io/hostname weight: 1 automountServiceAccountToken: false initContainers: - name: copy-config-templates image: reg.cadoles.com/dh/library/busybox:1.37.0-musl command: - /bin/cp args: - -R - /templates - /tmp/ imagePullPolicy: IfNotPresent resources: limits: cpu: 100m memory: 128Mi requests: cpu: 100m memory: 128Mi volumeMounts: - mountPath: /templates/replication.conf.orig name: valkey-config subPath: replication.conf.tpl - mountPath: /templates/sentinel.conf.orig name: valkey-config subPath: sentinel.conf.tpl - mountPath: /tmp name: tmp - mountPath: /data name: valkey-data - name: generate-config image: reg.cadoles.com/cadoles/gotemplate:0.0.6-dev imagePullPolicy: IfNotPresent args: - --source - /tmp/templates - --target - /etc/valkey/ - --no-overwrite - replication.conf.orig - sentinel.conf.orig envFrom: - configMapRef: name: valkey-env resources: limits: cpu: 100m memory: 128Mi requests: cpu: 100m memory: 128Mi volumeMounts: - mountPath: /etc/valkey/ name: valkey-etc - mountPath: /tmp name: tmp - mountPath: /data name: valkey-data containers: - name: valkey image: reg.cadoles.com/dh/valkey/valkey:8.1.3-alpine3.22 command: - /opt/scripts/start-node.sh args: - /etc/valkey/replication.conf imagePullPolicy: IfNotPresent env: - name: VALKEY_ROLE value: "replication" envFrom: - configMapRef: name: valkey-env lifecycle: preStop: exec: command: - /bin/sh - -c - /opt/scripts/pre-stop.sh livenessProbe: exec: command: - sh - -c - /opt/scripts/liveness-local.sh 5 failureThreshold: 5 initialDelaySeconds: 20 periodSeconds: 5 successThreshold: 1 timeoutSeconds: 5 ports: - containerPort: 6379 name: valkey protocol: TCP readinessProbe: exec: command: - sh - -c - /opt/scripts/readiness-local.sh 1 failureThreshold: 5 initialDelaySeconds: 20 periodSeconds: 5 successThreshold: 1 timeoutSeconds: 1 resources: limits: cpu: 150m memory: 192Mi ephemeral-storage: 2Gi requests: cpu: 100m memory: 128Mi ephemeral-storage: 50Mi securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL readOnlyRootFilesystem: true runAsGroup: 1001 runAsNonRoot: true runAsUser: 1001 seLinuxOptions: {} seccompProfile: type: RuntimeDefault startupProbe: exec: command: - sh - -c - /opt/scripts/liveness-local.sh 5 failureThreshold: 22 initialDelaySeconds: 10 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /etc/valkey/ name: valkey-etc - mountPath: /opt/scripts name: valkey-scripts - mountPath: /data name: valkey-data - name: sentinel image: reg.cadoles.com/dh/valkey/valkey:8.1.3-alpine3.22 imagePullPolicy: IfNotPresent command: - /opt/scripts/startSentinel.sh env: - name: ALLOW_EMPTY_PASSWORD value: "yes" - name: VALKEY_SENTINEL_TLS_ENABLED value: "no" envFrom: - configMapRef: name: valkey-env lifecycle: preStop: exec: command: - /bin/bash - -c - /opt/scripts/pre-stop-sentinel.sh livenessProbe: exec: command: - sh - -c - /opt/scripts/ping-sentinel.sh 5 failureThreshold: 6 initialDelaySeconds: 20 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 ports: - containerPort: 26379 name: valkey-sentinel protocol: TCP readinessProbe: exec: command: - sh - -c - /opt/scripts/ping-sentinel.sh 5 failureThreshold: 6 initialDelaySeconds: 20 periodSeconds: 5 successThreshold: 1 timeoutSeconds: 1 resources: limits: cpu: 150m ephemeral-storage: 2Gi memory: 192Mi requests: cpu: 100m ephemeral-storage: 50Mi memory: 128Mi securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL readOnlyRootFilesystem: true runAsGroup: 1001 runAsNonRoot: true runAsUser: 1001 seLinuxOptions: {} seccompProfile: type: RuntimeDefault startupProbe: exec: command: - sh - -c - /opt/scripts/ping-sentinel.sh 5 failureThreshold: 22 initialDelaySeconds: 10 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /opt/scripts name: valkey-scripts - mountPath: /etc/valkey/ name: valkey-etc dnsPolicy: ClusterFirst enableServiceLinks: true restartPolicy: Always schedulerName: default-scheduler securityContext: runAsUser: 1001 runAsNonRoot: true runAsGroup: 1001 fsGroup: 1001 fsGroupChangePolicy: Always #serviceAccount: valkey #serviceAccountName: valkey terminationGracePeriodSeconds: 30 volumes: - name: valkey-scripts configMap: defaultMode: 493 name: valkey-scripts - name: valkey-config configMap: defaultMode: 420 name: valkey-config - emptyDir: sizeLimit: 64Mi medium: Memory name: tmp volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim metadata: creationTimestamp: null labels: app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/name: valkey name: valkey-data spec: accessModes: - ReadWriteOnce resources: requests: storage: 8Gi - apiVersion: v1 kind: PersistentVolumeClaim metadata: creationTimestamp: null labels: app.kubernetes.io/component: node app.kubernetes.io/instance: valkey app.kubernetes.io/name: valkey name: valkey-etc spec: accessModes: - ReadWriteOnce resources: requests: storage: 32Mi