Skip to content
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

Update CnsFileVolumeClient instance even if VM and PVC is deleted, so that finalizer gets removed and eventually instance also gets deleted #3186

Conversation

vdkotkar
Copy link
Contributor

@vdkotkar vdkotkar commented Feb 7, 2025

What this PR does / why we need it:
While testing the changes made through #3151, found the following case where CnsFileVolumeClient CR cleanup was not happening:
If CnsFileAccessConfig is marked for deletion (e.g. as part of namespace deletion) and VM got already deleted, then we added a code to fetch VM IP from CnsFileVolumeClient instance and process the deletion of CnsFileAccessConfig. But if PVC is also deleted, then we were skipping the complete code flow to update configureVolumeACL and CnsFileVolumeClient. As a side effect, finaliser was not getting removed and CnsFileVolumeClient instance was remaining in the namespace forever.

Made code changes to just skip configureVolumeACL call if PVC is not found, so that CnsFileVolumeClient gets updated and finaliser is also removed from it and eventually instance gets deleted as expected.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Testing done:
Created couple of file volume PVCs and pods using these PVCs. Later performed namespace deletion operation from VC UI.
namespace deletion succeeded without any error.

# k get ns test
Error from server (NotFound): namespaces "test" not found

Here are syncer logs which confirms that newly added code is fixing the issue:

{"level":"error","time":"2025-02-07T10:08:33.631745559Z","caller":"cnsfileaccessconfig/util.go:47","msg":"Failed to get virtualmachine instance for the VM with name: \"test-cluster-e2e-script-node-pool-1-sx855-qpv46-n857d\". Error: virtualmachines.vmoperator.vmware.com \"test-cluster-e2e-script-node-pool-1-sx855-qpv46-n857d\" not found"

{"level":"info","time":"2025-02-07T10:08:33.631850475Z","caller":"cnsfileaccessconfig/cnsfileaccessconfig_controller.go:252","msg":"CnsFileAccessConfig instance \"test-cluster-e2e-script-node-pool-1-sx855-qpv46-n857d-66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b\" has deletion timestamp set, but VM instance with name \"test-cluster-e2e-script-node-pool-1-sx855-qpv46-n857d\" is not found. Processing the deletion of CnsFileAccessConfig instance."}

{"level":"error","time":"2025-02-07T10:08:33.633597616Z","caller":"util/util.go:76","msg":"failed to get PVC with volumename: \"66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b\" on namespace: \"test\". Err: PersistentVolumeClaim \"66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b\" not found"

{"level":"info","time":"2025-02-07T10:08:33.650862087Z","caller":"cnsfilevolumeclient/cnsfilevolumeclient.go:249","msg":"Removing clientVM test-cluster-e2e-script-node-pool-1-sx855-qpv46-n857d from cnsfilevolumeclient test/66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b list for IP address 166.168.16.50"}

{"level":"info","time":"2025-02-07T10:08:33.667030895Z","caller":"cnsfilevolumeclient/cnsfilevolumeclient.go:291","msg":"Deleting cnsfilevolumeclient instance test/66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b from API server"}

{"level":"info","time":"2025-02-07T10:08:33.741917885Z","caller":"cnsfilevolumeclient/cnsfilevolumeclient.go:305","msg":"cnsfilevolumeclient instance test/66e0375d-f1bf-406e-9177-06201263e785-08db14ae-25b5-41b4-a45d-3d446ad6fc6b seems to be already deleted."}

{"level":"info","time":"2025-02-07T10:08:33.825037102Z","caller":"cnsfileaccessconfig/cnsfileaccessconfig_controller.go:225","msg":"CnsFileAccessConfig resource not found. Ignoring since object must be deleted."}

Special notes for your reviewer:

Release note:

Update CnsFileVolumeClient instance even if VM and PVC is deleted, so that finalizer gets removed and eventually instance also gets deleted

… that finalizer gets removed and eventually instance also gets deleted
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 7, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @vdkotkar. 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.

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 7, 2025
@akankshapanse
Copy link
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 Feb 7, 2025
Copy link
Member

@divyenpatel divyenpatel left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 7, 2025
@divyenpatel
Copy link
Member

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyenpatel, vdkotkar

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

The pull request process is described here

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

@vdkotkar
Copy link
Contributor Author

vdkotkar commented Feb 8, 2025

/test pull-vsphere-csi-driver-unit-test

@k8s-ci-robot k8s-ci-robot merged commit bbd75a5 into kubernetes-sigs:master Feb 8, 2025
12 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants