From 02c88700f701e72d06b0428f2ba36fd2cc90a5b2 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 22 Jun 2024 19:44:09 -0500 Subject: [PATCH] firefly-iii: Use volume claim template for redis Using a volume claim template to define the persistent volume claim for the Redis pod has two advantages: first, it enables using clustered Redis, if we decide that becomes necessary, and second, it makes deleteing and recreating the volume easier in the case of data corruption. Simply scale down the StatefulSet to 0, delete the PVC, and scale the StatefulSet back up. --- firefly-iii/redis.yaml | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/firefly-iii/redis.yaml b/firefly-iii/redis.yaml index 4084754..a59a3d8 100644 --- a/firefly-iii/redis.yaml +++ b/firefly-iii/redis.yaml @@ -1,22 +1,3 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: redis - namespace: firefly-iii - labels: - app.kubernetes.io/name: redis - app.kubernetes.io/component: redis - app.kubernetes.io/instance: firefly-iii - app.kubernetes.io/part-of: firefly-iii -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2Gi - ---- apiVersion: v1 kind: Service metadata: @@ -75,7 +56,7 @@ spec: runAsUser: 1000 runAsGroup: 1000 volumeMounts: - - name: redisdata + - name: data mountPath: /data subPath: data - name: tmp @@ -83,9 +64,21 @@ spec: securityContext: fsGroup: 1000 volumes: - - name: redisdata - persistentVolumeClaim: - claimName: redis - name: tmp emptyDir: + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: data + labels: + app.kubernetes.io/name: redis + app.kubernetes.io/component: redis + app.kubernetes.io/part-of: firefly-iii + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2G