Skip to content

MCO-2181: Default version switchover#10533

Open
pablintino wants to merge 1 commit intoopenshift:mainfrom
pablintino:mco-2181
Open

MCO-2181: Default version switchover#10533
pablintino wants to merge 1 commit intoopenshift:mainfrom
pablintino:mco-2181

Conversation

@pablintino
Copy link
Copy Markdown
Contributor

@pablintino pablintino commented May 5, 2026

This change makes the installer pick the proper bootimages, ISOs and OS Image Stream depending on FeatureGate presence or build version if there's no FeatureGate at hand.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed inconsistent OS image stream selection and region/AMI validation so platform checks use the same effective stream.
  • Enhancements

    • Improved automatic OS image stream detection and defaulting across platforms, with better support for multiple RHCOS versions and feature-gate-aware defaults.
    • Standardized stream usage for installer outputs (ISO, ignition, marketplace) to reduce mismatches.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 5, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 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-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 5, 2026

@pablintino: This pull request references MCO-2181 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This change makes the installer pick the proper bootimages, ISOs and OS Image Stream depending on FeatureGate presence or build version if there's no FeatureGate at hand.

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

@openshift-ci 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 May 5, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Caution

Review failed

The head commit changed during the review from 00da3d4 to f57f60f.

Walkthrough

Centralizes RHCOS OS image stream selection into new rhcos helpers and updates callsites to use the effective/default stream (instead of reading raw config.OSImageStream or rhcos.DefaultOSImageStream), plus small related filename/error handling and call-signature adjustments.

Changes

OS Image Stream Centralization

Layer / File(s) Summary
Stream Helper Functions
pkg/rhcos/stream.go, pkg/rhcos/stream_scos.go
Adds GetEffectiveOSImageStream(ic *types.InstallConfig) and GetDefaultStreamForInstallConfig(ic *types.InstallConfig); changes GetPayloadImageStreamTag to accept *types.InstallConfig; getStreamFileName/getMarketplaceStreamFileName now return (string, error) and error on empty stream; SCOS variants updated.
Asset Filename Resolution
pkg/rhcos/builds.go
fetchRawCoreOSStream and fetchRawMarketplaceStream resolve JSON filenames via the new get*FileName helpers, return filename-resolution errors, then open the resolved asset file.
RHCOS Fetch & Release
pkg/asset/rhcos/image.go, pkg/asset/rhcos/release.go
Coreos build fetches now use rhcos.GetEffectiveOSImageStream(ic.Config); AWS AMI region checks use the effective stream.
InstallConfig Validation & Platform
pkg/asset/installconfig/aws/platform.go, pkg/asset/installconfig/aws/validation.go, pkg/asset/installconfig/nutanix/validation.go, pkg/asset/installconfig/vsphere/validation.go
AWS region determination uses GetDefaultStreamForInstallConfig(nil) or GetEffectiveOSImageStream(config) where appropriate; nutanix/vsphere validation helpers now accept *types.InstallConfig and derive the effective stream internally.
Manifests & Ignition
pkg/asset/manifests/osimagestream.go, pkg/asset/ignition/bootstrap/common.go
OSImageStream manifest generation and bootstrap template StreamTag now derive stream/tag via GetEffectiveOSImageStream/GetPayloadImageStreamTag(ic) rather than reading ic.OSImageStream directly.
Infrastructure, CLI, and Base ISO defaults
pkg/infrastructure/azure/azure.go, pkg/coreoscli/cmd.go, pkg/asset/imagebased/image/baseiso.go, pkg/asset/rhcos/iso.go
Azure infra and CLI now use GetEffectiveOSImageStream/GetDefaultStreamForInstallConfig(nil); default CoreOS stream getters for ISO metadata now reference the explicit RHCOS9 stream constant rather than the prior default variable.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Installer
    participant rhcos
    participant Assets
    participant Cloud

    CLI->>Installer: invoke (e.g., coreoscli / install)
    Installer->>rhcos: GetDefaultStreamForInstallConfig(nil) or GetEffectiveOSImageStream(ic)
    rhcos-->>Installer: effective OS image stream
    Installer->>Assets: FetchCoreOSBuild(stream)
    Assets-->>Installer: build metadata / AMI regions
    Installer->>Cloud: validate/create images/resources using stream-derived artifact info
    Cloud-->>Installer: infra responses
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'MCO-2181: Default version switchover' clearly summarizes the main objective of the pull request, which is to change the installer to select proper bootimages, ISOs, and OS Image Stream based on FeatureGate presence or build version.
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 PR does not modify any test files. All 15 modified files are non-test source files. No Ginkgo test definitions were added or changed. Check is not applicable.
Test Structure And Quality ✅ Passed The PR contains only production code changes. No Ginkgo test files (_test.go) were modified by this PR, making the custom check for Ginkgo test code quality not applicable to this pull request.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. All changes are to production code, not test code. The check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR contains no new Ginkgo e2e tests. All changed files are production code (package files for installer functionality). The SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies OS image stream selection logic during installation. No deployment manifests, pod scheduling constraints, or topology-unaware assumptions are introduced.
Ote Binary Stdout Contract ✅ Passed PR passes OTE Binary Stdout Contract. New logrus.Warnf calls write to STDERR via hooks. JSON output in printStreamJSON is intentional behavior.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests added. All 15 modified files are production code, not test files. Check not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.1)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vr4manta for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@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: 2

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

Inline comments:
In `@pkg/rhcos/builds.go`:
- Around line 119-123: Update the SCOS build variant functions getStreamFileName
and getMarketplaceStreamFileName to match the main signatures by returning
(string, error) instead of just string; modify their definitions to return the
filename string and a nil error (e.g., return "<filename>", nil) so callers like
the code in builds.go that expect (string, error) compile correctly.

In `@pkg/rhcos/stream.go`:
- Around line 55-63: The function GetDefaultStreamForInstallConfig currently
falls back to getDefaultOSImageStreamForBuildVersion only when ic is nil; change
it to base the fallback on whether the install-config actually configures the
OSStreams feature gate. Update GetDefaultStreamForInstallConfig to: if ic is nil
OR ic.FeatureGate is nil (i.e. the gate is not present) then return
getDefaultOSImageStreamForBuildVersion(), otherwise use
ic.Enabled(features.FeatureGateOSStreams) to choose between
types.OSImageStreamRHCOS10 and types.OSImageStreamRHCOS9. Reference:
GetDefaultStreamForInstallConfig, ic.FeatureGate, ic.Enabled,
features.FeatureGateOSStreams, getDefaultOSImageStreamForBuildVersion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 8aa1aa2e-c457-4716-9eaf-6e98ecfba95d

📥 Commits

Reviewing files that changed from the base of the PR and between f043a6d and 7297780.

📒 Files selected for processing (12)
  • pkg/asset/installconfig/aws/platform.go
  • pkg/asset/installconfig/aws/validation.go
  • pkg/asset/installconfig/nutanix/validation.go
  • pkg/asset/installconfig/vsphere/validation.go
  • pkg/asset/manifests/osimagestream.go
  • pkg/asset/rhcos/image.go
  • pkg/asset/rhcos/release.go
  • pkg/coreoscli/cmd.go
  • pkg/infrastructure/azure/azure.go
  • pkg/rhcos/builds.go
  • pkg/rhcos/stream.go
  • pkg/rhcos/stream_scos.go

Comment thread pkg/rhcos/builds.go
Comment thread pkg/rhcos/stream.go
@pablintino pablintino marked this pull request as ready for review May 8, 2026 08:28
@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 May 8, 2026
@openshift-ci openshift-ci Bot requested review from jcpowermac and jhixson74 May 8, 2026 08:29
Copy link
Copy Markdown

@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

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

Inline comments:
In `@pkg/asset/imagebased/image/baseiso.go`:
- Around line 29-31: The function defaultCoreOSStreamGetter currently hardcodes
types.OSImageStreamRHCOS9 when calling rhcos.FetchCoreOSBuild; replace that
hardcoded stream with the version-driven default stream determination used
elsewhere in the PR (i.e., call the project's helper that computes the default
stream based on build/version metadata and use its result as the stream argument
to rhcos.FetchCoreOSBuild), and only fall back to types.OSImageStreamRHCOS9 if
that helper yields no result; update defaultCoreOSStreamGetter to call that
helper, pass its output into rhcos.FetchCoreOSBuild, and preserve existing error
propagation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 606a94a6-2a53-441a-92d4-c6cb99f7a4d1

📥 Commits

Reviewing files that changed from the base of the PR and between 7297780 and 90501a0.

📒 Files selected for processing (15)
  • pkg/asset/ignition/bootstrap/common.go
  • pkg/asset/imagebased/image/baseiso.go
  • pkg/asset/installconfig/aws/platform.go
  • pkg/asset/installconfig/aws/validation.go
  • pkg/asset/installconfig/nutanix/validation.go
  • pkg/asset/installconfig/vsphere/validation.go
  • pkg/asset/manifests/osimagestream.go
  • pkg/asset/rhcos/image.go
  • pkg/asset/rhcos/iso.go
  • pkg/asset/rhcos/release.go
  • pkg/coreoscli/cmd.go
  • pkg/infrastructure/azure/azure.go
  • pkg/rhcos/builds.go
  • pkg/rhcos/stream.go
  • pkg/rhcos/stream_scos.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/asset/rhcos/iso.go
🚧 Files skipped from review as they are similar to previous changes (8)
  • pkg/infrastructure/azure/azure.go
  • pkg/asset/rhcos/release.go
  • pkg/asset/installconfig/aws/platform.go
  • pkg/rhcos/builds.go
  • pkg/asset/installconfig/vsphere/validation.go
  • pkg/asset/installconfig/nutanix/validation.go
  • pkg/rhcos/stream.go
  • pkg/rhcos/stream_scos.go

Comment on lines 29 to +31
func defaultCoreOSStreamGetter(ctx context.Context) (*stream.Stream, error) {
return rhcos.FetchCoreOSBuild(ctx, rhcos.DefaultOSImageStream)
// TODO @pablintino: Pending removal of the getter concept
return rhcos.FetchCoreOSBuild(ctx, types.OSImageStreamRHCOS9)
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 8, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid hard-coding the default stream to RHCOS9.

Line 31 forces types.OSImageStreamRHCOS9, which bypasses the version-driven default stream switchover logic described in this PR and can fetch the wrong base ISO metadata on newer builds.

Suggested fix
 func defaultCoreOSStreamGetter(ctx context.Context) (*stream.Stream, error) {
 	// TODO `@pablintino`: Pending removal of the getter concept
-	return rhcos.FetchCoreOSBuild(ctx, types.OSImageStreamRHCOS9)
+	return rhcos.FetchCoreOSBuild(ctx, rhcos.GetDefaultStreamForInstallConfig(nil))
 }
📝 Committable suggestion

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

Suggested change
func defaultCoreOSStreamGetter(ctx context.Context) (*stream.Stream, error) {
return rhcos.FetchCoreOSBuild(ctx, rhcos.DefaultOSImageStream)
// TODO @pablintino: Pending removal of the getter concept
return rhcos.FetchCoreOSBuild(ctx, types.OSImageStreamRHCOS9)
func defaultCoreOSStreamGetter(ctx context.Context) (*stream.Stream, error) {
// TODO `@pablintino`: Pending removal of the getter concept
return rhcos.FetchCoreOSBuild(ctx, rhcos.GetDefaultStreamForInstallConfig(nil))
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/imagebased/image/baseiso.go` around lines 29 - 31, The function
defaultCoreOSStreamGetter currently hardcodes types.OSImageStreamRHCOS9 when
calling rhcos.FetchCoreOSBuild; replace that hardcoded stream with the
version-driven default stream determination used elsewhere in the PR (i.e., call
the project's helper that computes the default stream based on build/version
metadata and use its result as the stream argument to rhcos.FetchCoreOSBuild),
and only fall back to types.OSImageStreamRHCOS9 if that helper yields no result;
update defaultCoreOSStreamGetter to call that helper, pass its output into
rhcos.FetchCoreOSBuild, and preserve existing error propagation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is known. The code you are referencing is going to be removed later by #10537.
That said, picking rhel 9 in the meantime is a safe solution. If the user picks RHEL 10 the node will pivot later, like it's doing now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@pablintino, thanks for the context! That makes sense — since defaultCoreOSStreamGetter is slated for removal in #10537 and RHCOS9 serves as a safe interim default (with RHEL 10 nodes pivoting as they do today), keeping the hardcoded value is a reasonable short-term approach. The existing TODO comment in the code also makes the transient nature clear. I'll withdraw the concern.


📝 Learnings were identified and not saved (knowledge base disabled). Enable

@pablintino pablintino force-pushed the mco-2181 branch 2 times, most recently from 00da3d4 to f57f60f Compare May 8, 2026 10:19
@pablintino
Copy link
Copy Markdown
Contributor Author

/test gofmt golint images shellcheck

This change makes the installer pick the proper bootimages, ISOs and OS
Image Stream depending on FeatureGate presence or build version if
there's no FeatureGate at hand.

Signed-off-by: Pablo Rodriguez Nava <git@amail.pablintino.eu>
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

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

Test name Commit Details Required Rerun command
ci/prow/e2e-nutanix-ovn f936615 link false /test e2e-nutanix-ovn
ci/prow/e2e-azurestack f936615 link false /test e2e-azurestack
ci/prow/e2e-azure-default-config f936615 link false /test e2e-azure-default-config
ci/prow/e2e-vsphere-ovn-disk-setup-techpreview f936615 link false /test e2e-vsphere-ovn-disk-setup-techpreview
ci/prow/e2e-aws-ovn-heterogeneous f936615 link false /test e2e-aws-ovn-heterogeneous
ci/prow/e2e-aws-ovn-single-node f936615 link false /test e2e-aws-ovn-single-node
ci/prow/aws-private f936615 link false /test aws-private
ci/prow/e2e-vsphere-ovn-devpreview f936615 link false /test e2e-vsphere-ovn-devpreview
ci/prow/e2e-azure-ovn-shared-vpc f936615 link false /test e2e-azure-ovn-shared-vpc
ci/prow/e2e-vsphere-ovn f936615 link true /test e2e-vsphere-ovn
ci/prow/e2e-vsphere-ovn-hybrid-env f936615 link false /test e2e-vsphere-ovn-hybrid-env
ci/prow/e2e-vsphere-ovn-techpreview f936615 link false /test e2e-vsphere-ovn-techpreview

Full PR test history. Your PR dashboard.

Details

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

Comment thread pkg/coreoscli/cmd.go
if err != nil {
return err
}
var osImageStream types.OSImageStream
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.

Nit: osImageStream := rhcos.GetDefaultStreamForInstallConfig(nil)

Comment thread pkg/coreoscli/cmd.go
return fmt.Errorf("invalid value %q for --stream; must be one of %v", streamFlag, types.OSImageStreamValues)
}
osImageStream = s
} else {
Copy link
Copy Markdown
Contributor

@sadasu sadasu May 8, 2026

Choose a reason for hiding this comment

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

Nit: we won't need this if we initialize osImageStream to rhcos.GetDefaultStreamForInstallConfig(nil) and overwrite it only when streamFlag != "".

Comment thread pkg/rhcos/builds.go
file, err := data.Assets.Open(getStreamFileName(osImageStream))
jsonFile, err := getStreamFileName(osImageStream)
if err != nil {
return nil, err
Copy link
Copy Markdown
Contributor

@sadasu sadasu May 8, 2026

Choose a reason for hiding this comment

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

Nit:

Suggested change
return nil, err
return nil, fmt.Errorf("failed to get CoreOS stream file name: %w", err)

Comment thread pkg/rhcos/stream.go
}
return types.OSImageStreamRHCOS10
}
return getDefaultOSImageStreamForBuildVersion()
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.

When FeatureGate is enabled, default stream is types.OSImageStreamRHCOS10. For every other case, I would think we would want to return getDefaultOSImageStreamForBuildVersion().

Comment thread pkg/rhcos/stream.go
if versionNumber >= 5 {
return types.OSImageStreamRHCOS10
}
return types.OSImageStreamRHCOS9
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.

I am unclear why the OS stream value here is different from the start of the method where we are not able to determine versionString and return types.OSImageStreamRHCOS10.

Comment thread pkg/rhcos/stream.go
}

func getDefaultOSImageStreamForBuildVersion() types.OSImageStream {
versionString, err := version.Version()
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.

BUILD_VERSION is not being set in presubmits, so the version we're getting is being derived from the git tags, which is not what we want:

time="2026-05-08T11:43:29Z" level=debug msg="OpenShift Installer v1.4.22-ec5-76-ga2f36db268f29ead7cd3ffe3b09b425d8ed0b297-dirty"

I think we need to get BUILD_VERSION set before we can proceed with this PR. I'm floating openshift/release#79061 to see if that would be a quick way of achieving this. Otherwise, we probably need to talk to ART or test platform team.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants