-
Notifications
You must be signed in to change notification settings - Fork 116
Add pvc/namespace labels to cloned csi volumes #2176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
csi/controller.go
Outdated
| return nil, err | ||
| } | ||
|
|
||
| _, err = volumes.Update(ctx, &api.SdkVolumeUpdateRequest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
volumes.Clone calls driver.Snapshot, which removes pvc/namespace labels to avoid misuse. Another possible fix is to change driver.Snapshot to take additional pvc/namespace parameters, but the fix in this PR is far less invasive for a patch.
csi/controller.go
Outdated
| Labels: getClonedPVCMetadata(locator), | ||
| }) | ||
| if err != nil { | ||
| return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any need to cleanup the cloned volume before returning an error from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, will add this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer an issue since we're handling at the sdk layer
csi/controller.go
Outdated
|
|
||
| _, err = volumes.Update(ctx, &api.SdkVolumeUpdateRequest{ | ||
| VolumeId: cloneResp.GetVolumeId(), | ||
| Labels: getClonedPVCMetadata(locator), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to worry about merging with the existing labels instead of overwriting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
volumes.Updates code suggests we don't, but I'll merge them here to be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, going to move this to the SDK layer to handle this more broadly. will re-request review then.
e783178 to
f3b8b2a
Compare
8c96be1 to
2d5f4e7
Compare
|
test results: |
api/server/sdk/volume_ops.go
Outdated
| // Cloned volume may not have locator or volume. | ||
| // This is unlikely, but we'll avoid a panic here. | ||
| if clone.GetVolume() != nil && clone.GetVolume().GetLocator() != nil && | ||
| clone.GetVolume().GetLocator().GetVolumeLabels() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the last check on line 206 is not needed since clonedLabels will just be nil on line 207 which is ok.
Signed-off-by: Grant Griffiths <[email protected]>
2d5f4e7 to
ab419c0
Compare
Signed-off-by: Grant Griffiths <[email protected]>
|
This pull request cannot be automatically cherry-picked to the target release branch. |
Signed-off-by: Grant Griffiths <[email protected]>
Signed-off-by: Grant Griffiths <[email protected]>
Signed-off-by: Grant Griffiths <[email protected]>
Signed-off-by: Grant Griffiths [email protected]
What this PR does / why we need it:
Which issue(s) this PR fixes (optional)
Closes #
Special notes for your reviewer: