[patch] Delete and recreate config-pvc when storage class changes on upgrade - #468
Merged
Conversation
added 11 commits
August 6, 2026 20:37
…o complete before recreating
…s in a retry loop
Bhautik-Vala
approved these changes
Aug 21, 2026
whitfiea
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
mas upgraderuns and aconfig-pvcalready exists in the pipelines namespace (created during a previous installation) with a differentstorageClassNamethan what the upgrade detects,preparePipelinesNamespace()called
applyResource()which attempted to patch the existing PVC with the new storage class. Kubernetes rejects this with a422 Unprocessable Entityerror becausestorageClassNameis an immutable field on a PVC — it cannot be changed after creation. This caused the upgrade pipeline to never launch.Root Cause
In
python-devops/src/mas/devops/tekton.py,preparePipelinesNamespace()blindly calledapplyResource()without first checking whether the existingconfig-pvchad a different storage class. When the storage class differed, the patch hit the Kubernetes immutability constraint and failed hard, blocking the entire upgrade.Solution
Before calling
applyResource()to create theconfig-pvc, the storage class of any existing PVC is now compared against the detected storage class:The force-delete handles the PVC regardless of its current state (
Bound,Lost, orTerminating) by applying all unblocking steps each iteration:claimRef— sets allclaimReffields to empty strings (notnull—nullis ignored when the PVC already has adeletionTimestamp). This moves the PVC fromBound→Lost, causingPVCProtectionControllerto drop thepvc-protectionfinalizer voluntarily.Terminating.Bound.The loop retries up to 30 times until the PVC is confirmed gone. The orphaned PV is also deleted afterwards to prevent accumulation across upgrades.
Files Changed
python-devopssrc/mas/devops/tekton.pyTesting
Verified on a fyre cluster upgrading MAS
9.0.x→9.1.xwithconfig-pvcbound toocs-storagecluster-cephfsand upgrade detectingnfs-clientas the default storage class. Pipeline previously failed atPreparing namespacewith a422error. With this fix,config-pvcwas deleted and recreated with the correct storage class and the upgrade pipeline launched successfully.Acceptance Criteria
mas upgradelaunches the pipeline without error whenconfig-pvcexists with a different storage class than the detected defaultconfig-pvcis not deleted when the storage class already matchesconfig-pvcis recreated with the correct storage class when it differsconfig-pvcdoes not yet exist