[redis] Expose persistence mode configuration (RDB/AOF)#2341
[redis] Expose persistence mode configuration (RDB/AOF)#2341officialasishkumar wants to merge 1 commit intocozystack:mainfrom
Conversation
Add a persistenceMode parameter to the Redis chart that allows users to select their data persistence strategy: - rdb (default): periodic RDB snapshots using operator defaults - aof: append-only file with everysec fsync, RDB snapshots disabled - both: AOF with everysec fsync combined with RDB snapshots - none: all persistence disabled The default "rdb" mode preserves the current chart behavior. When no storage is configured (size is empty), persistence is always disabled regardless of the mode setting. Fixes cozystack#2156 Signed-off-by: Asish Kumar <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis change introduces a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds a persistenceMode parameter to the Redis application, enabling users to configure RDB, AOF, both, or no persistence strategies. The review feedback identifies an opportunity to refactor duplicated template logic for AOF settings and suggests aligning the schema description with the values file to ensure documentation consistency.
| {{- else if eq $persistenceMode "aof" }} | ||
| - save "" | ||
| - appendonly yes | ||
| - appendfsync everysec | ||
| {{- else if eq $persistenceMode "both" }} | ||
| - appendonly yes | ||
| - appendfsync everysec | ||
| {{- end }} |
There was a problem hiding this comment.
The AOF configuration (appendonly yes and appendfsync everysec) is duplicated across the aof and both modes. Refactoring this logic to use a shared block improves maintainability and ensures consistency if these settings need to be updated in the future.
{{- else if or (eq $persistenceMode "aof") (eq $persistenceMode "both") }}
{{- if eq $persistenceMode "aof" }}
- save ""
{{- end }}
- appendonly yes
- appendfsync everysec
{{- end }}| ] | ||
| }, | ||
| "persistenceMode": { | ||
| "description": "Persistence strategy. rdb uses periodic snapshots, aof uses append-only file, both enables both, none disables persistence.", |
There was a problem hiding this comment.
The description for persistenceMode in the schema is less detailed than the one provided in values.yaml. It is recommended to keep them consistent to provide clear and comprehensive information to users across all documentation sources.
| "description": "Persistence strategy. rdb uses periodic snapshots, aof uses append-only file, both enables both, none disables persistence.", | |
| "description": "Persistence strategy. rdb uses periodic snapshots (operator defaults), aof uses append-only file with everysec fsync, both enables both strategies, none disables persistence entirely.", |
What this PR does
Adds a
persistenceModeparameter to the Redis chart that lets users choose their data persistence strategy. The value controls whichcustomConfigentries are injected into the RedisFailover CR.rdb(default)aofsave "",appendonly yes,appendfsync everysecbothappendonly yes,appendfsync everysecnoneappendonly no,save ""Backward compatibility: The default
rdbmode produces identical output to the current chart. Whensizeis empty (no PVC), persistence is always disabled regardless of the mode, matching current behavior.Changes:
values.yaml: newpersistenceModefield with JSDoc annotationsvalues.schema.json: schema entry with enum validationtemplates/redisfailover.yaml: mode-based persistence config logicFixes #2156
Release note
Summary by CodeRabbit
Release Notes