fix(operator): validate immutable PVC template fields#197
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6723c5aa9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .and_then(|resources| resources.requests.as_ref()) | ||
| .and_then(|requests| requests.get("storage")); | ||
|
|
||
| if existing_storage != desired_storage { |
There was a problem hiding this comment.
Compare PVC storage quantities semantically
When a Tenant was created with a non-canonical but valid storage quantity such as 1024Mi or 1.5Gi, Kubernetes stores and returns Quantity values in canonical form (for example, 1.5Gi becomes 1536Mi). This raw Quantity string comparison then treats the persisted StatefulSet and the unchanged Tenant spec as different, so every later reconcile or safe update (image, resources, TLS, etc.) is blocked with ImmutableFieldModified even though the storage size did not change. Parse/canonicalize both quantities before deciding the immutable field was modified.
Useful? React with 👍 / 👎.
Type of Change
Related Issues
Summary of Changes
volumeClaimTemplates[].spec.resources.requests.storagebefore applying a StatefulSet update.volumeClaimTemplates[].spec.accessModesalongside the existing StorageClass validation.ImmutableFieldModifiederrors that flow through the existingStatefulSetUpdateBlockedevent path.The previous validation only compared template count, names, and StorageClass. Storage request and access mode changes reached the Kubernetes API, which rejected the immutable StatefulSet update with a lower-level error and caused repeated reconcile failures.
Checklist
make pre-commit(fmt-check + clippy + test + console-lint + console-fmt-check)[Unreleased](N/A: this repository does not currently containCHANGELOG.md)Impact
Verification
Additional Notes
The change is limited to the existing StatefulSet update validation path and its user documentation. It does not alter reconciliation state handling or introduce new dependencies.
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.