Skip to content

OCPBUGS-100052: Created new job to update vSphere nodes to have vsphere label - #497

Open
vr4manta wants to merge 5 commits into
openshift:mainfrom
vr4manta:OCPBUGS-100052
Open

OCPBUGS-100052: Created new job to update vSphere nodes to have vsphere label#497
vr4manta wants to merge 5 commits into
openshift:mainfrom
vr4manta:OCPBUGS-100052

Conversation

@vr4manta

@vr4manta vr4manta commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

OCPBUGS-100052

Changes

  • Created new job that runs during install to update existing nodes to have new label node.openshift.io/platform-type=vsphere

Notes

Idea is to have this only be attempted to run once and only on first upgrade with this change. Following upgrades should not rerun this job.

Summary by CodeRabbit

  • New Features

    • Added a one-time job that automatically applies the vSphere platform label to eligible cluster nodes.
    • The job runs only for vSphere environments with mixed-node support enabled.
    • Added deployment configuration with appropriate security, resource, timeout, and restart settings.
  • Bug Fixes

    • Ensures eligible vSphere nodes missing the platform label are identified and updated without modifying other node types or existing labels.
  • Tests

    • Added coverage for supported, unsupported, disabled-feature, and already-labeled scenarios.

@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/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jul 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@vr4manta: This pull request references Jira Issue OCPBUGS-100052, 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)

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

Details

In response to this:

OCPBUGS-100052

Changes

  • Created new job that runs during install to update existing nodes to have new label node.openshift.io/platform-type=vsphere

Notes

Idea is to have this only be attempted to run once and only on first upgrade with this change. Following upgrades should not rerun this job.

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 Jul 29, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a one-shot Kubernetes Job that labels eligible vSphere nodes. The change adds synchronization logic and tests, builds and packages the Job binary, and deploys it with feature-gate and security settings.

Changes

vSphere node label synchronization

Layer / File(s) Summary
Synchronization contract and reconciliation
pkg/cloud/vsphere/vsphere.go, pkg/controllers/vsphere_node_label_sync.go, pkg/controllers/vsphere_node_label_sync_test.go
Adds vSphere label and provider ID constants. Reconciles eligible Nodes and tests platform, provider ID, feature-gate, and existing-label conditions.
Job entrypoint and binary packaging
cmd/vsphere-node-label-sync-job/main.go, Makefile, Dockerfile
Adds client and feature-gate initialization, timeout handling, synchronization execution, a build target, and the runtime image copy.
Create-only Job deployment
manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
Adds the feature-gated Job, host Kubernetes configuration mount, service account, resource settings, execution controls, scheduling rules, and restricted container security settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: nrb, damdo

Sequence Diagram(s)

sequenceDiagram
  participant node-label-sync
  participant FeatureGateAccessor
  participant KubernetesAPI
  participant SyncVSphereNodeLabels
  node-label-sync->>FeatureGateAccessor: Observe feature-gate state
  FeatureGateAccessor->>KubernetesAPI: Read OpenShift configuration
  node-label-sync->>SyncVSphereNodeLabels: Start one-time synchronization
  SyncVSphereNodeLabels->>KubernetesAPI: List and patch eligible Nodes
  SyncVSphereNodeLabels-->>node-label-sync: Return synchronization result
Loading

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors, 1 warning)

Check name Status Explanation Resolution
Container-Privileges ❌ Error The new Job sets hostNetwork: true at manifest line 44, which the check explicitly flags; allowPrivilegeEscalation is false and no other listed privilege is set. Remove hostNetwork: true and use a non-host-network API path, or obtain an explicit security exception for this required networking design.
No-Sensitive-Data-In-Logs ❌ Error The sync helper logs node.Name at line 89 and includes it in errors later logged by the job; Kubernetes node names can reveal internal hostnames. Remove node.Name from log messages and wrapped errors, or log a non-identifying count/opaque identifier instead.
Topology-Aware Scheduling Compatibility ⚠️ Warning The new Job requires node-role.kubernetes.io/master, but HyperShift hosted clusters have no control-plane nodes; the PR has no ControlPlaneTopology or alternate scheduling check. Add topology-aware scheduling. Detect ControlPlaneTopology=External and avoid the master-only selector, or gate the Job and provide a supported hosted-cluster execution path.
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new job that updates existing vSphere nodes with the required label.
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 The added test uses three static t.Run names, and the PR adds or changes no Ginkgo It, Describe, Context, or When titles.
Test Structure And Quality ✅ Passed The only added test uses standard Go testing with a controller-runtime fake client, not Ginkgo; it has no cluster waits or persistent resources, so the Ginkgo-specific criteria do not apply.
Microshift Test Compatibility ✅ Passed The complete PR diff adds only a standard Go table-driven test; it adds no Ginkgo e2e tests, so MicroShift API compatibility checks do not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added test uses Go's standard testing package and t.Run, not Ginkgo e2e constructs; it uses fake Kubernetes objects and makes no multi-node or HA assumptions.
Ote Binary Stdout Contract ✅ Passed The PR adds a Kubernetes Job binary, not an OTE binary; OTE entrypoints under openshift-tests are unchanged, and klog defaults to stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added coverage is a standard Go TestSyncVSphereNodeLabels unit test using a fake client; no new Ginkgo e2e test, IPv4 assumption, or external connectivity exists.
No-Weak-Crypto ✅ Passed The PR adds Kubernetes client, informer, label-sync, build, and manifest logic; added-line scans found no MD5, SHA-1, DES, RC4, 3DES, Blowfish, ECB, custom crypto, or secret comparisons.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from damdo and nrb July 29, 2026 15:50
@openshift-ci-robot

Copy link
Copy Markdown

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

OCPBUGS-100052

Changes

  • Created new job that runs during install to update existing nodes to have new label node.openshift.io/platform-type=vsphere

Notes

Idea is to have this only be attempted to run once and only on first upgrade with this change. Following upgrades should not rerun this job.

Summary by CodeRabbit

  • New Features
  • Added automatic one-time synchronization of vSphere node labels.
  • vSphere nodes missing the node.openshift.io/platform-type=vsphere label are now identified and labeled when the VSphereMixedNodeEnv feature is enabled.
  • Added deployment support for running the synchronization job in the cluster.
  • Tests
  • Added coverage for vSphere, non-vSphere, already-labeled, and feature-disabled scenarios.

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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/vsphere-node-label-sync-job/main.go`:
- Line 75: Add an application-level timeout context derived from the context
returned by ctrl.SetupSignalHandler(), using a deadline safely below the
manifest’s 300-second limit, and ensure its cancel function is released. Pass
this context through the job’s initialization and synchronization calls so API
operations observe both termination cancellation and the application timeout;
use context.Context throughout the affected function signatures.

In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`:
- Around line 46-47: Remove the hard-coded control-plane nodeSelector from the
Job manifest so scheduling is not restricted to the legacy
node-role.kubernetes.io/master label. Update the deployment scheduling
configuration to remain topology-aware and compatible with HyperShift-style
clusters, without requiring control-plane placement.
- Around line 71-97: Add a restrictive container securityContext to the
vsphere-node-label-sync container, requiring runAsNonRoot, disabling privilege
escalation, enabling a read-only root filesystem, and dropping ALL Linux
capabilities; preserve the existing host-etc-kube read-only mount and add any
other writable mounts or capabilities only if the job explicitly requires them.
- Around line 89-93: Update the container resources block in the Job manifest to
add bounded cpu and memory limits alongside the existing requests. Ensure every
container in this Kubernetes manifest defines both resource limit fields, using
values appropriate for this system-node-critical workload.
- Line 45: Remove the hostNetwork setting from the Job manifest so the
hostaccess workload uses ordinary Kubernetes Service connectivity. Ensure the
manifest retains no hostNetwork configuration while leaving its existing host
Kubernetes configuration mount unchanged.
- Line 26: Remove the ttlSecondsAfterFinished field from the Job manifest so the
completed create-only Job remains present and is not recreated on later CVO
syncs.

In `@pkg/controllers/vsphere_node_label_sync.go`:
- Line 89: Update the logging statement in the node label sync flow to avoid
emitting node.Name at info level. Replace the per-node hostname-containing
message with an aggregate/count message or a redacted identifier, while
preserving the label operation and its existing informational intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: e2850ae9-15f2-41e7-bdec-611918f5192d

📥 Commits

Reviewing files that changed from the base of the PR and between 38f5e00 and 634d7eb.

📒 Files selected for processing (7)
  • Dockerfile
  • Makefile
  • cmd/vsphere-node-label-sync-job/main.go
  • manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml
  • pkg/cloud/vsphere/vsphere.go
  • pkg/controllers/vsphere_node_label_sync.go
  • pkg/controllers/vsphere_node_label_sync_test.go

Comment thread cmd/vsphere-node-label-sync-job/main.go Outdated
Comment thread manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
Comment thread manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
Comment thread manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
Comment thread pkg/controllers/vsphere_node_label_sync.go
@vr4manta

Copy link
Copy Markdown
Contributor Author

/retest

@vr4manta

Copy link
Copy Markdown
Contributor Author

I noticed the azure job had the following in it:

event happened 22 times, something is wrong: namespace/openshift-cloud-controller-manager-operator node/ci-op-f3bpi1wx-1a9f6-wqlfv-master-0 pod/vsphere-node-label-sync-mr9f4 hmsg/dbcbf706fd - reason/Pulled Container image "registry.build13.ci.openshift.org/ci-op-f3bpi1wx/stable@sha256:70533cbc11986458b5137dd40ffdec8370b4ccb8c037a3292ff98ddba7cc01f1" already present on machine and can be accessed by the pod (18:14:45Z) result=reject 
event happened 23 times, something is wrong: namespace/openshift-cloud-controller-manager-operator node/ci-op-f3bpi1wx-1a9f6-wqlfv-master-0 pod/vsphere-node-label-sync-mr9f4 hmsg/1f4f0000c2 - reason/Failed Error: container has runAsNonRoot and image will run as root (pod: "vsphere-node-label-sync-mr9f4_openshift-cloud-controller-manager-operator(55ee35eb-5b85-4e15-aa0f-7b9a829056f2)", container: vsphere-node-label-sync) (18:14:45Z) result=reject }

I am thinking the change coderabbit suggested for changing the run definition of the job's container may be causing this. Need to check vsphere log and retest.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/vsphere-node-label-sync-job/main.go`:
- Around line 118-123: Add a ctx.Done() case to the feature-gate wait select in
main, returning through the existing graceful cancellation path when the context
is canceled while preserving the observation and timeout behavior. Ensure the
wait uses the existing context established by
ctrl.SetupSignalHandler()/jobTimeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 7850ebc2-bcbb-4bf0-af28-d6e65bc74855

📥 Commits

Reviewing files that changed from the base of the PR and between 68c2feb and a3563a0.

📒 Files selected for processing (7)
  • Dockerfile
  • Makefile
  • cmd/vsphere-node-label-sync-job/main.go
  • manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml
  • pkg/cloud/vsphere/vsphere.go
  • pkg/controllers/vsphere_node_label_sync.go
  • pkg/controllers/vsphere_node_label_sync_test.go

Comment thread cmd/node-label-sync-job/main.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controllers/vsphere_node_label_sync.go`:
- Around line 75-83: Only backfill the platform-type label when it is absent:
update the label check in the sync controller to test map membership and return
for any existing value, including non-vSphere values. In
pkg/controllers/vsphere_node_label_sync.go lines 75-83, preserve existing
labels; in pkg/controllers/vsphere_node_label_sync_test.go lines 37-75, add a
vSphere-providerID Node with a non-vSphere platform label and assert it remains
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 3d060cde-f34e-4e30-9950-e7738cfc517a

📥 Commits

Reviewing files that changed from the base of the PR and between a3563a0 and a143234.

📒 Files selected for processing (7)
  • Dockerfile
  • Makefile
  • cmd/vsphere-node-label-sync-job/main.go
  • manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml
  • pkg/cloud/vsphere/vsphere.go
  • pkg/controllers/vsphere_node_label_sync.go
  • pkg/controllers/vsphere_node_label_sync_test.go

Comment thread pkg/controllers/vsphere_node_label_sync.go Outdated
@vr4manta

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@manifests/0000_90_cloud-controller-manager-operator_00_job.yaml`:
- Around line 33-44: Add topology-aware node placement to the Job spec near
hostNetwork, ensuring it runs only on nodes that provide
/etc/kubernetes/apiserver-url.env while supporting both single-node
control-plane deployments and hosted control planes. Mirror the operator
Deployment’s established nodeSelector and toleration symbols/configuration
rather than allowing scheduling onto arbitrary workers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: c18c9679-f217-4aa9-80c5-8b60f38d7a5f

📥 Commits

Reviewing files that changed from the base of the PR and between a3563a0 and 7498032.

📒 Files selected for processing (7)
  • Dockerfile
  • Makefile
  • cmd/vsphere-node-label-sync-job/main.go
  • manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
  • pkg/cloud/vsphere/vsphere.go
  • pkg/controllers/vsphere_node_label_sync.go
  • pkg/controllers/vsphere_node_label_sync_test.go
🚧 Files skipped from review as they are similar to previous changes (6)
  • Makefile
  • Dockerfile
  • pkg/cloud/vsphere/vsphere.go
  • pkg/controllers/vsphere_node_label_sync.go
  • pkg/controllers/vsphere_node_label_sync_test.go
  • cmd/vsphere-node-label-sync-job/main.go

Comment thread manifests/0000_90_cloud-controller-manager-operator_00_job.yaml
@vr4manta

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/a6111700-8d1a-11f1-9607-9d87cc977858-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/test ?

@vr4manta

vr4manta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Installs are now working; however, both ovn test runs hit the following:

[sig-arch] Managed cluster should set requests but not limits [Early] [Suite:openshift/conformance/parallel] expand_less	2s
{  fail [github.com/openshift/origin/test/extended/operators/resources.go:247]: Pods in platform namespaces are not following resource request/limit rules or do not have an exception granted:
  batch/v1/Job/openshift-cloud-controller-manager-operator/<batch_job>/container/node-label-sync defines a limit on cpu of 100m which is not allowed (rule: "batch/v1/Job/openshift-cloud-controller-manager-operator/<batch_job>/container/node-label-sync/limit[cpu]")
  batch/v1/Job/openshift-cloud-controller-manager-operator/<batch_job>/container/node-label-sync defines a limit on memory of 100Mi which is not allowed (rule: "batch/v1/Job/openshift-cloud-controller-manager-operator/<batch_job>/container/node-label-sync/limit[memory]")}

This was recommended by coderabbitai. Need to see what we should do for this.

@vr4manta

vr4manta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

@vr4manta

vr4manta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/83abd4a0-8f2e-11f1-8291-6a9e64f42511-0

@vr4manta

vr4manta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

All install and upgrade jobs have passed. The payload-job test for upgrade is also passing which is what reported the initial bug.

@vr4manta

vr4manta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/assign @damdo

@vr4manta
vr4manta force-pushed the OCPBUGS-100052 branch 3 times, most recently from 18b34d8 to a4d895b Compare August 4, 2026 12:18
@vr4manta

vr4manta commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

@vr4manta

vr4manta commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

@damdo

damdo commented Aug 5, 2026

Copy link
Copy Markdown
Member

/retest

@vr4manta

vr4manta commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/b026cd10-90d6-11f1-815d-b29a0b9a8058-0

@vr4manta

vr4manta commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/verified by @vr4manta

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@vr4manta: This PR has been marked as verified by @vr4manta.

Details

In response to this:

/verified by @vr4manta

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.

@damdo

damdo commented Aug 7, 2026

Copy link
Copy Markdown
Member

/assign @damdo @theobarberbany

Comment on lines +46 to +53
currentFeatureGates, err := featureGateAccess.CurrentFeatureGates()
if err != nil {
return fmt.Errorf("failed to get current feature gates: %w", err)
}
if !currentFeatureGates.Enabled(features.FeatureGateVSphereMixedNodeEnv) {
klog.V(2).Infof("%s feature gate is disabled, skipping node label sync", features.FeatureGateVSphereMixedNodeEnv)
return nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimization nit, we could move this above the infra get to avoid doing the get in the first place if the featureGateAccess.CurrentFeatureGates() (checking the feature gate first is cheaper then getting the infra (in-memory lookup))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can make that change.

Comment on lines +48 to +50
- key: node.cloudprovider.kubernetes.io/uninitialized
effect: NoSchedule
value: "true"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a duplicate of the one at line 62?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO no. This is the same as what you'll find in the deployment yaml in this same manifest directory. These were added based on recommendations from CodeRabbitAI above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some adjustments. Hope this is better.

Comment on lines +69 to +72
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(configv1.AddToScheme(scheme))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not registering these for the fake client in the tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do this in a TestMain or at the top of the test, matching what the real main.go does in its init()

Comment on lines +65 to +66
# CNI relies on CCM to fill in IP information on Node objects.
# Therefore we must schedule before the CNI can mark the Node as ready.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of the comment is wrong here if it refers to the key below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i'll fix.

Comment on lines +103 to +134
configInformers := configinformers.NewSharedInformerFactory(configClient, 10*time.Minute)
controllerRef, err := events.GetControllerReferenceForCurrentPod(ctx, kubeClient, managedNamespace, nil)
if err != nil {
klog.Warningf("unable to get owner reference (falling back to namespace): %v", err)
}

featureGateAccessor := featuregates.NewFeatureGateAccess(
controllers.GetReleaseVersion(), missingVersion,
configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(),
events.NewKubeRecorder(kubeClient.CoreV1().Events(managedNamespace), recorderName, controllerRef, clock.RealClock{}),
)
featureGateAccessor.SetChangeHandler(func(featuregates.FeatureChange) {})
go featureGateAccessor.Run(ctx)
go configInformers.Start(ctx.Done())

select {
case <-featureGateAccessor.InitialFeatureGatesObserved():
case <-ctx.Done():
setupLog.Error(ctx.Err(), "context canceled while waiting for FeatureGate detection")
os.Exit(1)
case <-time.After(featureGateWaitTimeout):
setupLog.Error(errors.New("timed out waiting for FeatureGate detection"), "unable to determine feature gate state")
os.Exit(1)
}

if err := controllers.SyncVSphereNodeLabels(ctx, k8sClient, featureGateAccessor); err != nil {
setupLog.Error(err, "failed to sync vSphere node labels")
os.Exit(1)
}

setupLog.Info("vSphere node label sync completed successfully")
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job creates three K8s clients and a full informer framework to check one feature gate before doing a straightforward list+patch and for a run-once Job that feels a bit heavy.

So I looked at whether we could replace the informer with a Get() on the FeatureGate resource + NewHardcodedFeatureGateAccessFromFeatureGate, but that won't work cleanly as NewFeatureGateAccess has version logic.

That said, you could still simplify things by moving the feature gate check into main.go.
Do the informer dance there, resolve the gate, then pass a plain bool (or just don't call SyncVSphereNodeLabels at all if the gate is off). That way the function signature drops from (ctx, client, featureGateAccess) to just (ctx, client)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i'll look into this.

Comment on lines +37 to +44
# This Job may run before pod networking (CNI/OVN service routing) is functional on a given
# node -- e.g. right after a control-plane node reboots during an upgrade. hostNetwork plus
# sourcing /etc/kubernetes/apiserver-url.env (mirroring the operator Deployment in
# 0000_26_cloud-controller-manager-operator_50_deployment.yaml) lets the container reach the
# API server directly instead of through the "kubernetes" Service ClusterIP, which requires
# kube-proxy/OVN to already be wired up. That file is only populated on control-plane nodes,
# hence the master nodeSelector/tolerations.
hostNetwork: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make it run strictly only after CNI/OVN is up so we drop the hostNet?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well not that it is run much later in the deployment, I can look into adjust this.

- Move feature gate check from SyncVSphereNodeLabels into main.go,
  simplifying the function signature to (ctx, client)
- Remove duplicate node.cloudprovider.kubernetes.io/uninitialized
  toleration from job manifest
- Fix comment indentation for CNI toleration in job manifest
- Register configv1 scheme in test init() to match main.go's init()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Aug 10, 2026
@vr4manta

Copy link
Copy Markdown
Contributor Author

@damdo I have pushed changes addressing your feedback. Please review when you have time.

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: all tests passed!

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.

@damdo damdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

/assign @theobarberbany

for LGTM

@vr4manta Feel free to add verified when all the manual and CI payload testing has been done you are happy with. Thanks!

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damdo

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2026
@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/c7aa8340-94dd-11f1-97b2-a787b0b809e9-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/test e2e-vsphere-ovn

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants