Skip to content

Commit

Permalink
Redis persistent volume (eclipse-symphony#362)
Browse files Browse the repository at this point in the history
Co-authored-by: Jiawei Du <59427055+msftcoderdjw@users.noreply.github.com>
  • Loading branch information
2 people authored and linyguo committed Jul 31, 2024
1 parent 1aa1992 commit f370771
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/helm/symphony/templates/redis-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ data:
redis.conf: |
protected-mode {{ include "symphony.protectedMode" . }}
port {{ .Values.redis.port }}
appendonly yes
appendfsync always
dir data
appenddirname appendonlydir
24 changes: 24 additions & 0 deletions packages/helm/symphony/templates/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
{{- if and .Values.redis.enabled .Values.redis.persistentVolume.enabled}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-pvc
namespace: {{ .Release.Namespace }}
spec:
storageClassName: {{ .Values.redis.persistentVolume.storageclass }}
accessModes:
- {{ .Values.redis.persistentVolume.accessMode }}
resources:
requests:
storage: {{ .Values.redis.persistentVolume.size }}
{{- end }}
---
{{- if and .Values.redis.enabled (not .Values.redis.asSidecar)}}
apiVersion: apps/v1
kind: Deployment
Expand All @@ -24,13 +39,22 @@ spec:
volumeMounts:
- name: redis-config
mountPath: /usr/var/redis
{{- if .Values.redis.persistentVolume.enabled }}
- name: redis-data
mountPath: /data
{{- end }}
volumes:
- name: redis-config
configMap:
name: redis-config-map
items:
- key: redis.conf
path: redis.conf
{{- if .Values.redis.persistentVolume.enabled }}
- name: redis-data
persistentVolumeClaim:
claimName: redis-pvc
{{- end }}
---
apiVersion: v1
kind: Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ spec:
volumeMounts:
- name: redis-config
mountPath: /usr/var/redis
{{- if .Values.redis.persistentVolume.enabled }}
- name: redis-data
mountPath: /data
{{- end }}
{{- end}}
{{- if .Values.global.azure.identity.mSIAdapterYaml }}
- name: msi-adapter
Expand Down Expand Up @@ -123,4 +127,9 @@ spec:
items:
- key: redis.conf
path: redis.conf
{{- if .Values.redis.persistentVolume.enabled }}
- name: redis-data
persistentVolumeClaim:
claimName: redis-pvc
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions packages/helm/symphony/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ redis:
asSidecar: false
image: redis/redis-stack-server:latest
port: 6379
persistentVolume:
enabled: false
storageclass:
accessMode: ReadWriteOnce
size: 1Gi
kubeRbacProxy:
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
parent:
Expand Down

0 comments on commit f370771

Please sign in to comment.