fix: allow deleting cross-subscription snapshots#2515
fix: allow deleting cross-subscription snapshots#2515andyzhangx merged 2 commits intokubernetes-sigs:masterfrom
Conversation
DeleteSnapshot should try to get subscription ID from snapshot ID before proceeding with deletion to ensure we can delete a snapshot that could have been created under different subscription ID. If a cross-subscription snapshot deletion is attempted without it, the driver will use the default subscription ID and fail with `ResourceGroupNotFound` when `Delete` is executed with file share client. This is relevant only for ARM/Control Plane client authentication.
7583073 to
e856937
Compare
andyzhangx
left a comment
There was a problem hiding this comment.
/hold
/approve cancel
/lgtm cancel
| return nil, status.Error(codes.InvalidArgument, "Snapshot ID must be provided") | ||
| } | ||
| rgName, accountName, fileShareName, _, _, _, err := GetFileShareInfo(req.SnapshotId) //nolint:dogsled | ||
| rgName, accountName, fileShareName, _, _, subsID, err := GetFileShareInfo(req.SnapshotId) //nolint:dogsled |
There was a problem hiding this comment.
unfortunately the snapshot id does not container subs id, e.g.
azurefile-csi-driver-test-201921e8-8897-4f15-9199-d480a5c899fb#f84252b3b42624bd1a4f423#deletesnapshot-volume-1-4da0a823-4cb36f05###default#2025-04-16T13:08:25.0000000Z
I think supporting cross subscription for snapshot is a new feature, need to append subs id in creating snapshot
There was a problem hiding this comment.
I see now...the subs id is there only when the origin pv had it. But that means just adding the subs id to every new snapshot is not sufficient, because there can be existing snapshots without the subs id.
Tried a few ideas today, but not sure how to fix this safely yet.
There was a problem hiding this comment.
@andyzhangx Do you have some estimate on when you'll be able to merge the fix? We're nearing OpenShift 4.19 release and need to decide whether we document a workaround (manual removal) or cherry-pick the fix.
There was a problem hiding this comment.
changing volumeID format is risky, I will only make such change in csi driver v1.33.0, so I think you need to document a workaround (manual removal)
There was a problem hiding this comment.
I see, thank you.
There was a problem hiding this comment.
wait, if sourceVolumeID already contains the subs id, I think my new commit in this PR would fix the issue, it just adds isValidSubscriptionID func to validate whether it's subs id or not, that's quite safe change.
There was a problem hiding this comment.
if test pass, I will cherrypick this change to v1.32 release
|
d21090d to
d5c03c2
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, RomanBednar The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherrypick release-1.32 |
|
@andyzhangx: new pull request created: #2551 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherrypick release-1.31 |
|
@andyzhangx: #2515 failed to apply on top of branch "release-1.31": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
DeleteSnapshot should try to get subscription ID from snapshot ID before proceeding with deletion to ensure we can delete a snapshot that could have been created under different subscription ID.
If a cross-subscription snapshot deletion is attempted without it, the driver will use the default subscription ID and fail with
ResourceGroupNotFoundwhenDeleteis executed with file share client.This is relevant only for ARM/Control Plane client authentication.
What type of PR is this?
/kind bug
What this PR does / why we need it:
See #2514 for details.
This requires source volume id contains subscription id, which means you need to set
subscriptionID: xxxin your storage class to create pvc/pv, by that way, the snapshot id would also contain subscription id:Which issue(s) this PR fixes:
Fixes #2514
Requirements:
Special notes for your reviewer:
With this patch driver can delete the snapshot from different subscription correctly:
Tested on OpenShift only.
Release note: