OCPBUGS-100052: Created new job to update vSphere nodes to have vsphere label #497
@vr4manta: This pull request references Jira Issue OCPBUGS-100052, which is valid. The bug has been moved to the POST state.
<details><summary>3 validation(s) were run on this bug</summary>
bug is open, matching expected state (open)
bug target version (5.0.0) matches configured target version for branch (5.0.0)
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.
</details>
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: review paused by coderabbit.ai -->
[!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:
- [ ] <!-- {"checkboxId": "7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews
- [ ] <!-- {"checkboxId": "e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review
<!-- end of auto-generated comment: review paused by coderabbit.ai -->
<!-- walkthrough_start -->
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 <br> 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 <br> 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 <br> 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
<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->
---
<!-- pre_merge_checks_override_start -->
[!IMPORTANT]
## Pre-merge checks failed
> Please resolve all errors before merging. Addressing warnings is optional.
<!-- pre_merge_checks_override_end -->
❌ 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. |
<details>
<summary>✅ Passed checks (12 passed)</summary>
| 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. |
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary>✨ Finishing Touches</summary>
<details>
<summary>🧪 Generate unit tests (beta)</summary>
</details>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->
---
<sub>Comment @coderabbitai help to get the list of available commands.</sub>
<!-- tips_end -->
<!-- internal state start -->
<!-- N4IgzgxgFgpgtgQwGowE5gJYHsB2IBcAjADTgAuqArhGZajACYDKZCZMBoYF1t9K6bHiKkADqgDyAIwBWMGhgBuMMARABidQAIACgCUtYSnESoAngB0cVgCpQMYXQYj02KrQi0ysUrWShsWlQ4jgx0GDgA5loR3AgANvFsQn5YWpSiDG5aMAAeDmQR0YpMorD0WjhYDO4A7hj+frBaSVIw8VoABlU1AHRYojAh9gBmZL3YAPSiSWQjWKhwALRkZoMAvIpgZWgwnb1adjBePjGOEew4NQypQZQ4WrgQx2GoRU3HIxjoZOmikagEDUtBBcKwIu9/A4QQEoscEFdKlhfq93kYpGAYABHShDX4ZAFAlS9KxWTRaADCWBMeMcRhMCHMpJwRy0EkGOCYo1+FIAkkEfMiQbgvotGE1Av5jvogjARrscM9HIoEhgbgApb6eBxGY4SCk6ABCAFUAOJMJaEAAMNoArAAmA6sqSUaK1BCOOBYZQ3MhpKW6CRMGyGVjsYhaeqNFXxNXJXDCnCiuCQxmRGC/ZSCBO23pWvMeREIjyJLC1cUu6Jxdgk6ws5oISh+xDsG700xmWWiBZkRy4GArDBwY4lHYVHrHVrtQxmRVQVC4DAAL3jD1qsAenSQpXKMAAshhcowAHLVGAAURwik6ZxyOAQUnijAjNRmWDMw5wvyMom7qF+8yoB8M5zguODLquJxSBGCK+iovbClm7yjruEZVDgSwobsMHxK4DBmEsU5PgwMGIvKbB0AODAOA+xGGM895vFgYC1rYDZNlACxdj24r+JKzRYRUYCztAYEQYUCbdjc7qOPQcg0BW8iNpiMQIaCX4IBEaCRh6iZfJElHSQ0UBdMEACCYCnjgehYMiN7rhgT7AUOCDpncIQeLJtnjIcsCdjMCI4LxaT0IoG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QCkgg93MckJzPAwh7Xxw9G4MMzYnSt3IoQcIA0iCyiDbg1u7INxPeD260gjuluOpmoyCk5sgazLGMF2U1EHWMAZXNVHwQh7A9ZIckKeByh16cAhFKFLeAd23LFtfYU4W0GB3sBu4s0UdMEGKT9kEoyQhMKKH1n/BAQwIA+lCC+JwgDgWgF/BDjLDvACQM+9wFzTjFXzZQw++fVBAwaDThpVk4dZBhPinQhZ7ATgJBWgogBGwfoJ4TtKv1+xQAGup/ZiAYBmQyAa4v7MGMHJUg7k21O/Q7EwAZTQALOjBMHTpY0tm+KNGZCMHtBSAlgvxW0NEhmTIFECMyCALaC+47pvyO6SahGNv2QUgAA== -->
<!-- internal state end -->
@vr4manta: This pull request references Jira Issue OCPBUGS-100052, which is valid.
<details><summary>3 validation(s) were run on this bug</summary>
bug is open, matching expected state (open)
bug target version (5.0.0) matches configured target version for branch (5.0.0)
<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.
><!-- This is an auto-generated comment: release notes by coderabbit.ai -->
>## Summary by CodeRabbit
>- New Features
- Added automatic one-time synchronization of vSphere node labels.
- vSphere nodes missing thenode.openshift.io/platform-type=vspherelabel are now identified and labeled when theVSphereMixedNodeEnvfeature 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.
><!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
</details>
_🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_
Give the Job context an application-level deadline.
SetupSignalHandler() only cancels on termination. A hung API call is instead killed by the manifest’s 300-second pod deadline. Derive a timeout context with a buffer below that deadline and pass it through initialization and synchronization.
As per path instructions, Go code must use context.Context for cancellation and timeouts.
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cmd/vsphere-node-label-sync-job/main.go` at 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:b0ff4c0bede6633749304537 -->
_Source: Path instructions_
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commit 68c2feb
_🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_
Remove the TTL from this create-only Job.
After completion, the TTL controller deletes the Job. The desired resource is then absent on a later CVO sync, so it can be created and run again—contradicting the required one-time backfill behavior.
<details>
<summary>Proposed fix</summary>
- ttlSecondsAfterFinished: 3600
</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`
at 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:6adc29ce7e63d2e9d6ef5e45 -->
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commit 68c2feb
_🔒 Security & Privacy_ | _🟠 Major_ | _🏗️ Heavy lift_
Do not run this Job in the host network namespace.
This hostaccess Job already mounts host Kubernetes configuration; sharing the host network materially expands the impact of a container compromise. Prefer waiting for ordinary API Service connectivity rather than using host networking.
As per path instructions, Kubernetes manifests must have “No hostPID, hostNetwork, hostIPC, privileged: true.”
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`
at 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:4dd9e6c30a214cc2ad403828 -->
_Sources: Path instructions, Linters/SAST tools_
<!-- This is an auto-generated reply by CodeRabbit -->
_🩺 Stability & Availability_ | _🟠 Major_ | _🏗️ Heavy lift_
Avoid a hard control-plane node selector.
This assumes traditional control-plane nodes and their master label, so the Job cannot schedule on HyperShift-style topologies. Make the deployment topology-aware rather than requiring a control-plane node.
As per coding guidelines, flag “nodeSelector/affinity targeting control-plane nodes (breaks on HyperShift).”
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`
around lines 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:61b0e6ce3d5d4d7f0c8a8719 -->
_Source: Coding guidelines_
<!-- This is an auto-generated reply by CodeRabbit -->
_🔒 Security & Privacy_ | _🟠 Major_ | _⚡ Quick win_
Add a restrictive security context.
The host-networked, hostPath-consuming container can run with default root and privilege-escalation settings. Require runAsNonRoot, allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, and drop ALL capabilities; add only explicitly required writable mounts or capabilities.
As per path instructions, manifests require runAsNonRoot, a read-only root filesystem, disabled privilege escalation, and dropping ALL capabilities.
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 Trivy (0.72.0)</summary>
[error] 72-97: Root file system is not read-only
Container 'vsphere-node-label-sync' of Job 'vsphere-node-label-sync' should set 'securityContext.readOnlyRootFilesystem' to true
Rule: KSV-0014
(IaC/Kubernetes)
---
[error] 72-97: Default security context configured
container vsphere-node-label-sync in openshift-cloud-controller-manager-operator namespace is using the default security context
Rule: KSV-0118
(IaC/Kubernetes)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`
around lines 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:6c45cdd72029245cc9344923 -->
_Sources: Path instructions, Linters/SAST tools_
<!-- This is an auto-generated reply by CodeRabbit -->
✅ Addressed in commit 68c2feb
_🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_
Set CPU and memory limits.
This system-node-critical Job has requests only, allowing an unbounded process to contend with control-plane workloads. Add bounded CPU and memory limits.
As per path instructions, Kubernetes manifests require resource limits on every container.
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`
around lines 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:0a8d485196350712efc51d96 -->
_Source: Path instructions_
<!-- This is an auto-generated reply by CodeRabbit -->
✅ Addressed in commit 68c2feb
_🔒 Security & Privacy_ | _🟡 Minor_ | _⚡ Quick win_
Avoid logging the full node name at info level.
Node names can contain internal hostnames. Log an aggregate/count or redact the identifier instead.
As per coding guidelines, flag logging that may expose “internal hostnames.”
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/controllers/vsphere_node_label_sync.go` at 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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:c66a6d8cfd1eb2924e49ede2 -->
_Source: Coding guidelines_
<!-- This is an auto-generated reply by CodeRabbit -->
Actionable comments posted: 7
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e2850ae9-15f2-41e7-bdec-611918f5192d
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 38f5e00cbd0085f6b62b98cd9ed044f54c89ad07 and 634d7eb34dd570e959606b2c460821ce1f6d02fb.
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
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</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
Hi coderabbit, i asked Claude to make these changes and it responded with the following:
Reasoning for skipping:
This is the exact setting added to resolve the production failure Neil reported earlier in this conversation: oc logs showed dial tcp
172.30.0.1:443: i/o timeout when the Job pod tried to reach the "kubernetes" Service ClusterIP right after a control-plane node reboot during an
upgrade — because pod-network service routing (kube-proxy/OVN) wasn't wired up on that node yet. The fix relies on hostNetwork: true together
with sourcing /etc/kubernetes/apiserver-url.env (line 79-80) to reach the local control-plane apiserver directly, bypassing the Service ClusterIP
entirely — mirroring the operator's own Deployment (0000_26_cloud-controller-manager-operator_50_deployment.yaml), which uses the identical
pattern for the identical reason.
There's also a technical reason removing hostNetwork would break this even independent of the ClusterIP-timing issue: apiserver-url.env points at
a host-local address reachable only from the host's network namespace. Without hostNetwork: true, the pod has its own network namespace, so that
address wouldn't even be reachable — "ordinary Kubernetes Service connectivity" is precisely the mode that failed in practice.
I'm leaving the manifest unchanged.
What are your thoughts?
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job='manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml'
echo '=== Job manifest: full relevant pod specification ==='
nl -ba "$job" | sed -n '30,130p'
echo
echo '=== hostNetwork and apiserver-url.env references in manifests ==='
rg -n -C 8 'hostNetwork:\s*true|apiserver-url\.env|URL_ONLY_KUBECONFIG' manifests -g '*.yaml' -g '*.yml'
echo
echo '=== Candidate operator deployment files ==='
fd -t f '0000_26_cloud-controller-manager-operator_50_deployment\.yaml|deployment.*\.yaml' manifests | sort
Length of output: 968
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job='manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml'
echo '=== Job manifest: relevant pod specification ==='
sed -n '30,130p' "$job"
echo
echo '=== hostNetwork and apiserver-url.env references in manifest YAML ==='
rg -n -C 10 'hostNetwork:\s*true|apiserver-url\.env|URL_ONLY_KUBECONFIG' manifests -g '*.yaml' -g '*.yml'
echo
echo '=== Candidate operator deployment manifests ==='
find manifests -type f \( -name '0000_26_cloud-controller-manager-operator_50_deployment.yaml' -o -iname '*deployment*.yaml' -o -iname '*deployment*.yml' \) -print | sort
Length of output: 18213
---
</details>
@vr4manta, I agree with Claude’s assessment. The finding should be withdrawn.
The evidence supports a narrowly justified exception to the general hostNetwork guidance:
/etc/kubernetes/apiserver-url.env and is specifically designed to use the direct API-server route when normal Service networking is unavailable.manifests/0000_26_cloud-controller-manager-operator_50_deployment.yaml already uses the identical hostNetwork: true plus apiserver-url.env pattern.hostNetwork would force the Job back onto the ClusterIP path that this change is intended to avoid; it may also make the host-local endpoint unusable from the pod network namespace.Keeping hostNetwork: true is appropriate here. The Job is additionally bounded by its deadline and one-time/create-only lifecycle, which limits its exposure. My original comment was overly generic and did not account for this required control-plane bootstrap behavior.
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vr4manta
Repo: openshift/cluster-cloud-controller-manager-operator PR: 497
File: manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml:45-45
Timestamp: 2026-07-29T16:22:19.657Z
Learning: In `manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`, `hostNetwork: true` is required for the one-time vSphere node-label synchronization Job. On a rebooting control-plane node, CNI/OVN or kube-proxy Service routing may not yet make the Kubernetes Service ClusterIP reachable. The Job targets control-plane nodes, mounts `/etc/kubernetes` read-only, sources `/etc/kubernetes/apiserver-url.env`, and uses the host network to reach the local API server directly. This matches the established pattern in `manifests/0000_26_cloud-controller-manager-operator_50_deployment.yaml`; do not flag this specific host-network use as an unjustified manifest security issue.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
Hi coderabbit, i asked Claude to make these changes and it responded with the following:
Reasoning for skipping:
1. The HyperShift premise doesn't apply here. CVO only includes a manifest for a given cluster profile (self-managed-HA, single-node, HyperShift,
IBM-cloud-managed) if it carries that profile's include.release.openshift.io/<profile> annotation. This Job — like every manifest in this repo,
including the operator's own Deployment it mirrors — only declares self-managed-high-availability and single-node-developer. None of this repo's
payload is ever applied to a HyperShift guest cluster, regardless of nodeSelector content, so there's no HyperShift compatibility gap to close.
2. Removing it would break the fix from two reviews ago. The node-role.kubernetes.io/master selector isn't a stray "legacy" label choice — it's
required by the hostNetwork + /etc/kubernetes/apiserver-url.env fix (lines 37-44) that resolved Neil's actual production failure. That file is
only populated on control-plane nodes. Without the selector, the pod could land on a worker node where the file doesn't exist, the wrapper script
would fall through to the (non-functional, per earlier verification) URL_ONLY_KUBECONFIG fallback, and the pod would be back to relying on
ordinary Service networking — reintroducing the exact dial tcp 172.30.0.1:443: i/o timeout failure this design was built to avoid. This exactly
mirrors why the operator's own Deployment uses the identical node-role.kubernetes.io/master selector for the identical reason.
What are your thoughts?
Hi coderabbit, i asked Claude to make these changes and it responded with the following:
● Verified against current code — line 89 matches exactly: klog.Infof("added %s=%s label to node %s", ..., node.Name).
Skipping this finding — not valid. Kubernetes Node names aren't sensitive/PII in this ecosystem: they're readable via kubectl get nodes by any
principal with basic Node RBAC, and logged at Info level constantly by core Kubernetes/OpenShift components (kubelet, the node lifecycle
controller, machine-api-operator, cluster-autoscaler, etc.) as completely standard practice — there's no compliance convention here treating them
as requiring redaction.
This specific line is also a direct carry-over from the original VSphereNodeLabelSyncer controller (klog.Infof("VSphereNodeLabelSyncer: added
%s=%s label to node %s", ...)), not something newly introduced by the Job refactor — it was already reviewed once. For a one-time migration
backfill, logging exactly which node got relabeled is genuinely useful audit/debugging information (confirming which legacy vSphere nodes were
affected by the pre-feature-gate gap); collapsing it to a bare count would lose that without addressing any real exposure.
What are your thoughts?
@vr4manta, I agree with Claude’s conclusion and will withdraw this finding.
The original comment applied the “internal hostname” guidance too broadly. node.Name is a normal Kubernetes resource identifier, and this is a bounded, one-time repair operation where identifying each successfully relabeled Node provides useful audit and troubleshooting value. The fact that comparable OpenShift/Kubernetes controllers routinely log Node names supports keeping this at info level.
One nuance: RBAC for kubectl get nodes and access to centralized logs are not necessarily identical, so RBAC alone would not universally settle the sensitivity question. But in this specific operational context, the per-Node success log is appropriate and the proposed count/redaction would reduce useful diagnostics without a meaningful security benefit.
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vr4manta
Repo: openshift/cluster-cloud-controller-manager-operator PR: 497
File: pkg/controllers/vsphere_node_label_sync.go:89-89
Timestamp: 2026-07-29T16:23:03.946Z
Learning: For `pkg/controllers/vsphere_node_label_sync.go`, the one-time vSphere node-label backfill Job may log the Kubernetes `node.Name` at info level after a successful label patch. Node names are accepted operational identifiers in this OpenShift/Kubernetes context, and the per-node record provides useful migration audit and debugging information; do not flag this specific logging pattern solely because a node name could resemble an internal hostname.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job=$(fd -t f '^0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync\.yaml$' . | head -n1)
deployment=$(fd -t f '^0000_26_cloud-controller-manager-operator_50_deployment\.yaml$' . | head -n1)
printf '%s\n' "=== Job: ${job:-not found} ==="
if [ -n "${job:-}" ]; then
nl -ba "$job"
fi
printf '%s\n' "=== Deployment: ${deployment:-not found} ==="
if [ -n "${deployment:-}" ]; then
nl -ba "$deployment"
fi
printf '%s\n' "=== Release-profile annotations in manifests ==="
rg -n -C2 'include\.release\.openshift\.io/(self-managed-high-availability|single-node-developer|hypershift|ibm-cloud-managed)' manifests -g '*.yaml' || true
printf '%s\n' "=== apiserver-url.env references ==="
rg -n -C3 '/etc/kubernetes/apiserver-url\.env|URL_ONLY_KUBECONFIG' -g '*.{yaml,yml,go,sh}' . || true
Length of output: 1286
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job=$(fd -t f '^0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync\.yaml$' . | head -n1)
deployment=$(fd -t f '^0000_26_cloud-controller-manager-operator_50_deployment\.yaml$' . | head -n1)
print_numbered() {
awk '{ printf "%6d %s\n", NR, $0 }' "$1"
}
printf '%s\n' "=== Job: ${job:-not found} ==="
if [ -n "${job:-}" ]; then
print_numbered "$job"
fi
printf '%s\n' "=== Deployment: ${deployment:-not found} ==="
if [ -n "${deployment:-}" ]; then
print_numbered "$deployment"
fi
printf '%s\n' "=== Release-profile annotations in manifests ==="
rg -n -C2 'include\.release\.openshift\.io/(self-managed-high-availability|single-node-developer|hypershift|ibm-cloud-managed)' manifests -g '*.yaml' || true
printf '%s\n' "=== apiserver-url.env and fallback references ==="
rg -n -C3 '/etc/kubernetes/apiserver-url\.env|URL_ONLY_KUBECONFIG' -g '*.{yaml,yml,go,sh}' . || true
Length of output: 58875
---
</details>
@vr4manta, I agree with Claude’s reasoning. The finding should be withdrawn.
The manifest is limited to the self-managed-high-availability and single-node-developer release profiles (Lines 8–9), and the existing operator Deployment has the identical profile scope and placement model. The Job intentionally mirrors that Deployment:
hostNetwork: true and node-role.kubernetes.io/master (Lines 45–47);/etc/kubernetes (Lines 94–102);/etc/kubernetes/apiserver-url.env (Lines 80–84).Given that contract, removing the selector could place the Job on a node without the required API-server URL file and reintroduce the connectivity failure the design addresses. My original comment applied the general HyperShift scheduling heuristic without accounting for the manifest’s release-profile exclusion and the control-plane-specific dependency. No change is needed for this finding.
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vr4manta
Repo: openshift/cluster-cloud-controller-manager-operator PR: 497
File: manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml:46-47
Timestamp: 2026-07-29T16:23:15.844Z
Learning: In `manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`, the `node-role.kubernetes.io/master` selector is intentional: the host-networked Job mounts host `/etc/kubernetes` and depends on `/etc/kubernetes/apiserver-url.env`, which is available on control-plane nodes, to reach the API server directly during CNI/service-network unavailability. The manifest is scoped to `self-managed-high-availability` and `single-node-developer` release profiles, so HyperShift compatibility concerns do not apply to this payload.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
/retest
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.
Hi coderabbitai, When i made this change, I am seeing the following in some of the presubmits:
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 }
Here is the job link: https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-cloud-controller-manager-operator/497/pull-ci-openshift-cluster-cloud-controller-manager-operator-main-e2e-azure-ovn-upgrade/2082509487373029376
I believe this suggestion caused it. can you check to confirm.
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
set -euo pipefail
manifest="manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml"
echo '== Job manifest: security context and execution settings =='
if [[ -f "$manifest" ]]; then
nl -ba "$manifest" | sed -n '65,125p'
else
echo "Manifest not found: $manifest"
fi
echo
echo '== Dockerfile outline =='
if [[ -f Dockerfile ]]; then
ast-grep outline Dockerfile --items all || true
echo
echo '== Dockerfile USER / final-stage context =='
rg -n -i -C 5 '^\s*USER\b|^FROM\b|vsphere-node-label-sync-job|cluster-cloud-controller-manager' Dockerfile
else
echo 'Dockerfile not found at repository root'
fd -a '^Dockerfile$' .
fi
echo
echo '== Relevant container security-context settings across manifests =='
rg -n -C 4 'runAsNonRoot:|runAsUser:|allowPrivilegeEscalation:|readOnlyRootFilesystem:|capabilities:' manifests || true
Length of output: 1289
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
manifest="manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml"
echo '== Job manifest: lines 65-125 =='
if [ -f "$manifest" ]; then
sed -n '65,125p' "$manifest"
else
echo "Manifest not found: $manifest"
fi
echo
echo '== Container security context in the Job manifest =='
if [ -f "$manifest" ]; then
grep -n -E -C 4 'runAsNonRoot:|runAsUser:|allowPrivilegeEscalation:|readOnlyRootFilesystem:|capabilities:|securityContext:' "$manifest" || true
fi
echo
echo '== Runtime image stages and effective USER declarations =='
if [ -f Dockerfile ]; then
grep -n -E -i -C 5 '^[[:space:]]*FROM[[:space:]]|^[[:space:]]*USER[[:space:]]|vsphere-node-label-sync-job|cluster-cloud-controller-manager' Dockerfile || true
else
find . -name Dockerfile -type f -print
fi
echo
echo '== Explicit security contexts in sibling operator manifests =='
grep -R -n -E -C 3 'runAsNonRoot:|runAsUser:' manifests 2>/dev/null || true
Length of output: 5744
---
</details>
@vr4manta, confirmed — my recommendation caused this presubmit failure. Sorry about that.
The Job manifest now sets:
securityContext:
runAsNonRoot: true
but the final runtime stage in Dockerfile has no USER directive. The kubelet event confirms that the resulting image defaults to root, so Kubernetes correctly rejects the pod before it starts.
The minimal correction is to remove runAsNonRoot: true for this Job, while retaining the other hardening settings:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
Alternatively, the image could be deliberately made non-root, but that would be a broader change that needs validation for the image entrypoints and filesystem permissions. I’m withdrawing the original finding because it did not account for this image’s root default.
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vr4manta
Repo: openshift/cluster-cloud-controller-manager-operator PR: 497
File: manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml:70-106
Timestamp: 2026-07-30T11:36:28.103Z
Learning: In `manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml`, do not set `securityContext.runAsNonRoot: true` unless the final runtime image is changed and validated to use a non-root USER. The current final stage in `Dockerfile` has no `USER` directive, and the vSphere node label sync Job is rejected by kubelet because the image runs as root.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
_🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_
Feature-gate wait doesn't observe context cancellation.
This select only reacts to InitialFeatureGatesObserved() or the 1-minute timer; it has no case <-ctx.Done(). A SIGTERM (or, in principle, jobTimeout firing) during this wait is ignored until featureGateWaitTimeout elapses or gates are observed, bypassing the graceful-shutdown contract that ctrl.SetupSignalHandler()/jobTimeout are meant to enforce elsewhere in this function.
As per path instructions, Go code should use context.Context for cancellation and timeouts.
<details>
<summary>🩹 Proposed fix</summary>
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)
}
</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
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)
}
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cmd/vsphere-node-label-sync-job/main.go` around lines 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.
</details>
<!-- fingerprinting:phantom:medusa:beignet -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:22d0e36a199debdc58c89a40 -->
_Source: Path instructions_
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commits 4a56b68 to a143234
Actionable comments posted: 1
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 7850ebc2-bcbb-4bf0-af28-d6e65bc74855
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 68c2feb16cf0b93298bb234a7a9bf9a7ec109e5b and a3563a04b5c7dcc6e8d56847074bedc104803d97.
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
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</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
_🗄️ Data Integrity & Integration_ | _🟠 Major_ | _⚡ Quick win_
Only backfill an absent platform-type label.
The sync is documented as repairing missing labels, but it overwrites any existing value other than vsphere. That can replace an established Node scheduling label.
pkg/controllers/vsphere_node_label_sync.go#L75-L83: check map membership and return when node.openshift.io/platform-type already exists, regardless of its value.pkg/controllers/vsphere_node_label_sync_test.go#L37-L75: add a vSphere-providerID Node with an existing non-vSphere value and assert that it remains unchanged.<details>
<summary>Proposed controller fix</summary>
- if node.Labels[vsphere.NodePlatformTypeLabelKey] == vsphere.NodePlatformTypeLabelValueVSphere {
+ if _, hasPlatformTypeLabel := node.Labels[vsphere.NodePlatformTypeLabelKey]; hasPlatformTypeLabel {
return nil
}
</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if node.Labels[vsphere.NodePlatformTypeLabelKey] == vsphere.NodePlatformTypeLabelValueVSphere {
return nil
}
patch := client.MergeFrom(node.DeepCopy())
if _, hasPlatformTypeLabel := node.Labels[vsphere.NodePlatformTypeLabelKey]; hasPlatformTypeLabel {
return nil
}
node.Labels[vsphere.NodePlatformTypeLabelKey] = vsphere.NodePlatformTypeLabelValueVSphere
</details>
<!-- suggestion_end -->
<details>
<summary>📍 Affects 2 files</summary>
pkg/controllers/vsphere_node_label_sync.go#L75-L83 (this comment)pkg/controllers/vsphere_node_label_sync_test.go#L37-L75</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/controllers/vsphere_node_label_sync.go` around lines 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.
</details>
<!-- consolidated_sites_start -->
<!--
<consolidated_sites>
<site>
<role>anchor</role>
<file>pkg/controllers/vsphere_node_label_sync.go</file>
<line_range>75-83</line_range>
</site>
<site>
<role>sibling</role>
<file>pkg/controllers/vsphere_node_label_sync_test.go</file>
<line_range>37-75</line_range>
</site>
</consolidated_sites>
-->
<!-- consolidated_sites_end -->
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:ce98cd09497c1ffc59881903 -->
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commits 4a56b68 to 7498032
Actionable comments posted: 1
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3d060cde-f34e-4e30-9950-e7738cfc517a
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between a3563a04b5c7dcc6e8d56847074bedc104803d97 and a1432349173cc595b5865f69765784c521229084.
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
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</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
/test e2e-vsphere-ovn
_🩺 Stability & Availability_ | _🟠 Major_ | _🏗️ Heavy lift_
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job='manifests/0000_90_cloud-controller-manager-operator_00_job.yaml'
deployment='manifests/0000_26_cloud-controller-manager-operator_50_deployment.yaml'
echo '== Job placement and host-access configuration =='
rg -n -C 8 'nodeSelector|affinity|tolerations|hostNetwork|host-etc-kube|apiserver-url\.env' "$job"
echo
echo '== Operator Deployment placement and host-access configuration =='
rg -n -C 8 'nodeSelector|affinity|tolerations|hostNetwork|host-etc-kube|apiserver-url\.env' "$deployment"
Repository: openshift/cluster-cloud-controller-manager-operator
Length of output: 6101
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job='manifests/0000_90_cloud-controller-manager-operator_00_job.yaml'
deployment='manifests/0000_26_cloud-controller-manager-operator_50_deployment.yaml'
echo '== Job manifest =='
cat -n "$job"
echo
echo '== References to URL_ONLY_KUBECONFIG and node-label-sync =='
rg -n -C 5 'URL_ONLY_KUBECONFIG|vsphere-node-label-sync-job|node-label-sync' .
Repository: openshift/cluster-cloud-controller-manager-operator
Length of output: 19651
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '== Job client configuration and failure handling =='
rg -n -C 8 'URL_ONLY_KUBECONFIG|rest\.InClusterConfig|InClusterConfig|kubeconfig|NewConfig|BuildConfig|config' \
cmd pkg vendor 2>/dev/null | head -n 240
echo
echo '== Related historical Job manifest placement =='
fd -i '*node*label*sync*.yaml' manifests -x sh -c 'echo "FILE: $1"; rg -n -C 5 "nodeSelector|tolerations|hostNetwork|URL_ONLY_KUBECONFIG|apiserver-url" "$1"' sh {}
Repository: openshift/cluster-cloud-controller-manager-operator
Length of output: 20822
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '== Related vSphere label-sync Job manifests =='
fd -i -g '*node*label*sync*.yaml' manifests --exec sh -c '
for f do
echo "FILE: $f"
rg -n -C 6 "nodeSelector|tolerations|hostNetwork|URL_ONLY_KUBECONFIG|apiserver-url" "$f" || true
done
' sh
echo
echo '== vSphere label-sync client setup =='
cat -n cmd/vsphere-node-label-sync-job/main.go | sed -n '55,180p'
Repository: openshift/cluster-cloud-controller-manager-operator
Length of output: 3612
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
old='manifests/0000_26_cloud-controller-manager-operator_45_job-vsphere-node-label-sync.yaml'
if [ -f "$old" ]; then
echo "== Existing vSphere node-label-sync Job =="
cat -n "$old"
else
echo "Missing: $old"
fd -i -g '*job*vSphere*' manifests
fi
Repository: openshift/cluster-cloud-controller-manager-operator
Length of output: 286
---
</details>
Constrain the Job to nodes that provide /etc/kubernetes/apiserver-url.env.
The Job has no placement constraints, unlike the operator Deployment. A worker uses the /etc/kubernetes/kubeconfig fallback, which does not guarantee API access before service routing is ready. Apply topology-aware placement that supports SNO and hosted control planes.
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 Trivy (0.72.0)</summary>
[error] 33-93: Default security context configured
job node-label-sync in openshift-cloud-controller-manager-operator namespace is using the default security context, which allows root privileges
Rule: KSV-0118
(IaC/Kubernetes)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@manifests/0000_90_cloud-controller-manager-operator_00_job.yaml` around lines
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.
</details>
<!-- fingerprinting:phantom:poseidon:terra -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:58fc97886aba89e456d599f8 -->
_Source: Coding guidelines_
<!-- This is an auto-generated reply by CodeRabbit -->
Actionable comments posted: 1
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c18c9679-f217-4aa9-80c5-8b60f38d7a5f
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between a3563a04b5c7dcc6e8d56847074bedc104803d97 and 7498032d116cb5b0156444cd53e49297074a195b.
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
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
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (6)</summary>
Makefile
Dockerfile
pkg/cloud/vsphere/vsphere.go
pkg/controllers/vsphere_node_label_sync.go
pkg/controllers/vsphere_node_label_sync_test.go
</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
/test e2e-vsphere-ovn
/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/a6111700-8d1a-11f1-9607-9d87cc977858-0
/test ?
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.
Hi coderabbitai, it seems setting the limits on this job is causing an e2e failure. Here is the error:
: [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]")}
You can see it in the following two tests:
@vr4manta, thank you for the test results. The conformance test explicitly requires requests without limits for this Job. My prior recommendation conflicts with that policy.
Remove the CPU and memory limits. Keep the existing resource requests. I withdraw this finding.
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vr4manta
Repo: openshift/cluster-cloud-controller-manager-operator PR: 497
File: manifests/0000_90_cloud-controller-manager-operator_00_job.yaml:88-95
Timestamp: 2026-08-03T11:11:44.302Z
Learning: For the `vsphere-node-label-sync` Job in `manifests/0000_90_cloud-controller-manager-operator_00_job.yaml`, OpenShift conformance requires container resource requests without CPU or memory limits. The `[sig-arch] Managed cluster should set requests but not limits` test rejects `resources.limits` for this platform-namespace Job.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
/test e2e-vsphere-ovn
/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/83abd4a0-8f2e-11f1-8291-6a9e64f42511-0
● This finding is already resolved in the current file. Lines 45–69 already contain the node-role.kubernetes.io/master: "" nodeSelector and the full 6-entry
toleration set, matching the operator Deployment. This was the fix applied at the end of the previous session. No changes needed.
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
set -euo pipefail
job='manifests/0000_90_cloud-controller-manager-operator_00_job.yaml'
deployment='manifests/0000_26_cloud-controller-manager-operator_50_deployment.yaml'
echo '== Job placement =='
rg -n -C 4 '^[[:space:]]*(nodeSelector|tolerations):|node-role\.kubernetes\.io/master|^[[:space:]]*-[[:space:]]*(key|operator|effect|value):' "$job"
echo
echo '== Operator Deployment placement =='
rg -n -C 4 '^[[:space:]]*(nodeSelector|tolerations):|node-role\.kubernetes\.io/master|^[[:space:]]*-[[:space:]]*(key|operator|effect|value):' "$deployment"
Length of output: 3337
---
</details>
@vr4manta, the shell output confirms your statement. The Job has the control-plane nodeSelector and all six Deployment tolerations. The finding is withdrawn.
<!-- <review_comment_withdrawn> -->
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
All install and upgrade jobs have passed. The payload-job test for upgrade is also passing which is what reported the initial bug.
/assign @damdo
2026?
just copied from sync controllers. I can update to newer year.
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn
/retest
/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/b026cd10-90d6-11f1-815d-b29a0b9a8058-0
/verified by @vr4manta
@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.
</details>
/assign @damdo @theobarberbany
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))
Is this a duplicate of the one at line 62?
We are not registering these for the fake client in the tests
We could do this in a TestMain or at the top of the test, matching what the real main.go does in its init()
Indentation of the comment is wrong here if it refers to the key below
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)
@damdo I have pushed changes addressing your feedback. Please review when you have time.
/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!
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/openshift/cluster-cloud-controller-manager-operator/pull/497#pullrequestreview-4898611912" title="Approved">damdo</a>
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
</details>
<!-- META={"approvers":[]} -->
/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-vsphere-ovn-upgrade
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/c7aa8340-94dd-11f1-97b2-a787b0b809e9-0
/test e2e-vsphere-ovn
/verified by @vr4manta manual tests covering install and upgrade in addition to payload-job above and vsphere ci test.
vr4manta
OCPBUGS-100052
Changes
node.openshift.io/platform-type=vsphereNotes
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.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->