-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Problem
When a user updates spec.resource.storage.pvcSize on an existing DocumentDB CR, the change is accepted by the API server but never propagated to the underlying CNPG Cluster object or PVCs. The resize is silently ignored.
Verified behavior on Kind cluster:
| Layer | After patching pvcSize from 1Gi to 2Gi |
|---|---|
| DocumentDB CR | Updated to 2Gi |
CNPG Cluster spec.storage.size |
Stayed at 1Gi |
| PVCs | Stayed at 1Gi |
Root cause
In operator/src/internal/controller/physical_replication.go, TryUpdateCluster() returns early (nil, -1) when ReplicaCluster is nil, which is the case for non-replicating clusters. This means storage size changes are never compared or patched on the CNPG Cluster object. Even for replicating clusters, storage is not in the patched field set.
Proposed solution
- In the reconciliation loop, detect when
pvcSizein the DocumentDB CR differs from the current CNPG Cluster'sspec.storage.size - Patch the CNPG Cluster's
spec.storage.sizefield to match the desired size - CNPG will then handle the actual PVC expansion (requires
allowVolumeExpansion: trueon the StorageClass) - Add validation: reject shrink attempts (PVC expansion is one-way)
Files to modify
operator/src/internal/controller/physical_replication.goAdd storage size comparison and patchingoperator/src/internal/controller/documentdb_controller.goEnsure storage changes trigger CNPG cluster update- Consider adding a webhook to reject
pvcSizedecreases
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request