Skip to content

test#10427

Draft
danilo-gemoli wants to merge 1 commit intoopenshift:mainfrom
danilo-gemoli:test
Draft

test#10427
danilo-gemoli wants to merge 1 commit intoopenshift:mainfrom
danilo-gemoli:test

Conversation

@danilo-gemoli
Copy link

@openshift-ci openshift-ci bot requested a review from isabella-janssen March 24, 2026 13:50
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Walkthrough

The changes add support for propagating OS image stream information through the machine generation pipeline. A utility constant and helper function are introduced, AWS machine set inputs are extended with a new field, and master/worker generation orchestration threads this value through platform-specific machine creation calls.

Changes

Cohort / File(s) Summary
Utility Infrastructure
pkg/asset/machines/util.go
Added OSImageStreamLabel constant, new GetOSImageStream() helper function with fallback to default OS image stream, and rhcos package import.
AWS Platform
pkg/asset/machines/aws/machines.go, pkg/asset/machines/aws/machinesets.go
machines.go includes commented-out example code; machinesets.go extends MachineSetInput struct with OSImageStream field, refactors label map naming, and applies the OS image stream label to machine and machine template specs.
Machine Orchestration
pkg/asset/machines/master.go, pkg/asset/machines/worker.go
Threading of GetOSImageStream(ic) argument through GCP and Azure machine/machineset generation call sites; AWS worker passes the value via struct field.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ 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.11.3)

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.

@danilo-gemoli danilo-gemoli marked this pull request as draft March 24, 2026 13:51
@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 24, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 24, 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 rvanderp3 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

@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 (3)
pkg/asset/machines/master.go (1)

271-272: AWS master machines don't receive the OS image stream value.

The call to aws.Machines has GetOSImageStream(ic) commented out, while GCP and Azure calls include it. This aligns with the commented-out implementation in aws/machines.go, but creates inconsistent behavior across platforms.

If this is intentional WIP, consider adding a brief comment explaining the plan or opening a tracking issue.

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

In `@pkg/asset/machines/master.go` around lines 271 - 272, The call to
aws.Machines is missing the GetOSImageStream(ic) argument, causing AWS master
machines to not receive the OS image stream; update the aws.Machines invocation
to pass GetOSImageStream(ic) (matching GCP/Azure calls) and ensure aws.Machines
and the AWS implementation in aws/machines.go accept and use that parameter, or
if this omission is intentional WIP, add a brief inline comment at the
aws.Machines call referencing the tracking issue/PR and the reason for omission
so behavior is explicit.
pkg/asset/machines/aws/machinesets.go (1)

116-118: Use the OSImageStreamLabel constant instead of hardcoding the label key.

The TODO at line 116 acknowledges this. The label key "machine.openshift.io/os-image-stream" is hardcoded here and at line 157, but OSImageStreamLabel is already defined in pkg/asset/machines/util.go. Using the constant improves maintainability.

♻️ Suggested refactor
-		// TODO: use const for label
-		machineSpecLabels["machine.openshift.io/os-image-stream"] = in.OSImageStream
+		machineSpecLabels[machines.OSImageStreamLabel] = in.OSImageStream

And at line 157:

-							"machine.openshift.io/os-image-stream":          in.OSImageStream,
+							machines.OSImageStreamLabel:                     in.OSImageStream,

This requires importing the parent machines package (may need alias to avoid cycle) or moving the constant to a shared location.

Also applies to: 157-157

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

In `@pkg/asset/machines/aws/machinesets.go` around lines 116 - 118, Replace the
hardcoded label key "machine.openshift.io/os-image-stream" in machinesets.go
(the machineSpecLabels assignments) with the existing OSImageStreamLabel
constant defined in pkg/asset/machines/util.go; update imports or add an alias
import for the parent machines package to reference util.OSImageStreamLabel (or
move the constant to a shared package if importing causes a cycle) and change
both occurrences (the assignment at machineSpecLabels[...] = in.OSImageStream
and the other use at the second occurrence) to use that constant.
pkg/asset/machines/aws/machines.go (1)

44-45: Clarify the intended behavior for OS image stream labels on AWS Machines and ControlPlaneMachineSets.

The commented-out code and TODOs suggest uncertainty about whether the machine.openshift.io/os-image-stream label should be set on individual Machine objects and ControlPlaneMachineSet templates. Meanwhile, machinesets.go actively sets this label.

This inconsistency may be intentional (per the TODOs), but consider:

  1. Removing the commented code if the decision is to not add labels here
  2. Implementing the labels if they should be consistent with MachineSet behavior

Also applies to: 102-104, 184-185

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

In `@pkg/asset/machines/aws/machines.go` around lines 44 - 45, Clarify and make
consistent the OS image stream label behavior in Machines: decide whether to
apply the "machine.openshift.io/os-image-stream" label on individual Machine
objects and on the ControlPlaneMachineSet template used in Machines (function
Machines) to match machinesets.go; then either remove the commented-out label
code and TODOs in Machines (and corresponding commented blocks around
ControlPlaneMachineSet template creation) if labels should not be added here, or
implement setting the label on each Machine and on the ControlPlaneMachineSet
template (same key/value used in machinesets.go) so behavior is consistent;
update any related TODOs/comments to reflect the decision.
🤖 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/asset/machines/worker.go`:
- Line 557: The calls to azure.MachineSets(...) and gcp.MachineSets(...) are
supplying GetOSImageStream(ic) but their function signatures still expect one
fewer argument; update the azure.MachineSets and gcp.MachineSets function
signatures (and any related MachineSetInput/parameter handling inside those
functions) to accept and propagate the OS image stream parameter (same type as
used by AWS's MachineSetInput.OSImageStream) so the callers at the spots using
GetOSImageStream(ic) compile and the OS image stream is used consistently across
MachineSets implementations.

---

Nitpick comments:
In `@pkg/asset/machines/aws/machines.go`:
- Around line 44-45: Clarify and make consistent the OS image stream label
behavior in Machines: decide whether to apply the
"machine.openshift.io/os-image-stream" label on individual Machine objects and
on the ControlPlaneMachineSet template used in Machines (function Machines) to
match machinesets.go; then either remove the commented-out label code and TODOs
in Machines (and corresponding commented blocks around ControlPlaneMachineSet
template creation) if labels should not be added here, or implement setting the
label on each Machine and on the ControlPlaneMachineSet template (same key/value
used in machinesets.go) so behavior is consistent; update any related
TODOs/comments to reflect the decision.

In `@pkg/asset/machines/aws/machinesets.go`:
- Around line 116-118: Replace the hardcoded label key
"machine.openshift.io/os-image-stream" in machinesets.go (the machineSpecLabels
assignments) with the existing OSImageStreamLabel constant defined in
pkg/asset/machines/util.go; update imports or add an alias import for the parent
machines package to reference util.OSImageStreamLabel (or move the constant to a
shared package if importing causes a cycle) and change both occurrences (the
assignment at machineSpecLabels[...] = in.OSImageStream and the other use at the
second occurrence) to use that constant.

In `@pkg/asset/machines/master.go`:
- Around line 271-272: The call to aws.Machines is missing the
GetOSImageStream(ic) argument, causing AWS master machines to not receive the OS
image stream; update the aws.Machines invocation to pass GetOSImageStream(ic)
(matching GCP/Azure calls) and ensure aws.Machines and the AWS implementation in
aws/machines.go accept and use that parameter, or if this omission is
intentional WIP, add a brief inline comment at the aws.Machines call referencing
the tracking issue/PR and the reason for omission so behavior is explicit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c96c851e-5167-4302-969b-94d2bffe94c1

📥 Commits

Reviewing files that changed from the base of the PR and between 883a6d8 and feb9dce.

📒 Files selected for processing (5)
  • pkg/asset/machines/aws/machines.go
  • pkg/asset/machines/aws/machinesets.go
  • pkg/asset/machines/master.go
  • pkg/asset/machines/util.go
  • pkg/asset/machines/worker.go

Role: pool.Name,
UserDataSecret: workerUserDataSecretName,
Hosts: dHosts,
OSImageStream: GetOSImageStream(ic),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify MachineSets function signatures in azure and gcp packages

echo "=== Azure MachineSets signature ==="
ast-grep --pattern 'func MachineSets($$$) ($$$) {
  $$$
}' | grep -A2 "azure/machinesets.go" || rg -n "^func MachineSets" --type go -g '**/azure/machinesets.go'

echo "=== GCP MachineSets signature ==="
ast-grep --pattern 'func MachineSets($$$) ($$$) {
  $$$
}' | grep -A2 "gcp/machinesets.go" || rg -n "^func MachineSets" --type go -g '**/gcp/machinesets.go'

Repository: openshift/installer

Length of output: 14768


🏁 Script executed:

# Check the actual function calls in worker.go at the mentioned lines
echo "=== Worker.go lines 555-560 (around line 557 for AWS) ==="
sed -n '555,560p' pkg/asset/machines/worker.go

echo "=== Worker.go lines 625-635 (around line 629 for Azure) ==="
sed -n '625,635p' pkg/asset/machines/worker.go

echo "=== Worker.go lines 663-673 (around line 667 for GCP) ==="
sed -n '663,673p' pkg/asset/machines/worker.go

echo "=== Check MachineSetInput struct in aws package ==="
rg -n "type MachineSetInput" --type go -g '**/aws/**'

echo "=== Check GetOSImageStream function ==="
rg -n "GetOSImageStream" --type go -A 2

Repository: openshift/installer

Length of output: 3672


🏁 Script executed:

# Verify the exact function signatures to confirm argument count mismatch
echo "=== Azure MachineSets signature (parameters) ==="
sed -n '21p' pkg/asset/machines/azure/machinesets.go | sed 's/func MachineSets(//' | sed 's/) \(\[//'

echo "=== GCP MachineSets signature (parameters) ==="
sed -n '18p' pkg/asset/machines/gcp/machinesets.go | sed 's/func MachineSets(//' | sed 's/) \(\[//'

# Check MachineSetInput to confirm AWS accepts OSImageStream
echo "=== MachineSetInput struct ==="
sed -n '19,45p' pkg/asset/machines/aws/machinesets.go

Repository: openshift/installer

Length of output: 1202


🏁 Script executed:

# Get full Azure and GCP MachineSets signatures to check if osImageStream was added
echo "=== Full Azure MachineSets signature ==="
head -1 pkg/asset/machines/azure/machinesets.go | grep -A 1 "^package"
sed -n '21p' pkg/asset/machines/azure/machinesets.go

echo "=== Full GCP MachineSets signature ==="
sed -n '18p' pkg/asset/machines/gcp/machinesets.go

# Check if there are multiple versions or overloads
echo "=== All azure.MachineSets definitions ==="
rg "func MachineSets" pkg/asset/machines/azure/ --type go -A 1

echo "=== All gcp.MachineSets definitions ==="
rg "func MachineSets" pkg/asset/machines/gcp/ --type go -A 1

Repository: openshift/installer

Length of output: 1310


🏁 Script executed:

# Double-check the exact argument count being passed to confirm the mismatch
echo "=== Line 629 (Azure call) - count arguments ==="
sed -n '629p' pkg/asset/machines/worker.go | tr ',' '\n' | nl

echo "=== Line 667 (GCP call) - count arguments ==="
sed -n '667p' pkg/asset/machines/worker.go | tr ',' '\n' | nl

Repository: openshift/installer

Length of output: 257


🏁 Script executed:

# Check the exact argument count being passed
echo "=== Line 629 (Azure call) ==="
sed -n '629p' pkg/asset/machines/worker.go

echo "=== Line 667 (GCP call) ==="
sed -n '667p' pkg/asset/machines/worker.go

# Count commas to verify argument count
echo "=== Azure arguments (count commas + 1) ==="
sed -n '629p' pkg/asset/machines/worker.go | grep -o ',' | wc -l

echo "=== GCP arguments (count commas + 1) ==="
sed -n '667p' pkg/asset/machines/worker.go | grep -o ',' | wc -l

Repository: openshift/installer

Length of output: 538


Azure and GCP function signatures need updating to accept the OS image stream parameter.

The code at lines 629 and 667 passes GetOSImageStream(ic) to azure.MachineSets() and gcp.MachineSets(), but neither function signature has been updated to accept this parameter:

  • Azure (line 629): Passing 10 arguments; function accepts only 9
  • GCP (line 667): Passing 7 arguments; function accepts only 6

The AWS implementation is correct—MachineSetInput struct includes the OSImageStream field. Update the Azure and GCP MachineSets() function signatures to accept the OS image stream parameter, or adjust the calling code.

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

In `@pkg/asset/machines/worker.go` at line 557, The calls to
azure.MachineSets(...) and gcp.MachineSets(...) are supplying
GetOSImageStream(ic) but their function signatures still expect one fewer
argument; update the azure.MachineSets and gcp.MachineSets function signatures
(and any related MachineSetInput/parameter handling inside those functions) to
accept and propagate the OS image stream parameter (same type as used by AWS's
MachineSetInput.OSImageStream) so the callers at the spots using
GetOSImageStream(ic) compile and the OS image stream is used consistently across
MachineSets implementations.

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant