Skip to content

MCO-2181: Set OSImageStream default in install-config#10570

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
zaneb:osimagestream-default
May 26, 2026
Merged

MCO-2181: Set OSImageStream default in install-config#10570
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
zaneb:osimagestream-default

Conversation

@zaneb
Copy link
Copy Markdown
Member

@zaneb zaneb commented May 25, 2026

Set the default value for OSImageStream centrally in
SetInstallConfigDefaults() rather than checking for an empty string at
every call site that reads it. This eliminates scattered fallback logic
and wrapper functions that existed solely to provide the default.

Update the feature gate condition for FeatureGateOSStreams to check
against DefaultOSImageStream instead of the empty string, since the
field now always has a value after defaults are applied.

Summary by CodeRabbit

  • Refactor

    • Default OS image stream is now applied centrally when none is specified; generated manifests and host/machine labels use the configured stream directly.
  • Validation

    • Validation tightened: one install mode only accepts the default stream; other modes only allow specific supported streams, rejecting unsupported values.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 25, 2026

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

Set the default value for OSImageStream centrally in
SetInstallConfigDefaults() rather than checking for an empty string at
every call site that reads it. This eliminates scattered fallback logic
and wrapper functions that existed solely to provide the default.

Update the feature gate condition for FeatureGateOSStreams to check
against DefaultOSImageStream instead of the empty string, since the
field now always has a value after defaults are applied.

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-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 25, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Walkthrough

Defaults for OSImageStream were centralized into InstallConfig defaulting; consumer fallbacks and helpers were removed. Downstream validation, RHCOS stream logic, manifest/bootstrap wiring, baremetal label wiring, utility helpers, and tests were updated to read OSImageStream directly or assert the default.

Changes

OSImageStream Default Field Enforcement

Layer / File(s) Summary
Default OSImageStream in InstallConfig
pkg/types/defaults/installconfig.go, pkg/types/defaults/installconfig_test.go
SetInstallConfigDefaults now populates c.OSImageStream with rhcos.DefaultOSImageStream when empty; default builders/tests updated.
Validation updates
pkg/types/validation/installconfig.go, pkg/types/validation/installconfig_test.go, pkg/types/validation/featuregates.go
OSImageStream validation now requires SCOS installs to use the exact default and restricts non-SCOS values to the allowed set; feature-gate condition now compares against the default.
RHCOS stream behavior changes
pkg/rhcos/stream.go, pkg/rhcos/stream_scos.go
RHCOS filename helpers and tag selection no longer treat empty stream as the default; documentation clarified for DefaultOSImageStream.
Bootstrap and OSImageStream manifest generation
pkg/asset/ignition/bootstrap/common.go, pkg/asset/manifests/osimagestream.go
Bootstrap template and OSImageStream manifest now use installConfig.Config.OSImageStream directly without fallback.
Baremetal hosts, machines, and utility label assignment
pkg/asset/machines/baremetal/hosts.go, pkg/asset/machines/baremetal/machines.go, pkg/asset/machines/baremetal/hosts_test.go, pkg/utils/utils.go
Removed consumer fallback helper; host and machine label assignments and provider host selectors now use string(config.OSImageStream) directly; tests updated.
Test expectation updates for OSImageStream
pkg/asset/agent/installconfig_test.go, pkg/asset/installconfig/installconfig_test.go
Added OSImageStream: rhcos.DefaultOSImageStream assertions and imported rhcos in multiple test cases.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

Suggested labels

approved, lgtm

Suggested Reviewers

  • dtantsur
  • iurygregory
🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% 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 accurately reflects the main objective: setting OSImageStream default in install-config by centralizing it in SetInstallConfigDefaults().
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 All test names in the PR are stable and deterministic. No dynamic information (UUIDs, timestamps, generated identifiers) found in any test titles across 5 modified test files.
Test Structure And Quality ✅ Passed No Ginkgo tests exist in repository. All modified test files use standard Go testing framework, not Ginkgo. The custom check is not applicable.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. All changes are to standard Go unit tests and production code. The custom check only applies to new Ginkgo e2e tests, so it is not applicable here.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests—only unit tests in pkg/ using testing.T framework. Custom check for SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only OSImageStream defaults, labels, and validation. No scheduling constraints (affinity, topology spread, nodeSelectors, replica calculations, PDBs) are introduced or modified.
Ote Binary Stdout Contract ✅ Passed PR contains no process-level code (main, init, TestMain, etc.) that writes to stdout. Code changes centralize OSImageStream defaulting with no stdout-writing side effects.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added. PR modifies unit tests (Go testing package) and installer production code only; check does not apply.

✏️ 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.2)

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.

Copy link
Copy Markdown
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Agreed, this is definitely easier to manage 👍

Not sure if this PR is to be merged or included in #10481 👀 Meanwhile, I have some questions...

Comment thread pkg/types/validation/installconfig_test.go Outdated
Comment thread pkg/types/defaults/installconfig.go
The "invalid OSImageStream set" test case sets types.SCOS = true
during test table initialization (inside an immediately-invoked
closure), but the restore function only runs during test execution
of that specific case. This means types.SCOS remains true when
all the test cases before it are executed.

Move the types.SCOS = true assignment into restoreFnFactory,
which runs during test execution, so it doesn't leak into other
test cases.

Assisted-by: Claude Code
@zaneb zaneb force-pushed the osimagestream-default branch from 36e8671 to f75be8b Compare May 25, 2026 23:49
@zaneb
Copy link
Copy Markdown
Member Author

zaneb commented May 26, 2026

I would suggest if we're happy with this approach then we merge this PR and rebase #10481 on top of it (which will allow some extraneous non-ABI-related changes in it to be dropped).

Set the default value for OSImageStream centrally in
SetInstallConfigDefaults() rather than checking for an empty string at
every call site that reads it. This eliminates scattered fallback logic
and wrapper functions that existed solely to provide the default.

Update the feature gate condition for FeatureGateOSStreams to check
against DefaultOSImageStream instead of the empty string, since the
field now always has a value after defaults are applied.

Assisted-by: Claude Code
@zaneb zaneb force-pushed the osimagestream-default branch from f75be8b to a58c93f Compare May 26, 2026 00:38
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.

🧹 Nitpick comments (1)
pkg/types/validation/installconfig_test.go (1)

3088-3088: ⚡ Quick win

Make the supported-values assertion build-tag resilient.

This expected error hardcodes "rhel-9", "rhel-10", which can drift when SCOS/RHCOS defaults differ by build tag. Build the regex from current constants (or assert key substrings) to keep this test stable across variants.

🤖 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/types/validation/installconfig_test.go` at line 3088, The test's
expectedError string hardcodes supported OS values and should be made build-tag
resilient: change the assertion that currently uses expectedError (in the test
case within pkg/types/validation/installconfig_test.go) to construct the
expected message from the package constants or to match key substrings/regex
instead of hardcoding "rhel-9", "rhel-10"; locate the test case where
expectedError is defined and either build the supported-values portion
dynamically from the current supportedOS constants (e.g., the constants that
list supported images/versions used by the validation code) or assert with a
regex/Contains on "Unsupported value" + the invalid value and "supported values"
so the test remains stable across build-tag variants.
🤖 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.

Nitpick comments:
In `@pkg/types/validation/installconfig_test.go`:
- Line 3088: The test's expectedError string hardcodes supported OS values and
should be made build-tag resilient: change the assertion that currently uses
expectedError (in the test case within
pkg/types/validation/installconfig_test.go) to construct the expected message
from the package constants or to match key substrings/regex instead of
hardcoding "rhel-9", "rhel-10"; locate the test case where expectedError is
defined and either build the supported-values portion dynamically from the
current supportedOS constants (e.g., the constants that list supported
images/versions used by the validation code) or assert with a regex/Contains on
"Unsupported value" + the invalid value and "supported values" so the test
remains stable across build-tag variants.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: ee204111-ef64-465d-8f0c-fc60cc454c5e

📥 Commits

Reviewing files that changed from the base of the PR and between f75be8b and a58c93f.

📒 Files selected for processing (15)
  • pkg/asset/agent/installconfig_test.go
  • pkg/asset/ignition/bootstrap/common.go
  • pkg/asset/installconfig/installconfig_test.go
  • pkg/asset/machines/baremetal/hosts.go
  • pkg/asset/machines/baremetal/hosts_test.go
  • pkg/asset/machines/baremetal/machines.go
  • pkg/asset/manifests/osimagestream.go
  • pkg/rhcos/stream.go
  • pkg/rhcos/stream_scos.go
  • pkg/types/defaults/installconfig.go
  • pkg/types/defaults/installconfig_test.go
  • pkg/types/validation/featuregates.go
  • pkg/types/validation/installconfig.go
  • pkg/types/validation/installconfig_test.go
  • pkg/utils/utils.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/types/defaults/installconfig_test.go

Copy link
Copy Markdown
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

I would suggest if we're happy with this approach then we merge this PR and rebase #10481 on top of it (which will allow some extraneous non-ABI-related changes in it to be dropped).

yea, sgtm and it will also help with #10533 (comment) :D

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 26, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 26, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tthvo

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 May 26, 2026
@tthvo
Copy link
Copy Markdown
Member

tthvo commented May 26, 2026

/cc @patrickdillon @pablintino

@pablintino
Copy link
Copy Markdown
Contributor

@tthvo @zaneb The simplification looks good to me as I think it will debloat the code.

@pablintino
Copy link
Copy Markdown
Contributor

/test e2e-aws-ovn-rhcos10-techpreview

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 26, 2026

@zaneb: 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-metal-single-node-live-iso a58c93f link false /test e2e-metal-single-node-live-iso
ci/prow/e2e-agent-compact-ipv4-appliance-diskimage a58c93f link false /test e2e-agent-compact-ipv4-appliance-diskimage
ci/prow/e2e-metal-ovn-two-node-fencing a58c93f link false /test e2e-metal-ovn-two-node-fencing
ci/prow/e2e-metal-ipi-ovn-swapped-hosts a58c93f link false /test e2e-metal-ipi-ovn-swapped-hosts
ci/prow/e2e-agent-4control-ipv4 a58c93f link false /test e2e-agent-4control-ipv4
ci/prow/e2e-agent-two-node-fencing-ipv4 a58c93f link false /test e2e-agent-two-node-fencing-ipv4

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.

@pablintino
Copy link
Copy Markdown
Contributor

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 26, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@pablintino: This PR has been marked as verified by https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_installer/10570/pull-ci-openshift-installer-main-e2e-aws-ovn-rhcos10-techpreview/2059236136831684608.

Details

In response to this:

/verified by https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_installer/10570/pull-ci-openshift-installer-main-e2e-aws-ovn-rhcos10-techpreview/2059236136831684608
Other non-TP RHEL 10 can be considered key for this PR verification

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-merge-bot openshift-merge-bot Bot merged commit e7cb376 into openshift:main May 26, 2026
35 of 41 checks passed
dkhater-redhat added a commit to isabella-janssen/openshift-installer that referenced this pull request May 26, 2026
This change enables support for RHEL 10 (coreos10-) and RHEL 9 (coreos-)
file path differentiation in machine-os-images container and throughout
the agent installer workflow.

Changes:
- Add OSImageStream field to installConfigOverrides in AgentClusterInstall
- Add stream-aware helper functions for file paths in releaseextract.go
- Update ReleasePayload interface and BaseIso to accept osImageStream parameter
- Update GetMetalArtifact to use osImageStream for FetchCoreOSBuild calls
- Add GetOSImageStream() method to AgentManifests following existing patterns
- Update getHashFromInstaller() to accept and use osImageStream parameter
- Fix test to use explicit OSImageStream value instead of empty string
- Rely on SetInstallConfigDefaults() to provide default osImageStream value

This implements the foundation for RHEL 10 support in the agent installer
by allowing the installer to distinguish between RHEL 9 and RHEL 10 boot
artifacts based on the osImageStream annotation.

Depends on openshift#10570 which sets the default OSImageStream centrally.
dkhater-redhat added a commit to isabella-janssen/openshift-installer that referenced this pull request May 26, 2026
This change enables support for RHEL 10 (coreos10-) and RHEL 9 (coreos-)
file path differentiation in machine-os-images container and throughout
the agent installer workflow.

Changes:
- Add OSImageStream field to installConfigOverrides in AgentClusterInstall
- Add stream-aware helper functions for file paths in releaseextract.go
- Update ReleasePayload interface and BaseIso to accept osImageStream parameter
- Update GetMetalArtifact to use osImageStream for FetchCoreOSBuild calls
- Add GetOSImageStream() method to AgentManifests following existing patterns
- Update getHashFromInstaller() to accept and use osImageStream parameter
- Fix test to use explicit OSImageStream value instead of empty string
- Rely on SetInstallConfigDefaults() to provide default osImageStream value

This implements the foundation for RHEL 10 support in the agent installer
by allowing the installer to distinguish between RHEL 9 and RHEL 10 boot
artifacts based on the osImageStream annotation.

Depends on openshift#10570 which sets the default OSImageStream centrally.
dkhater-redhat added a commit to isabella-janssen/openshift-installer that referenced this pull request May 27, 2026
This change enables support for RHEL 10 (coreos10-) and RHEL 9 (coreos-)
file path differentiation in machine-os-images container and throughout
the agent installer workflow.

Changes:
- Add OSImageStream field to installConfigOverrides in AgentClusterInstall
- Add stream-aware helper functions for file paths in releaseextract.go
- Update ReleasePayload interface and BaseIso to accept osImageStream parameter
- Update GetMetalArtifact to use osImageStream for FetchCoreOSBuild calls
- Add GetOSImageStream() method to AgentManifests following existing patterns
- Update getHashFromInstaller() to accept and use osImageStream parameter
- Fix test to use explicit OSImageStream value instead of empty string
- Rely on SetInstallConfigDefaults() to provide default osImageStream value

This implements the foundation for RHEL 10 support in the agent installer
by allowing the installer to distinguish between RHEL 9 and RHEL 10 boot
artifacts based on the osImageStream annotation.

Depends on openshift#10570 which sets the default OSImageStream centrally.
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-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants