Skip to content

OCPBUGS-78500: Skew enforcement should dynamically handle baremetal clusters#5768

Open
djoshy wants to merge 4 commits intoopenshift:mainfrom
djoshy:add-baremetal-skew-management
Open

OCPBUGS-78500: Skew enforcement should dynamically handle baremetal clusters#5768
djoshy wants to merge 4 commits intoopenshift:mainfrom
djoshy:add-baremetal-skew-management

Conversation

@djoshy
Copy link
Contributor

@djoshy djoshy commented Mar 16, 2026

What I did

Added a baremetal exception to boot image skew enforcement. baremetal clusters installed on 4.10+ use the machine-os-images provisioning path where boot images are CVO-managed and carry no skew risk. The spec.provisioningOSDownloadURL field on the Provisioning CR is used to distinguish the two paths. This CR is accessed via a dynamic informer/lister to avoid additional vendors. The MCCBootImageSkewEnforcementNone alert is suppressed for baremetal cases, matching existing SNO behavior.

This PR also does a refactor of syncBootImageSkewEnforcementStatus to make it easier to read and to add exclusions like this in the future.

How to verify it

machine-os-images path (default on 4.10+):

  1. The provisioning CR should return empty for the URL:
oc get provisioning provisioning-configuration -o jsonpath='{.spec.provisioningOSDownloadURL}' returns empty.
  1. MachineConfiguration status should show that the bootImageSkewEnforcementStatus.mode field is set to None.
  2. The MCCBootImageSkewEnforcementNone alert should not be firing.

Legacy qcow2 path (simulated):

  1. Patch the Provisioning CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":{"provisioningOSDownloadURL":"https://example.com/rhcos.qcow2"}}'
  1. bootImageSkewEnforcementStatus.mode should now flip to Manual.
  2. Restore the CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":{"provisioningOSDownloadURL":""}}'
  1. bootImageSkewEnforcementStatus.mode should now flip back to None.

@openshift-ci-robot openshift-ci-robot added 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 Mar 16, 2026
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 16, 2026
@openshift-ci-robot
Copy link
Contributor

@djoshy: This pull request references Jira Issue OCPBUGS-78500, 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 (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sergiordlr

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

Details

In response to this:

What I did

Added a baremetal exception to boot image skew enforcement. baremetal clusters installed on 4.10+ use the machine-os-images provisioning path where boot images are CVO-managed and carry no skew risk. The spec.provisioningOSDownloadURL field on the Provisioning CR is used to distinguish the two paths. This CR is accessed via a dynamic informer/lister to avoid additional vendors. The MCCBootImageSkewEnforcementNone alert is suppressed for baremetal cases, matching existing SNO behavior.

This PR also does a refactor of syncBootImageSkewEnforcementStatus to make it easier to read and to add exclusions like this in the future.

How to verify it

machine-os-images path (default on 4.10+):

  1. The provisioning CR should return empty for the URL:
oc get provisioning provisioning-configuration -o jsonpath='{.spec.provisioningOSDownloadURL}' returns empty.
  1. MachineConfiguration status should show that the bootImageSkewEnforcementStatus.mode field is set to None.
  2. The MCCBootImageSkewEnforcementNone alert should not be firing.

Legacy qcow2 path (simulated):

  1. Patch the Provisioning CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":"provisioningOSDownloadURL":"https://example.com/rhcos.qcow2"}}'
  1. bootImageSkewEnforcementStatus.mode should now flip to Manual.
  2. Restore the CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":{"provisioningOSDownloadURL":""}}
  1. bootImageSkewEnforcementStatus.mode should now flip back to None.

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
Copy link

coderabbitai bot commented Mar 16, 2026

Walkthrough

Adds a dynamic informer for the metal3 Provisioning CR, updates boot-image-skew enforcement logic to detect BareMetal legacy provisioning and SNO, suppresses a node metric for BareMetal when enforcement is None, and updates unit and extended tests to cover the new behavior.

Changes

Cohort / File(s) Summary
Operator: dynamic Provisioning informer
pkg/operator/operator.go
Add provisioningLister, provisioningListerSynced, and provisioningInformerFactory; create a dynamic client, GVR for metal3.io/v1alpha1/provisionings, informer, and lister; start informer only for BareMetal infra.
Boot image skew status sync & helper
pkg/operator/sync.go
Refactor syncBootImageSkewEnforcementStatus to use explicit early returns for spec override, BareMetal legacy provisioning path, and SNO; add isBareMetalOnLegacyProvisioningPath() that reads spec.provisioningOSDownloadURL from the unstructured Provisioning CR and treats informer errors as legacy.
Node controller metric suppression
pkg/controller/node/node_controller.go
When BootImageSkewEnforcementStatus.Mode is None, suppress (set to 0 and return) the BootImageSkewEnforcement metric on BareMetal infra in addition to the existing SNO suppression.
Tests and test helpers
pkg/operator/sync_test.go, test/extended-priv/const.go, test/extended-priv/mco_bootimages_skew.go
Update unit tests to inject fake metal3.io/v1alpha1 Provisioning unstructured object and adjust expected modes; add BaremetalPlatform constant; add extended BareMetal Ginkgo spec that toggles provisioningOSDownloadURL and asserts skew-mode transitions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

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

@openshift-ci openshift-ci bot requested a review from sergiordlr March 16, 2026 18:00
@djoshy
Copy link
Contributor Author

djoshy commented Mar 16, 2026

/test verify
/test unit

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djoshy

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 Mar 16, 2026
@djoshy
Copy link
Contributor Author

djoshy commented Mar 16, 2026

/test unit

1 similar comment
@djoshy
Copy link
Contributor Author

djoshy commented Mar 16, 2026

/test unit

@djoshy
Copy link
Contributor Author

djoshy commented Mar 16, 2026

/test e2e-gcp-op-part1

@djoshy djoshy force-pushed the add-baremetal-skew-management branch from e74d32b to 3096749 Compare March 17, 2026 14:37
@djoshy
Copy link
Contributor Author

djoshy commented Mar 19, 2026

/payload-job periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2026

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

  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/014f0720-23c2-11f1-9f14-c7e5b1502247-0

@openshift-ci-robot
Copy link
Contributor

@djoshy: This pull request references Jira Issue OCPBUGS-78500, which is valid.

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

Requesting review from QA contact:
/cc @sergiordlr

Details

In response to this:

What I did

Added a baremetal exception to boot image skew enforcement. baremetal clusters installed on 4.10+ use the machine-os-images provisioning path where boot images are CVO-managed and carry no skew risk. The spec.provisioningOSDownloadURL field on the Provisioning CR is used to distinguish the two paths. This CR is accessed via a dynamic informer/lister to avoid additional vendors. The MCCBootImageSkewEnforcementNone alert is suppressed for baremetal cases, matching existing SNO behavior.

This PR also does a refactor of syncBootImageSkewEnforcementStatus to make it easier to read and to add exclusions like this in the future.

How to verify it

machine-os-images path (default on 4.10+):

  1. The provisioning CR should return empty for the URL:
oc get provisioning provisioning-configuration -o jsonpath='{.spec.provisioningOSDownloadURL}' returns empty.
  1. MachineConfiguration status should show that the bootImageSkewEnforcementStatus.mode field is set to None.
  2. The MCCBootImageSkewEnforcementNone alert should not be firing.

Legacy qcow2 path (simulated):

  1. Patch the Provisioning CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":{"provisioningOSDownloadURL":"https://example.com/rhcos.qcow2"}}'
  1. bootImageSkewEnforcementStatus.mode should now flip to Manual.
  2. Restore the CR:
oc patch provisioning provisioning-configuration --type=merge -p '{"spec":{"provisioningOSDownloadURL":""}}'
  1. bootImageSkewEnforcementStatus.mode should now flip back to None.

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.

@djoshy djoshy force-pushed the add-baremetal-skew-management branch from 3096749 to 14682cd Compare March 20, 2026 12:09
@djoshy djoshy marked this pull request as ready for review March 20, 2026 12:09
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2026
@djoshy
Copy link
Contributor Author

djoshy commented Mar 20, 2026

/payload-job periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2 periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

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

  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2
  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/5419a430-2456-11f1-92f6-dd80a1bb2cc0-0

@djoshy djoshy force-pushed the add-baremetal-skew-management branch from 14682cd to 30925b3 Compare March 20, 2026 12:16
@djoshy
Copy link
Contributor Author

djoshy commented Mar 20, 2026

/payload-abort

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

@djoshy: aborted 2 active payload job(s) for pull request #5768

@djoshy
Copy link
Contributor Author

djoshy commented Mar 20, 2026

/payload-job periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2 periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

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

  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2
  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/e6f8d2d0-2456-11f1-9d18-84974aa46967-0

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/operator/sync_test.go (1)

321-323: The empty-URL scenario never creates a Provisioning CR.

Line 801 only inserts the fake object when the URL is non-empty, so the "" case exercises the IsNotFound fallback rather than the documented machine-os-images path where the CR exists and .spec.provisioningOSDownloadURL is empty. Split “CR presence” from “URL value” so both behaviors are covered.

Also applies to: 799-808

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/sync_test.go` around lines 321 - 323, The test currently uses
the single variable provisioningOSDownloadURL to both decide whether to insert a
fake Provisioning CR and to control its .spec.provisioningOSDownloadURL value,
so the empty-string case never creates a CR and instead hits the IsNotFound
fallback; update the test setup to separate "createCR" from "urlValue" (e.g.,
keep provisioningOSDownloadURL as the URL value and add a boolean like
createProvisioningCR or explicitly call the Provisioning CR insertion
unconditionally when you want the CR present) and then add/adjust cases so one
scenario creates a Provisioning object with spec.provisioningOSDownloadURL == ""
and another scenario omits the CR entirely, modifying the code path that
currently inserts the fake Provisioning CR (the test section that populates the
fake Provisioning lister) to use the new boolean/explicit control.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/operator/sync.go`:
- Around line 2641-2652: The function isBareMetalOnLegacyProvisioningPath should
treat a cold provisioning informer cache conservatively: check whether the
provisioningLister cache is synced (or detect cache not synced) and return true
(legacy/safe) if it is not yet synced; when optr.provisioningLister.Get returns
an unexpected error, keep the current warning but return true; call
unstructured.NestedString and inspect its ok and err return values instead of
discarding them (do not use (_,_,_)), and return true if parsing fails or the
field is malformed; update logic around provisioningLister.Get,
unstructured.NestedString, and the return value so missing/malformed data or
unsynced cache all default to true.

---

Nitpick comments:
In `@pkg/operator/sync_test.go`:
- Around line 321-323: The test currently uses the single variable
provisioningOSDownloadURL to both decide whether to insert a fake Provisioning
CR and to control its .spec.provisioningOSDownloadURL value, so the empty-string
case never creates a CR and instead hits the IsNotFound fallback; update the
test setup to separate "createCR" from "urlValue" (e.g., keep
provisioningOSDownloadURL as the URL value and add a boolean like
createProvisioningCR or explicitly call the Provisioning CR insertion
unconditionally when you want the CR present) and then add/adjust cases so one
scenario creates a Provisioning object with spec.provisioningOSDownloadURL == ""
and another scenario omits the CR entirely, modifying the code path that
currently inserts the fake Provisioning CR (the test section that populates the
fake Provisioning lister) to use the new boolean/explicit control.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41155044-6c69-43e1-a716-65416f84b74d

📥 Commits

Reviewing files that changed from the base of the PR and between 15c41cf and 30925b3.

📒 Files selected for processing (6)
  • pkg/controller/node/node_controller.go
  • pkg/operator/operator.go
  • pkg/operator/sync.go
  • pkg/operator/sync_test.go
  • test/extended-priv/const.go
  • test/extended-priv/mco_bootimages_skew.go

@djoshy djoshy force-pushed the add-baremetal-skew-management branch 2 times, most recently from 95b5b59 to 99af585 Compare March 20, 2026 13:06
@djoshy
Copy link
Contributor Author

djoshy commented Mar 20, 2026

/payload-abort

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

@djoshy: aborted 2 active payload job(s) for pull request #5768

@djoshy
Copy link
Contributor Author

djoshy commented Mar 20, 2026

/payload-job periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2 periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

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

  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-1of2
  • periodic-ci-openshift-machine-config-operator-release-4.22-periodics-e2e-metal-ipi-ovn-ipv4-mco-disruptive-2of2

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/dccb8580-245d-11f1-9da3-2f1f1fadda57-0

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/operator/sync_test.go (1)

798-819: Test harness correctly mirrors production setup.

The dynamic lister setup properly uses the metal3.io/v1alpha1/provisionings GVR matching production code.

One observation: when provisioningOSDownloadURL is empty, no Provisioning CR is added to the indexer (testing the "CR not found" scenario). Consider also adding a test case where the CR exists but has an empty provisioningOSDownloadURL field, to ensure both "not found" and "empty URL" scenarios produce the expected None enforcement.

💡 Optional: Add test case for CR-exists-with-empty-URL
{
    name:                            "BareMetal platform, CR exists with empty provisioningOSDownloadURL, skew enforcement None expected",
    infra:                           buildInfra(withPlatformType(configv1.BareMetalPlatformType)),
    mcop:                            buildMachineConfigurationWithNoBootImageConfiguration(),
    clusterVersion:                  buildClusterVersion("4.18.0"),
    annotationExpected:              false,
    provisioningOSDownloadURL:       "PRESENT_BUT_EMPTY", // special sentinel
    expectedManagedBootImagesStatus: opv1.ManagedBootImages{},
    expectedSkewEnforcementStatus:   apihelpers.GetSkewEnforcementStatusNone(),
},

This would require updating the harness to handle a sentinel value that adds the CR with an empty URL field.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/sync_test.go` around lines 798 - 819, The test currently only
covers "CR missing" vs "CR present with non-empty URL"; add a test case that
represents "CR exists but provisioningOSDownloadURL is empty" and update the
provisioningIndexer creation logic to recognize a sentinel (e.g.,
provisioningOSDownloadURL == "PRESENT_BUT_EMPTY") and in that branch Add an
Unstructured Provisioning object whose spec.provisioningOSDownloadURL is the
empty string; ensure the new case sets provisioningOSDownloadURL to the sentinel
and asserts expectedManagedBootImagesStatus and expectedSkewEnforcementStatus
(e.g., GetSkewEnforcementStatusNone()) so the Operator (provisioningLister /
provisioningIndexer) is exercised for the empty-URL path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/operator/sync_test.go`:
- Around line 798-819: The test currently only covers "CR missing" vs "CR
present with non-empty URL"; add a test case that represents "CR exists but
provisioningOSDownloadURL is empty" and update the provisioningIndexer creation
logic to recognize a sentinel (e.g., provisioningOSDownloadURL ==
"PRESENT_BUT_EMPTY") and in that branch Add an Unstructured Provisioning object
whose spec.provisioningOSDownloadURL is the empty string; ensure the new case
sets provisioningOSDownloadURL to the sentinel and asserts
expectedManagedBootImagesStatus and expectedSkewEnforcementStatus (e.g.,
GetSkewEnforcementStatusNone()) so the Operator (provisioningLister /
provisioningIndexer) is exercised for the empty-URL path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2ba35981-8341-4b35-b398-0faf00671b0b

📥 Commits

Reviewing files that changed from the base of the PR and between 30925b3 and 99af585.

📒 Files selected for processing (5)
  • pkg/operator/operator.go
  • pkg/operator/sync.go
  • pkg/operator/sync_test.go
  • test/extended-priv/const.go
  • test/extended-priv/mco_bootimages_skew.go
✅ Files skipped from review due to trivial changes (1)
  • test/extended-priv/const.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/extended-priv/mco_bootimages_skew.go
  • pkg/operator/operator.go
  • pkg/operator/sync.go

@djoshy djoshy force-pushed the add-baremetal-skew-management branch from 99af585 to 9971d2f Compare March 20, 2026 13:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
pkg/operator/sync.go (1)

2552-2553: Delay the install-version lookup until it is actually needed.

getOCPVersionFromClusterVersion() is called before branches that immediately return None, so it can do unnecessary lister work and emit warnings for statuses that never use an OCP version.

Suggested adjustment
-	// Grab install time OCP version
-	ocpVersionAtInstall := optr.getOCPVersionFromClusterVersion()
-
 	// Spec override takes priority over all platform defaults.
 	if mcop.Spec.BootImageSkewEnforcement != (opv1.BootImageSkewEnforcementConfig{}) {
 		if mcop.Spec.BootImageSkewEnforcement.Mode == opv1.BootImageSkewEnforcementConfigModeManual {
 			newMachineConfigurationStatus.BootImageSkewEnforcementStatus = opv1.BootImageSkewEnforcementStatus{
 				Mode:   opv1.BootImageSkewEnforcementModeStatusManual,
@@
 	// SNO clusters do not scale; skew enforcement is not applicable.
 	if infra.Status.ControlPlaneTopology == configv1.SingleReplicaTopologyMode {
 		newMachineConfigurationStatus.BootImageSkewEnforcementStatus = apihelpers.GetSkewEnforcementStatusNone()
 		return
 	}
 
+	// Grab install time OCP version only when Automatic/Manual is needed.
+	ocpVersionAtInstall := optr.getOCPVersionFromClusterVersion()
+
 	// Platforms with automated boot image updates: mode follows ManagedBootImages configuration.

Also applies to: 2575-2582

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/sync.go` around lines 2552 - 2553, The current code eagerly
calls getOCPVersionFromClusterVersion() (ocpVersionAtInstall) before
early-return branches, causing unnecessary lister work and warnings; change this
to compute the install OCP version only when it's actually required (move the
getOCPVersionFromClusterVersion() call into the branches that construct statuses
needing an install version or wrap it in a small lazy helper). Update the
occurrences around the other spots noted (the block referenced at the later
occurrence) so both places call getOCPVersionFromClusterVersion() only inside
the code paths that build and emit OCP-version-bearing status objects instead of
before early returns.
pkg/operator/sync_test.go (1)

321-322: Add one case for an unsynced Provisioning cache.

pkg/operator/sync.go at Lines 2643-2645 has a safety-critical branch when provisioningListerSynced is false, but this table never hits it. One case wiring provisioningListerSynced: func() bool { return false } would protect that behavior.

Also applies to: 809-830

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/sync_test.go` around lines 321 - 322, Add a new table-driven
test case in pkg/operator/sync_test.go that sets provisioningListerSynced to
func() bool { return false } to exercise the unsynced Provisioning cache branch;
in the new case keep other fields consistent (e.g., provisioningCRPresent and
provisioningOSDownloadURL) and assert the behavior expected when
provisioningListerSynced is false (the safety-critical branch in sync.go that
handles an unsynced cache). Locate the test table used for sync tests (the one
that currently iterates cases including provisioningCRPresent and
provisioningOSDownloadURL) and add this case similarly to the other entries so
the code path guarded by provisioningListerSynced is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/operator/sync_test.go`:
- Around line 321-322: Add a new table-driven test case in
pkg/operator/sync_test.go that sets provisioningListerSynced to func() bool {
return false } to exercise the unsynced Provisioning cache branch; in the new
case keep other fields consistent (e.g., provisioningCRPresent and
provisioningOSDownloadURL) and assert the behavior expected when
provisioningListerSynced is false (the safety-critical branch in sync.go that
handles an unsynced cache). Locate the test table used for sync tests (the one
that currently iterates cases including provisioningCRPresent and
provisioningOSDownloadURL) and add this case similarly to the other entries so
the code path guarded by provisioningListerSynced is covered.

In `@pkg/operator/sync.go`:
- Around line 2552-2553: The current code eagerly calls
getOCPVersionFromClusterVersion() (ocpVersionAtInstall) before early-return
branches, causing unnecessary lister work and warnings; change this to compute
the install OCP version only when it's actually required (move the
getOCPVersionFromClusterVersion() call into the branches that construct statuses
needing an install version or wrap it in a small lazy helper). Update the
occurrences around the other spots noted (the block referenced at the later
occurrence) so both places call getOCPVersionFromClusterVersion() only inside
the code paths that build and emit OCP-version-bearing status objects instead of
before early returns.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: afef5a73-ce4e-4ab6-8c68-f3404a3404da

📥 Commits

Reviewing files that changed from the base of the PR and between 99af585 and 9971d2f.

📒 Files selected for processing (5)
  • pkg/operator/operator.go
  • pkg/operator/sync.go
  • pkg/operator/sync_test.go
  • test/extended-priv/const.go
  • test/extended-priv/mco_bootimages_skew.go
✅ Files skipped from review due to trivial changes (1)
  • test/extended-priv/const.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/extended-priv/mco_bootimages_skew.go
  • pkg/operator/operator.go

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

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

Test name Commit Details Required Rerun command
ci/prow/e2e-hypershift 9971d2f link true /test e2e-hypershift

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants