Skip to content

Fix Datacenter discovery failure after rename when MoRefs are used in the config secret#3891

Open
divyenpatel wants to merge 1 commit intokubernetes-sigs:masterfrom
divyenpatel:fix-datacenter-cached-name
Open

Fix Datacenter discovery failure after rename when MoRefs are used in the config secret#3891
divyenpatel wants to merge 1 commit intokubernetes-sigs:masterfrom
divyenpatel:fix-datacenter-cached-name

Conversation

@divyenpatel
Copy link
Member

What this PR does / why we need it:
When a Datacenter is renamed in vCenter, the CSI driver's syncer container can fail to discover or register nodes with errors like "datacenter '/path' not found", even if the configuration uses a MoRef. This happens because the core discovery logic was strictly path-based and would resolve MoRefs to paths, which then became stale after a rename.

This commit updates the core VirtualCenter discovery logic to be explicitly MoRef-aware. It adds support for both the full MoRef format (e.g., Datacenter:datacenter-3) and the raw MoID format used in Supervisor clusters (e.g., datacenter-40). By anchoring the lookup to the immutable MoID, the driver remains resilient to Datacenter renames.

Strict regex matching is used to distinguish between MoRefs and inventory paths to ensure that paths starting with "datacenter-" are still handled correctly by the path-based finder.

Testing done:
In progress

Special notes for your reviewer:

Release note:

Fix Datacenter discovery failure after rename when MoRefs are used in the config secret

When a Datacenter is renamed in vCenter, the CSI driver's syncer container
can fail to discover or register nodes with errors like "datacenter '/path'
not found", even if the configuration uses a MoRef. This happens because
the core discovery logic was strictly path-based and would resolve MoRefs
to paths, which then became stale after a rename.

This commit updates the core VirtualCenter discovery logic to be explicitly
MoRef-aware. It adds support for both the full MoRef format
(e.g., Datacenter:datacenter-3) and the raw MoID format used in Supervisor
clusters (e.g., datacenter-40). By anchoring the lookup to the immutable
MoID, the driver remains resilient to Datacenter renames.

Strict regex matching is used to distinguish between MoRefs and inventory
paths to ensure that paths starting with "datacenter-" are still handled
correctly by the path-based finder.
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyenpatel

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 Feb 7, 2026
@divyenpatel divyenpatel requested review from chethanv28 and removed request for akankshapanse and kolluria February 7, 2026 00:10
@k8s-ci-robot k8s-ci-robot added 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. labels Feb 7, 2026
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