Skip to content

Commit 21e218b

Browse files
committed
Keep Redis data across a pod restart
ax-redis had no volume and AOF was off. A pod restart removed every Task record and every task lock, and left the Substrate actors without a Task (google#442). Store /data on a PersistentVolumeClaim, enable AOF with fsync on every write, and use the Recreate strategy because the volume is ReadWriteOnce. The first rollout of this change restarts Redis once.
1 parent ac23328 commit 21e218b

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎deploy/redis.yaml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ metadata:
2727
app.kubernetes.io/part-of: ax
2828
spec:
2929
replicas: 1
30+
# The volume is ReadWriteOnce: stop the old pod before the new one starts.
31+
strategy:
32+
type: Recreate
3033
selector:
3134
matchLabels:
3235
app.kubernetes.io/name: ax-redis
@@ -38,6 +41,8 @@ spec:
3841
containers:
3942
- name: redis
4043
image: redis:7-alpine
44+
# Redis holds all Task state and the task locks. Keep them across a pod restart (#442).
45+
args: ["redis-server", "--appendonly", "yes", "--appendfsync", "always"]
4146
ports:
4247
- containerPort: 6379
4348
name: redis
@@ -48,6 +53,27 @@ spec:
4853
limits:
4954
cpu: 1000m
5055
memory: 1Gi
56+
volumeMounts:
57+
- name: data
58+
mountPath: /data
59+
volumes:
60+
- name: data
61+
persistentVolumeClaim:
62+
claimName: ax-redis-data
63+
---
64+
apiVersion: v1
65+
kind: PersistentVolumeClaim
66+
metadata:
67+
name: ax-redis-data
68+
namespace: ax-system
69+
labels:
70+
app.kubernetes.io/name: ax-redis
71+
app.kubernetes.io/part-of: ax
72+
spec:
73+
accessModes: ["ReadWriteOnce"]
74+
resources:
75+
requests:
76+
storage: 1Gi
5177
---
5278
apiVersion: v1
5379
kind: Service

0 commit comments

Comments
 (0)