kubernetes-sigs / vsphere-csi-driver

vSphere storage Container Storage Interface (CSI) plugin
https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/index.html
Apache License 2.0
296 stars 179 forks source link

Ensure creation of StoragePolicyUsage CR in fullSync #2895

Closed shalini-b closed 4 months ago

shalini-b commented 4 months ago

What this PR does / why we need it: While upgrading to 8.0U3, creation of StoragePolicyUsage CR might get skipped for namespaces with no volumes prior to upgrade if for some reason we loose the StoragePolicyQuota Add event. This PR ensures we create StoragePolicyUsage CR for every SC, existing or new.

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: Tested the code in a single supervisor setup. On syncer init, we see the policyQuotaCRAdded handler creating the StoragePolicyUsage for namespaces with no PVCs as well. FullSync tries to create it at the same time but gets an instance already exists error.

Tried deleting a StoragePolicyUsage instance on a namespace with no PVCs and confirmed that fullSync will re-create the CR. Logs:

{"level":"info","time":"2024-05-16T00:24:39.983798672Z","caller":"syncer/metadatasyncer.go:3089","msg":"storagePolicyUsageCRSync: Successfully created the storagePolicyUsage CR \"divyen-thindisk-pvc-usage\" in namespace \"test-ns\"","TraceId":"2b0268e2-ce73-4349-9818-4a389223e05e"}

Special notes for your reviewer:

Release note:

Ensure creation of StoragePolicyUsage CR in fullSync
shalini-b commented 4 months ago

/ok-to-test

xing-yang commented 4 months ago

/approve

k8s-ci-robot commented 4 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyenpatel, shalini-b, xing-yang

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/vsphere-csi-driver/blob/master/OWNERS)~~ [divyenpatel,shalini-b,xing-yang] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment