Skip to content

OKD-443: Handle missing OSImageStream CR on OKD SCOS during upgrades - #31592

Open
pskrbasu wants to merge 1 commit into
openshift:release-5.0from
pskrbasu:fix-osimagestream-okd-upgrade-5.0
Open

OKD-443: Handle missing OSImageStream CR on OKD SCOS during upgrades#31592
pskrbasu wants to merge 1 commit into
openshift:release-5.0from
pskrbasu:fix-osimagestream-okd-upgrade-5.0

Conversation

@pskrbasu

@pskrbasu pskrbasu commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Handle the case where the OSImageStream CR doesn't exist on OKD SCOS during upgrades from pre-OSImageStream versions
  • Validates node OS directly via NodeInfo.OSImage instead of requiring the CR
  • Fixes the [sig-ci] [Early] prow job name should match os version test failure blocking OKD SCOS 5.0 promoted releases

Details

During upgrades from a version that didn't support OSImageStream (e.g., 4.22→5.0 or ec.5→ec.8), the MCO may not create the OSImageStream CR during the upgrade. The test expects it to exist on >= 4.23 clusters, causing a hard failure at job_names.go:317.

The fix adds an isOKD check in the IsNotFound block (before the existing pre-4.23 version check) that validates node OS directly using a new validateNodeOS helper. This maps stream identifiers to expected OS markers (centos-10"CentOS Stream CoreOS 10.") and checks all nodes match.

OCP is completely unaffected — the new code only triggers when both isOKD=true AND apierrors.IsNotFound(err). A missing CR on non-OKD >= 4.23 clusters still fails as before.

Why release-5.0

The openshift-tests binary in 5.0 payloads comes from this branch. The ec.8 promoted release is currently blocked by this test failure. Targeting release-5.0 gets the fix into the next 5.0 nightly payload. Will cherry-pick to main after merge.

Test plan

  • go vet passes
  • Verify OKD SCOS 5.0 upgrade job passes with a payload containing this change
  • Verify OCP upgrade jobs are unaffected

References

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 2, 2026
@openshift-ci-robot

openshift-ci-robot commented Sep 2, 2026

Copy link
Copy Markdown

@pskrbasu: This pull request references OKD-443 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Handle the case where the OSImageStream CR doesn't exist on OKD SCOS during upgrades from pre-OSImageStream versions
  • Validates node OS directly via NodeInfo.OSImage instead of requiring the CR
  • Fixes the [sig-ci] [Early] prow job name should match os version test failure blocking OKD SCOS 5.0 promoted releases

Details

During upgrades from a version that didn't support OSImageStream (e.g., 4.22→5.0 or ec.5→ec.8), the MCO may not create the OSImageStream CR during the upgrade. The test expects it to exist on >= 4.23 clusters, causing a hard failure at job_names.go:317.

The fix adds an isOKD check in the IsNotFound block (before the existing pre-4.23 version check) that validates node OS directly using a new validateNodeOS helper. This maps stream identifiers to expected OS markers (centos-10"CentOS Stream CoreOS 10.") and checks all nodes match.

OCP is completely unaffected — the new code only triggers when both isOKD=true AND apierrors.IsNotFound(err). A missing CR on non-OKD >= 4.23 clusters still fails as before.

Why release-5.0

The openshift-tests binary in 5.0 payloads comes from this branch. The ec.8 promoted release is currently blocked by this test failure. Targeting release-5.0 gets the fix into the next 5.0 nightly payload. Will cherry-pick to main after merge.

Test plan

  • go vet passes
  • Verify OKD SCOS 5.0 upgrade job passes with a payload containing this change
  • Verify OCP upgrade jobs are unaffected

References

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Team

Run ID: 030a7cff-b675-4c6e-97e3-2108fa38768b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@pskrbasu
pskrbasu force-pushed the fix-osimagestream-okd-upgrade-5.0 branch 2 times, most recently from 35a1961 to 7c0b734 Compare September 3, 2026 03:27
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

Comment thread test/extended/ci/job_names.go Outdated
// validateNodeOS checks that all nodes are running the expected OS for the given stream.
// This is used as a fallback when the OSImageStream CR is not yet available (e.g., during
// upgrades from a version that did not support OSImageStream).
func validateNodeOS(coreClient kclientset.Interface, expectedStream string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this function is relevant only to OKD so lets make it as such and name it as such - we can drop the rhel-9 and rhel10 markers

@pskrbasu
pskrbasu force-pushed the fix-osimagestream-okd-upgrade-5.0 branch from 7c0b734 to 2c1fb97 Compare September 3, 2026 17:39
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

Comment thread test/extended/ci/job_names.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the function where I'd expect the fix to be, not a new function + "if OKD", as the problem this bugfix describes applies to OCP too.
I think what has happened is that I didn't consider that OKD 4.22 was already using CoreOS 10, so I hardcoded 9 for both without considering this point.
The lack of OS Image Streams for < 4.23/5.0 versions is already covered with this function that performs the validation using basically what you are trying now.

Can we do something like this?

func validatePreOSImageStreamsNodeOS(coreClient kclientset.Interface, isOKD bool) {
	// In clusters with no OSImageStreams the nodes should be always RHEL 9
	nodes, err := coreClient.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
	o.Expect(err).NotTo(o.HaveOccurred(), "Error listing nodes")

	targetVersion := 9
	if isOKD {
		// OKD was already using CoreOS 10 in pre-OSImageStreams versions like 4.22
		targetVersion = 10
	}

	for _, node := range nodes.Items {
		osImage := node.Status.NodeInfo.OSImage
		o.Expect(osImage).To(o.ContainSubstring(fmt.Sprintf("CoreOS %d.", targetVersion)), "Pre OS Image Stream cluster should use RHEL 9 nodes")
	}
}

@pskrbasu
pskrbasu force-pushed the fix-osimagestream-okd-upgrade-5.0 branch 2 times, most recently from 727da1d to cac8665 Compare September 4, 2026 06:30
The validatePreOSImageStreamsNodeOS function hardcoded a check for
"CoreOS 9." which is correct for OCP but wrong for OKD, which was
already using CoreOS 10 in pre-OSImageStreams versions like 4.22.

This caused the "prow job name should match os version" test to fail
during 4.22→5.0 OKD upgrades: the test correctly identified the
cluster as pre-OSImageStreams (< 4.23) but then failed because the
nodes were running CentOS Stream CoreOS 10, not CoreOS 9.

Make validatePreOSImageStreamsNodeOS OKD-aware by accepting an isOKD
parameter and checking CoreOS 10 for OKD clusters. OCP behavior is
unchanged.
@pskrbasu
pskrbasu force-pushed the fix-osimagestream-okd-upgrade-5.0 branch from cac8665 to 2bb7b76 Compare September 4, 2026 07:19
@pablintino

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 4, 2026
@pskrbasu

pskrbasu commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

/cc @neisw

@openshift-ci
openshift-ci Bot requested a review from neisw September 4, 2026 07:22
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@petr-muller

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pablintino, petr-muller, pskrbasu

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 Sep 4, 2026
@petr-muller

Copy link
Copy Markdown
Member

/label backport-risk-assessed

@openshift-ci openshift-ci Bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Sep 4, 2026
@openshift-ci

openshift-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@pskrbasu: all tests passed!

Full PR test history. Your PR dashboard.

Details

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

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. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.