77 lines
2.3 KiB
YAML
77 lines
2.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "redis.fullname" . }}
|
|
labels:
|
|
{{- include "redis.labels" . | nindent 4 }}
|
|
spec:
|
|
serviceName: {{ include "redis.fullname" . }}-headless
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
{{- include "redis.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "redis.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
containers:
|
|
- name: redis
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
ports:
|
|
- name: redis
|
|
containerPort: 6379
|
|
protocol: TCP
|
|
command:
|
|
- redis-server
|
|
- /etc/redis/redis.conf
|
|
- "--requirepass"
|
|
- "$(REDIS_PASSWORD)"
|
|
env:
|
|
- name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "redis.fullname" . }}
|
|
key: REDIS_PASSWORD
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
- name: config
|
|
mountPath: /etc/redis/redis.conf
|
|
subPath: redis.conf
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- redis-cli --no-auth-warning -a $REDIS_PASSWORD ping | grep PONG
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 10
|
|
failureThreshold: 6
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- redis-cli --no-auth-warning -a $REDIS_PASSWORD ping | grep PONG
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "redis.fullname" . }}-data
|
|
- name: config
|
|
configMap:
|
|
name: {{ include "redis.fullname" . }}-config
|
|
- name: tmp
|
|
emptyDir: {}
|