Skip to content

fix(operator): validate immutable PVC template fields#197

Open
GatewayJ wants to merge 1 commit into
rustfs:mainfrom
GatewayJ:fix/issue-1085-volume-claim-template-validation
Open

fix(operator): validate immutable PVC template fields#197
GatewayJ wants to merge 1 commit into
rustfs:mainfrom
GatewayJ:fix/issue-1085-volume-claim-template-validation

Conversation

@GatewayJ

Copy link
Copy Markdown
Member

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

  • rustfs/backlog#1085

Summary of Changes

  • Detect changes to volumeClaimTemplates[].spec.resources.requests.storage before applying a StatefulSet update.
  • Detect changes to volumeClaimTemplates[].spec.accessModes alongside the existing StorageClass validation.
  • Return actionable ImmutableFieldModified errors that flow through the existing StatefulSetUpdateBlocked event path.
  • Document that PVC template storage, access modes, and StorageClass are immutable and that capacity should be expanded by adding a pool.

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

  • I have read and followed the CONTRIBUTING.md guidelines
  • Passed make pre-commit (fmt-check + clippy + test + console-lint + console-fmt-check)
  • Added/updated necessary tests
  • Documentation updated (if needed)
  • CHANGELOG.md updated under [Unreleased] (N/A: this repository does not currently contain CHANGELOG.md)
  • CI/CD passed (pending)

Impact

  • Breaking change (CRD/API compatibility)
  • Requires doc/config/deployment update
  • Other impact: invalid StatefulSet PVC template updates are blocked before the apply call with an actionable warning event.

Verification

make pre-commit

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.

@GatewayJ

Copy link
Copy Markdown
Member Author

@codex

@GatewayJ
GatewayJ marked this pull request as ready for review July 22, 2026 13:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant