Skip to content

Conversation

@akankshapanse
Copy link
Contributor

@akankshapanse akankshapanse commented Dec 1, 2025

What this PR does / why we need it:
Currently in static volume registeration via CnsRegisterVolume CR, the quota for the static PVC is managed by manually increasing "Reserved" field in associated SPU CR of that namespace & PVC type and then decreasing "Reserved" + increasing "Used" field with capacity to account quota for that PVC. After quota update is done, we mark reconcile as success in CnsRegisterVolume CR by updating status field.
However if the status update on CnsRegisterVolume CR fails, we retry the reconcile and quota gets accounted again in next reconcile cycle for same PVC object. To avoid this, we mark quota update error on CnsRegisterVolume CR and avoid quota update if already done in earlier run.

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:
Unit tests added to cover the scenario with help from cursor, will provide fix to reported, who has been seeing the issue frequently

Unit test log :

# $ go test ./pkg/syncer/cnsoperator/controller/cnsregistervolume/... -ginkgo.focus="updateQuotaInStoragePolicyUsageWithClient function tests" -v
=== RUN   TestCnsRegisterVolumeController
Running Suite: CnsRegisterVolumeController Suite - /home/pansea/csi-src/vsphere-csi-driver/pkg/syncer/cnsoperator/controller/cnsregistervolume
==============================================================================================================================================
Random Seed: 1764594652

Will run 6 of 35 specs

Ran 6 of 35 Specs in 0.004 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 29 Skipped

Special notes for your reviewer:

Release note:

Avoid double quota accounting if last CnsRegisterVolume CR instance status update for success fails

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akankshapanse

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

@k8s-ci-robot k8s-ci-robot added 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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2025
@akankshapanse akankshapanse force-pushed the topic/ap024703/fix_double_quota_counting branch from 2b2ce3c to 39df0af Compare December 1, 2025 06:06
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2025
@akankshapanse akankshapanse force-pushed the topic/ap024703/fix_double_quota_counting branch from 39df0af to 9cd1ebe Compare December 1, 2025 09:42
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2025
@akankshapanse akankshapanse force-pushed the topic/ap024703/fix_double_quota_counting branch from 9cd1ebe to 4e44b7d Compare December 1, 2025 12:50
@akankshapanse akankshapanse force-pushed the topic/ap024703/fix_double_quota_counting branch from 4e44b7d to 4115ce3 Compare December 1, 2025 13:09
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. 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.

2 participants