# Design Proposal: Persistent Volume Support for Valkey Operator #88
umar-riswan-ap
started this conversation in
Design proposal
Replies: 1 comment
-
|
Thanks for raising this! I have some comments on the design.
Some of these problems have already been considered in the ValkeyNode CRD, whereby setting these fields would:
I'd like to hold off on this implementation until the ValkeyNode work lands first, I'm hoping to get to that next week. I'll leave volume persistence out of that PR so we have room to keep discussing the right approach in this discussion. How does that sound? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This proposal introduces persistent volume support and automatic online volume expansion to the Valkey Operator, enabling data persistence across pod restarts and dynamic storage scaling without downtime. The implementation transitions from Deployments to StatefulSets with PersistentVolumeClaims, allowing production-ready Valkey clusters with durable storage and declarative capacity management.
Motivation
Currently, the Valkey Operator manages ephemeral clusters using Deployments with emptyDir volumes. This approach has significant limitations:
This limits the operator's usability for:
Proposed Solution
With this change, users will be able to:
Detailed Design
API Changes
Add a new
StorageSpecto the ValkeyCluster CRD:New Fields:
storage.enabled(bool): Toggle persistent storage (default: false, maintains backward compatibility)storage.storageClassName(string, optional): StorageClass name (uses cluster default if omitted)storage.size(string): Volume size in Kubernetes quantity format (e.g., "1Gi", "100Mi")storage.accessModes([]string, optional): PVC access modes (default: ["ReadWriteOnce"])volumePermissions(bool, optional): Enable init container to fix volume permissions (default: false)New Status Conditions:
Architecture
Transition: Deployment → StatefulSet
When
storage.enabled=true, the operator creates StatefulSets instead of Deployments:valkey-xyz123)valkey-0-0)Benefits of StatefulSets:
How It Works
1. Cluster Creation with Persistent Storage
When a user creates a ValkeyCluster with
storage.enabled=true:/datavolumePermissions=true2. Volume Expansion (Zero Downtime)
When a user increases
storage.size:Flow:
allowVolumeExpansion: trueResizing→Ready)VolumeExpandedTimeline: ~30-60 seconds per volume (tested on AWS EBS gp3)
3. Components Involved
New Files:
internal/controller/volume_expansion.go- Core expansion logichandleVolumeExpansion()- Detects size changes and patches PVCsverifyStorageClassSupportsExpansion()- Validates StorageClasscheckVolumeExpansionStatus()- Monitors expansion progressModified Files:
api/v1alpha1/valkeycluster_types.go- Add StorageSpec and status reasonsinternal/controller/valkeycluster_controller.go- Integrate expansion checksconfig/rbac/role.yaml- Add PVC and StorageClass permissionsRBAC Permissions (New):
User Interaction
Creating a Persistent Cluster
Monitoring Storage Status
Expanding Storage
Storage Provider Requirements
Prerequisites:
allowVolumeExpansion: trueExample StorageClass (AWS EBS):
API Changes
No response
User Stories
No response
Alternatives Considered
No response
Backward Compatibility
No response
Testing Strategy
No response
Open Questions
No response
References
PR raised for the same : #85
Implementation
Beta Was this translation helpful? Give feedback.
All reactions