Skip to content

OCPBUGS-86988: Guard against empty workspace field on vsphere - #407

Open
nrb wants to merge 1 commit into
openshift:mainfrom
nrb:OCPBUGS-86988
Open

OCPBUGS-86988: Guard against empty workspace field on vsphere#407
nrb wants to merge 1 commit into
openshift:mainfrom
nrb:OCPBUGS-86988

Conversation

@nrb

@nrb nrb commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a potential crash in VSphere infrastructure provider when workspace configuration is missing.

Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 3, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@nrb: This pull request references Jira Issue OCPBUGS-86988, 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:

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.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

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: 457c36a4-8733-492b-b8d6-e854e90b8681

📥 Commits

Reviewing files that changed from the base of the PR and between 85f92f7 and 36fa612.

📒 Files selected for processing (2)
  • pkg/machineproviders/providers/openshift/machine/v1beta1/providerconfig/vsphere.go
  • pkg/machineproviders/providers/openshift/machine/v1beta1/providerconfig/vsphere_test.go

Walkthrough

This PR adds a nil-safety check to the ExtractFailureDomain method in the VSphere provider configuration, preventing potential nil pointer dereferences when the provider config's workspace is unset. A corresponding test case validates the fix.

Changes

ExtractFailureDomain nil-safety

Layer / File(s) Summary
Nil-safety check with test coverage
pkg/machineproviders/providers/openshift/machine/v1beta1/providerconfig/vsphere.go, pkg/machineproviders/providers/openshift/machine/v1beta1/providerconfig/vsphere_test.go
ExtractFailureDomain now returns an empty VSphereFailureDomain immediately if providerConfig.Workspace is nil, avoiding subsequent field dereferences. A test case asserts this behavior does not panic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a guard against an empty workspace field on vSphere, which directly matches the implementation that adds a nil check for workspace before dereferencing it.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All Ginkgo test names are stable and deterministic. New tests use static strings without dynamic values like UUIDs, timestamps, pod names, or IPs.
Test Structure And Quality ✅ Passed New test follows all Ginkgo quality requirements: single responsibility, proper BeforeEach setup, meaningful assertion message, and consistent with codebase patterns.
Microshift Test Compatibility ✅ Passed The test added is a unit test in the package source, not an e2e test. The custom check only applies to e2e tests, which are not present in this PR.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The test additions are unit tests in pkg/machineproviders/providerconfig/ using mocked resource builders, not e2e tests. No multi-node or SNO-incompatible assumptions present.
Topology-Aware Scheduling Compatibility ✅ Passed Changes to vSphere provider config parsing. Adds nil-safety check for workspace field. No pod scheduling constraints, affinity rules, replicas, or topology assumptions introduced.
Ote Binary Stdout Contract ✅ Passed The PR introduces no stdout writes in process-level code. Changes are limited to adding nil workspace check in ExtractFailureDomain and corresponding test case, with all code properly isolated.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed New test validates nil-safety of ExtractFailureDomain with no IPv4 assumptions, hardcoded IPs, or external connectivity requirements.
No-Weak-Crypto ✅ Passed No weak cryptography, custom crypto, or insecure secret comparisons detected. PR adds nil workspace check to vSphere provider config without any cryptographic operations.
Container-Privileges ✅ Passed No Kubernetes manifests contain privileged settings, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation. PR changes are Go code only; deployment uses restricted-v2 SCC.
No-Sensitive-Data-In-Logs ✅ Passed PR adds a nil check guard in ExtractFailureDomain and test coverage, with no new logging that exposes sensitive data like passwords, tokens, API keys, or PII.

✏️ 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.

@openshift-ci openshift-ci Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 3, 2026
@openshift-ci
openshift-ci Bot requested review from mdbooth and theobarberbany June 3, 2026 18:29
@openshift-ci

openshift-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

[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 mdbooth 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

@nrb

nrb commented Jun 3, 2026

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 Jun 3, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@nrb: This pull request references Jira Issue OCPBUGS-86988, 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 ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary by CodeRabbit

  • Bug Fixes
  • Fixed a potential crash in VSphere infrastructure provider when workspace configuration is missing.

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-robot

Copy link
Copy Markdown

@nrb: This pull request references Jira Issue OCPBUGS-86988, 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:

/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.

@nrb

nrb commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@nrb: The following tests 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-ovn-etcd-scaling 36fa612 link false /test e2e-vsphere-ovn-etcd-scaling
ci/prow/e2e-nutanix-ovn 36fa612 link false /test e2e-nutanix-ovn
ci/prow/e2e-gcp-ovn-etcd-scaling 36fa612 link false /test e2e-gcp-ovn-etcd-scaling
ci/prow/e2e-aws-ovn-etcd-scaling 36fa612 link true /test e2e-aws-ovn-etcd-scaling
ci/prow/e2e-vsphere-operator-periodic-pre 36fa612 link false /test e2e-vsphere-operator-periodic-pre
ci/prow/e2e-azure-ovn-etcd-scaling 36fa612 link false /test e2e-azure-ovn-etcd-scaling
ci/prow/e2e-vsphere-operator-periodic-pre-techpreview 36fa612 link false /test e2e-vsphere-operator-periodic-pre-techpreview

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

jira/severity-important Referenced Jira bug's severity is important 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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants