Skip to content

OCPBUGS-86012: vsphere - fix failure domain validation skipping invalid vCenter server reference#10560

Draft
jcpowermac wants to merge 1 commit into
openshift:mainfrom
jcpowermac:fix/vsphere-failure-domain-vcenter-validation
Draft

OCPBUGS-86012: vsphere - fix failure domain validation skipping invalid vCenter server reference#10560
jcpowermac wants to merge 1 commit into
openshift:mainfrom
jcpowermac:fix/vsphere-failure-domain-vcenter-validation

Conversation

@jcpowermac
Copy link
Copy Markdown
Contributor

@jcpowermac jcpowermac commented May 18, 2026

The associatedVCenter variable was declared outside the failure domain loop but never reset between iterations. When the first failure domain matched a valid vCenter, the variable stayed non-nil for subsequent iterations, causing validation to silently pass even when a later failure domain referenced a nonexistent vCenter server.

Fixes https://issues.redhat.com/browse/OCPBUGS-86012

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed vSphere failure domain validation to ensure proper state isolation between domain validations. Previously, validation context from earlier failure domains could persist and affect subsequent domain validations. Now each domain is validated independently.
  • Tests

    • Added test coverage verifying validation correctly fails when a failure domain references a non-existent vCenter server.

…r reference

The associatedVCenter variable was declared outside the failure domain
loop but never reset between iterations. When the first failure domain
matched a valid vCenter, the variable stayed non-nil for subsequent
iterations, causing validation to silently pass even when a later failure
domain referenced a nonexistent vCenter server.

Fixes https://issues.redhat.com/browse/OCPBUGS-86012

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels May 18, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 18, 2026
@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label May 18, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jcpowermac: This pull request references Jira Issue OCPBUGS-86012, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

The associatedVCenter variable was declared outside the failure domain loop but never reset between iterations. When the first failure domain matched a valid vCenter, the variable stayed non-nil for subsequent iterations, causing validation to silently pass even when a later failure domain referenced a nonexistent vCenter server.

Fixes https://issues.redhat.com/browse/OCPBUGS-86012

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2b7582bc-6bcd-4cf1-a682-3419ab8c8174

📥 Commits

Reviewing files that changed from the base of the PR and between ceef9e4 and d49aff4.

📒 Files selected for processing (2)
  • pkg/types/vsphere/validation/platform.go
  • pkg/types/vsphere/validation/platform_test.go

Walkthrough

This PR fixes a bug in vSphere platform validation where the associatedVCenter variable was not reset between failure-domain iterations, causing state from one domain to incorrectly influence validation of subsequent domains. The fix adds an explicit reset at loop start, and a new test case validates that invalid vCenter server references in later failure domains are properly detected.

Changes

Failure Domain vCenter Association Fix

Layer / File(s) Summary
vCenter association reset and test validation
pkg/types/vsphere/validation/platform.go, pkg/types/vsphere/validation/platform_test.go
In validateFailureDomains, associatedVCenter is reset to nil at the start of each iteration to prevent cross-iteration state leakage. A new test case validates that a non-existent vCenter server reference in a later failure domain is caught by validation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main bug fix: resetting failure domain validation to prevent invalid vCenter references from being skipped due to variable persistence across loop iterations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed This test file uses standard Go table-driven testing, not Ginkgo. The custom check is specific to Ginkgo tests, so it is not applicable here.
Test Structure And Quality ✅ Passed Custom check targets Ginkgo test code (Describe/It blocks, BeforeEach/AfterEach). This PR uses standard Go table-driven tests with testing package, not Ginkgo. Check not applicable.
Microshift Test Compatibility ✅ Passed The PR does not add new Ginkgo e2e tests. Changes are only in unit tests and validation code. MicroShift Test Compatibility check applies only to Ginkgo e2e tests, not applicable here.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR contains unit tests only, not Ginkgo e2e tests. Files are in pkg/types/vsphere/validation/ using standard Go testing. Custom check applies only to Ginkgo e2e tests.
Topology-Aware Scheduling Compatibility ✅ Passed This PR fixes vSphere validation logic only. No Kubernetes scheduling constraints, affinity rules, or pod specifications are modified. The topology-aware scheduling check does not apply.
Ote Binary Stdout Contract ✅ Passed PR does not violate OTE Binary Stdout Contract. fmt.Printf in test file is inside test It block, not process-level code. No process-level stdout writes found.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Custom check not applicable. PR contains only standard Go unit tests (*testing.T), not new Ginkgo e2e tests. Check specifically targets Ginkgo tests (It(), Describe(), etc.).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Comment @coderabbitai help to get the list of available commands and usage tips.

@jcpowermac
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 18, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jcpowermac: This pull request references Jira Issue OCPBUGS-86012, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@jcpowermac
Copy link
Copy Markdown
Contributor Author

/test ?

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign rvanderp3 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@jcpowermac
Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-multi-vcenter-ovn
/test unit
/test golint

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jcpowermac: This pull request references Jira Issue OCPBUGS-86012, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

The associatedVCenter variable was declared outside the failure domain loop but never reset between iterations. When the first failure domain matched a valid vCenter, the variable stayed non-nil for subsequent iterations, causing validation to silently pass even when a later failure domain referenced a nonexistent vCenter server.

Fixes https://issues.redhat.com/browse/OCPBUGS-86012

Summary by CodeRabbit

Release Notes

  • Bug Fixes

  • Fixed vSphere failure domain validation to ensure proper state isolation between domain validations. Previously, validation context from earlier failure domains could persist and affect subsequent domain validations. Now each domain is validated independently.

  • Tests

  • Added test coverage verifying validation correctly fails when a failure domain references a non-existent vCenter server.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

@jcpowermac: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-vsphere-multi-vcenter-ovn d49aff4 link false /test e2e-vsphere-multi-vcenter-ovn

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants