-
Notifications
You must be signed in to change notification settings - Fork 201
Use Patch() to update status of CnsRegisterVolume CR instead of Update() #3776
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
base: master
Are you sure you want to change the base?
Use Patch() to update status of CnsRegisterVolume CR instead of Update() #3776
Conversation
|
[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 |
|
FAILED --- Jenkins Build #683 |
|
Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
8cc0ac8 to
6668356
Compare
38c8863 to
ebc8fb5
Compare
|
FAILED --- Jenkins Build #704 |
ebc8fb5 to
ebdf019
Compare
|
/ok-to-test |
|
Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
|
FAILED --- Jenkins Build #707 |
|
FAILED --- Jenkins Build #652 |
|
Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
|
FAILED --- Jenkins Build #656 |
|
FAILED --- Jenkins Build #713 |
|
@akankshapanse why don't we use the UpdateStatus function that we're using for other CRs? Ref-
Just need to make sure that we add the status sub-resource in the CRD spec. |
|
Triggering CSI-TKG Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
|
Triggering CSI-TKG Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
|
SUCCESS --- Jenkins Build #661 |
|
Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete |
|
SUCCESS --- Jenkins Build #724 |
WCP precheckin passed
|
|
VKS precheckin passed:
|
|
|
||
| rawPatch := client.RawPatch(apitypes.MergePatchType, patchBytes) | ||
|
|
||
| // Try to patch CnsRegisterVolume CR for 3 times |
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.
What happens if it fails after 3 retries?
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.
if Patch fails under setInstanceError(), the reconcile request gets requeued most of the times and the operation gets retried. if Patch fails under setInstanceSuccess(), the reconcile request gets requeued and next try would re-account quota for same object, which would be eventually corrected by full sync
What this PR does / why we need it:
This PR adds changes to use Patch() method to update status of CnsRegisterVolume CR, instead of Update(), since Update() fails sometimes due to error as below, that causes further issue such as double quota accounting if update to mark success fails.
2025-11-13T10:25:57.869570556Z stderr F {"level":"error","time":"2025-11-13T10:25:57.86932921Z","caller":"kubernetes/kubernetes.go:787","msg":"Failed to update status. err: Operation cannot be fulfilled on cnsregistervolumes.cns.vmware.com \"cnsregvol-8cxcl\": the object has been modified; please apply your changes to the latest version and try again","kind":"CnsRegisterVolume","name":"e2e-test-namespace-274/cnsregvol-8cxcl","stacktrace":"sigs.k8s.io/vsphere-csi-driver/v3/pkg/kubernetes.UpdateStatus\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/src/pkg/kubernetes/kubernetes.go:787\nsigs.k8s.io/vsphere-csi-driver/v3/pkg/syncer/cnsoperator/controller/cnsregistervolume.setInstanceSuccess\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/src/pkg/syncer/cnsoperator/controller/cnsregistervolume/cnsregistervolume_controller.go:1071\nsigs.k8s.io/vsphere-csi-driver/v3/pkg/syncer/cnsoperator/controller/cnsregistervolume.(*ReconcileCnsRegisterVolume).Reconcile\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/src/pkg/syncer/cnsoperator/controller/cnsregistervolume/cnsregistervolume_controller.go:802\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/go/pkg/mod/sigs.k8s.io/[[email protected]](mailto:[email protected])/pkg/internal/controller/controller.go:116\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/go/pkg/mod/sigs.k8s.io/[[email protected]](mailto:[email protected])/pkg/internal/controller/controller.go:303\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/go/pkg/mod/sigs.k8s.io/[[email protected]](mailto:[email protected])/pkg/internal/controller/controller.go:263\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2\n\t/build/mts/release/sb-91958690/cayman_vsphere_csi_driver/vsphere_csi_driver/go/pkg/mod/sigs.k8s.io/[[email protected]](mailto:[email protected])/pkg/internal/controller/controller.go:224"}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:
WCP precheckin pipeline : https://jenkins-vcf-csifvt.devops.broadcom.net/job/wcp-instapp-e2e-pre-checkin/724/ - passed
VKS precheckin pipeline : https://jenkins-vcf-csifvt.devops.broadcom.net/view/instapp/job/vks-instapp-e2e-pre-checkin/668/ -passed
Manual testing:
Error case: CnsRegisterVolume for non-existing volume ID
success case:
Special notes for your reviewer:
Release note: