Skip to content

Return existing access point if one already exists during create workflow#1620

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
jrakas-dev:use-existing-ap
May 2, 2025
Merged

Return existing access point if one already exists during create workflow#1620
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
jrakas-dev:use-existing-ap

Conversation

@jrakas-dev
Copy link
Copy Markdown
Contributor

@jrakas-dev jrakas-dev commented May 2, 2025

Is this a bug fix or adding new feature?
Bug fix. This addresses an issue that can arise if access points aren't cleanly deleted when the CSI controller crashes, resulting in AccessPointAlreadyExists errors being returned when the controller attempts to recreate the volume.

What is this PR about? / Why do we need it?
This PR modifies the controller to adopt the existing access point in the event that one already happens to exist for the same client token, allowing the PVC creation to succeed.

What testing is done?
Unit tests were added, verified fix against a cluster setup with a reproduction of the issue

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 2, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 2, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @jrakas-dev. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 2, 2025
@jrakas-dev jrakas-dev force-pushed the use-existing-ap branch 4 times, most recently from 4b5703f to b5d049c Compare May 2, 2025 13:25
@dankova22
Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 2, 2025
@jrakas-dev
Copy link
Copy Markdown
Contributor Author

/retest

Comment thread pkg/cloud/cloud.go Outdated
if isAccessDenied(err) {
if isAccessPointAlreadyExists(err) {
klog.V(4).Infof("Access point already exists for client token %s. Retrieving existing access point details.", clientToken)
existingAccessPoint, err := c.FindAccessPointByClientToken(ctx, clientToken, *createAPInput.FileSystemId)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we validate that the access point returned matches exactly the the one we are trying to create? Just as an additional safeguard against FindAccessPointByClientToken returning an access point that doesnt exactly match the one we are trying to create. We could have a wrapper around FindAccessPointByClientToken?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+1

Comment thread pkg/cloud/cloud.go Outdated
if existingAccessPoint == nil {
return nil, fmt.Errorf("No access point for client token %s was returned", clientToken)
}
return existingAccessPoint, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we also verify the Uid, Gid and permission before re-using the existing access point ? I feel there could be a case that we return an access point with wrong permission.

@jrakas-dev jrakas-dev force-pushed the use-existing-ap branch 5 times, most recently from 1d7ca1b to 08d6b56 Compare May 2, 2025 20:33
@dankova22
Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dankova22, jrakas-dev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2025
@k8s-ci-robot k8s-ci-robot merged commit aafc5df into kubernetes-sigs:master May 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants