Skip to content

[redis] Expose persistence mode configuration (RDB/AOF)#2341

Open
officialasishkumar wants to merge 1 commit intocozystack:mainfrom
officialasishkumar:feat/redis-persistence-mode
Open

[redis] Expose persistence mode configuration (RDB/AOF)#2341
officialasishkumar wants to merge 1 commit intocozystack:mainfrom
officialasishkumar:feat/redis-persistence-mode

Conversation

@officialasishkumar
Copy link
Copy Markdown

@officialasishkumar officialasishkumar commented Apr 6, 2026

What this PR does

Adds a persistenceMode parameter to the Redis chart that lets users choose their data persistence strategy. The value controls which customConfig entries are injected into the RedisFailover CR.

Mode Description customConfig entries
rdb (default) Periodic RDB snapshots (none — uses operator defaults)
aof Append-only file save "", appendonly yes, appendfsync everysec
both RDB + AOF appendonly yes, appendfsync everysec
none No persistence appendonly no, save ""

Backward compatibility: The default rdb mode produces identical output to the current chart. When size is empty (no PVC), persistence is always disabled regardless of the mode, matching current behavior.

Changes:

  • values.yaml: new persistenceMode field with JSDoc annotations
  • values.schema.json: schema entry with enum validation
  • templates/redisfailover.yaml: mode-based persistence config logic

Fixes #2156

Release note

[redis] Add persistenceMode parameter (rdb/aof/both/none) to configure the Redis data persistence strategy.

Summary by CodeRabbit

Release Notes

  • New Features
    • Redis persistence strategy is now configurable. Users can select from RDB (default), AOF, both, or no persistence to match their operational requirements.

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]>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Apr 6, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d08daf3b-c2d0-4de8-9713-d11cbcb9b45f

📥 Commits

Reviewing files that changed from the base of the PR and between 38624b7 and 21fa1b4.

📒 Files selected for processing (3)
  • packages/apps/redis/templates/redisfailover.yaml
  • packages/apps/redis/values.schema.json
  • packages/apps/redis/values.yaml

📝 Walkthrough

Walkthrough

This change introduces a persistenceMode configuration parameter to the Redis Helm chart, allowing users to select between RDB snapshots, AOF (Append-Only File), both, or no persistence. The template logic is updated to conditionally emit different Redis persistence directives based on the selected mode and whether storage is configured.

Changes

Cohort / File(s) Summary
Redis Persistence Configuration
packages/apps/redis/values.yaml, packages/apps/redis/values.schema.json, packages/apps/redis/templates/redisfailover.yaml
Added persistenceMode parameter with enum values rdb, aof, both, none (defaulting to rdb). Updated template to conditionally generate Redis persistence directives (save, appendonly, appendfsync) based on selected mode and presence of configured storage size.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 wiggles nose with delight
Redis persists in many ways,
Now hoppy charts choose their days,
RDB snapshots, AOF so true,
Or both together—pick what's for you! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: exposing a persistenceMode configuration parameter to Redis that enables users to choose between RDB, AOF, both, or none.
Linked Issues check ✅ Passed The PR implements all acceptance criteria from issue #2156: persistenceMode field added to values.yaml and values.schema.json, correct customConfig entries generated for each mode (rdb/aof/both/none), default behavior preserved, and persistence disabled when size is absent.
Out of Scope Changes check ✅ Passed All changes are directly within scope: values.yaml, values.schema.json, and redisfailover.yaml template modifications align precisely with implementing the persistenceMode feature requested in issue #2156.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +67 to 74
{{- else if eq $persistenceMode "aof" }}
- save ""
- appendonly yes
- appendfsync everysec
{{- else if eq $persistenceMode "both" }}
- appendonly yes
- appendfsync everysec
{{- end }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
"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.",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis: expose persistence mode configuration (RDB/AOF)

1 participant