Skip to content

Commit e999ac2

Browse files
committed
chore(redis): add redis persistence
1 parent 4b240f7 commit e999ac2

4 files changed

Lines changed: 50 additions & 15 deletions

File tree

charts/redis/templates/redis-statefulset.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,45 @@ spec:
2222
- name: drycc-redis
2323
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/redis:{{ .Values.imageTag }}
2424
imagePullPolicy: {{ .Values.imagePullPolicy }}
25-
{{- if or (.Values.limitsCpu) (.Values.limitsMemory)}}
25+
{{- if or (.Values.limitsCpu) (.Values.limitsMemory)}}
2626
resources:
2727
limits:
28-
{{- if (.Values.limitsCpu) }}
28+
{{- if (.Values.limitsCpu) }}
2929
cpu: {{.Values.limitsCpu}}
30-
{{- end}}
31-
{{- if (.Values.limitsMemory) }}
30+
{{- end}}
31+
{{- if (.Values.limitsMemory) }}
3232
memory: {{.Values.limitsMemory}}
33-
{{- end}}
34-
{{- end}}
33+
{{- end}}
34+
{{- end}}
3535
command: ["/bin/boot", "--port", "6379"]
3636
ports:
3737
- containerPort: 6379
3838
volumeMounts:
3939
- name: redis-creds
4040
mountPath: /var/run/secrets/drycc/redis/creds
41+
{{- if .Values.persistence.enabled }}
42+
- name: redis-data
43+
mountPath: /data
44+
{{- end }}
4145
volumes:
4246
- name: redis-creds
4347
secret:
4448
secretName: redis-creds
49+
{{- if .Values.persistence.enabled }}
50+
volumeClaimTemplates:
51+
- metadata:
52+
name: redis-data
53+
spec:
54+
accessModes: [ "ReadWriteOnce" ]
55+
{{- if .Values.persistence.storageClass }}
56+
{{- if (eq "-" .Values.persistence.storageClass) }}
57+
storageClassName: ""
58+
{{- else }}
59+
storageClassName: "{{ .Values.persistence.storageClass }}"
60+
{{- end }}
61+
{{- end }}
62+
resources:
63+
requests:
64+
storage: {{ .Values.persistence.size | quote }}
65+
{{- end }}
4566
{{- end }}

charts/redis/values.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ imageRegistry: "docker.io"
55
# limitsCpu: "100m"
66
# limitsMemory: "50Mi"
77

8-
global:
9-
# Set the location of Workflow's redis instance
10-
#
11-
# Valid values are:
12-
# - on-cluster: Run Redis within the Kubernetes cluster
13-
# - off-cluster: Run Redis outside the Kubernetes cluster (configure in redis section)
14-
redisLocation: "on-cluster"
15-
168
# The following parameters are configured only when using an on-cluster Redis instance
179
replicas: 1
1810

1911
# The following parameters are configured only when using an off-cluster Redis instance
2012
addrs: "" # A list of clusters: "127.0.0.1:7001/1,127.0.0.2:7002/1"
2113
password: "redis password" # "" == no password
14+
# GCP PDs and EBS volumes are supported only
15+
persistence:
16+
enabled: false # Set to true to enable persistence
17+
size: 5Gi
18+
storageClass: ""
19+
20+
global:
21+
# Set the location of Workflow's redis instance
22+
#
23+
# Valid values are:
24+
# - on-cluster: Run Redis within the Kubernetes cluster
25+
# - off-cluster: Run Redis outside the Kubernetes cluster (configure in redis section)
26+
redisLocation: "on-cluster"

rootfs/bin/boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ REDIS_PASSWORD_FILE=/var/run/secrets/drycc/redis/creds/password
99
if [ -e $REDIS_PASSWORD_FILE ]; then
1010
REDIS_PASSWORD="$(cat /var/run/secrets/drycc/redis/creds/password)"
1111
if [ -n "$REDIS_PASSWORD" ]; then
12-
echo "requirepass $REDIS_PASSWORD" >> $REDIS_CONFIG_FILE
12+
printf "\nrequirepass %s" "$REDIS_PASSWORD" >> $REDIS_CONFIG_FILE
1313
fi
1414
fi
1515

rootfs/etc/redis/redis.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
daemonize no
22
bind 0.0.0.0
33
logfile ""
4+
5+
save 900 1
6+
save 300 10
7+
save 60 1000
8+
9+
appendonly yes
10+
auto-aof-rewrite-percentage 100
11+
auto-aof-rewrite-min-size 64mb
12+
appendfsync everysec

0 commit comments

Comments
 (0)