CNTRLPLANE-3553: feat(nodepool): thread streamName through all platform callers#8834
CNTRLPLANE-3553: feat(nodepool): thread streamName through all platform callers#8834sdminonne wants to merge 2 commits into
Conversation
Wire the osImageStream API field into the NodePool controller: - Validate spec.osImageStream via GetRHELStream before config generation (fail fast on invalid stream/version/runc combinations). - Return StreamRHEL9 (not "") for implicit pre-5.0 releases so that downstream consumers like StreamForName() always receive a concrete stream name, avoiding errors when legacy StreamMetadata is removed. - Normalize rhelStream in rolloutConfig so that setting the default stream does not change the config hash (no spurious fleet-wide rollouts). - Keep resolvedRHELStream on ConfigGenerator (not rolloutConfig) for downstream consumers that need a concrete stream name (GCP, AWS AMI, token secret). - Add getRHELStream wrapper and validateOSImageStream in osstream.go, both delegating to GetRHELStream from stream.go. - Write os-stream key to the token secret for future ignition-server consumption. - Infer status.osImageStream from Machine NodeInfo.OSImage using majority consensus (rhcosStreamFromOSImage, osImageStreamFromMachines, setOSImageStreamStatus in version.go). - Pass resolved stream to defaultNodePoolAMI / setAWSConditions for consistent boot image resolution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire the resolved RHEL stream name through Azure, PowerVS, OpenStack, and KubeVirt platform resolvers so that each platform selects boot image metadata from the correct OS stream (rhel-9 or rhel-10) instead of always using the legacy default. CAPI paths use c.resolvedRHELStream from ConfigGenerator. Condition setter paths resolve the stream via getRHELStream(). All functions that previously accessed releaseImage.StreamMetadata directly now go through releaseImage.StreamForName(streamName). Ref: CNTRLPLANE-3553 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
📝 WalkthroughWalkthroughNodePool reconciliation now derives a concrete RHEL stream from NodePool settings, release versions, and machine OS images, stores the observed stream in status, validates configured OS image streams before config generation, and includes the normalized stream in rollout hashing. AWS, Azure, GCP, OpenStack, PowerVS, and KubeVirt image selection paths now pass the resolved stream through helper calls. Tests were updated and expanded for the new stream-aware behavior. Sequence Diagram(s)sequenceDiagram
participant NodePoolReconciler
participant setOSImageStreamStatus
participant osImageStreamFromMachines
participant validMachineConfigCondition
participant validateOSImageStream
participant NodePool.Status.OSImageStream
NodePoolReconciler->>setOSImageStreamStatus: refresh observed stream
setOSImageStreamStatus->>osImageStreamFromMachines: infer from Machine.Status.NodeInfo.OSImage
osImageStreamFromMachines-->>setOSImageStreamStatus: StreamRHEL9 or StreamRHEL10
setOSImageStreamStatus->>NodePool.Status.OSImageStream: set inferred stream
NodePoolReconciler->>validMachineConfigCondition: build machine config
validMachineConfigCondition->>validateOSImageStream: check spec.osImageStream.name
validateOSImageStream-->>validMachineConfigCondition: error or nil
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sdminonne The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
hypershift-operator/controllers/nodepool/openstack/openstack_test.go (1)
293-293: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a named-stream test case.
All updated call sites pass
"", which routes through the legacyStreamMetadatafallback inStreamForName. The newOSStreams/named-stream branch (e.g."rhel-9"/"rhel-10") — the actual purpose of this PR — isn't exercised here. A table entry that populatesOSStreamsand passes a concrete stream name would close that gap.Also applies to: 358-358, 472-472
🤖 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 `@hypershift-operator/controllers/nodepool/openstack/openstack_test.go` at line 293, Add a table-driven named-stream test case for OpenstackDefaultImage so the new OSStreams path is covered instead of only the legacy StreamMetadata fallback. Update the relevant test cases in openstack_test.go to populate OSStreams and pass a concrete stream name like “rhel-9” or “rhel-10” through OpenstackDefaultImage / StreamForName, and keep the existing empty-string cases as fallback coverage. Ensure the added case exercises the branch introduced by this PR at the updated call sites.hypershift-operator/controllers/nodepool/config.go (1)
98-121: 📐 Maintainability & Code Quality | 🔵 TrivialFactor out the default-stream derivation.
config.gore-parses the release version and recomputes the default RHEL stream withGetRHELStream("", version, false), duplicating the same version-aware logic used bygetRHELStream. A shared helper, or returning the default alongside the resolved stream, would keep hash normalization and stream selection aligned ifusesRunchandling changes later.🤖 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 `@hypershift-operator/controllers/nodepool/config.go` around lines 98 - 121, The config hash normalization in config.go duplicates the version-based default RHEL stream logic by re-parsing the release version and calling GetRHELStream("", version, false) separately from getRHELStream. Refactor this so the default stream is derived through a shared helper or returned together with the resolved stream from getRHELStream, and update the normalization logic in the same Config function to use that shared result so hash behavior stays aligned if usesRunc handling changes.
🤖 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 `@hypershift-operator/controllers/nodepool/config.go`:
- Around line 98-121: The config hash normalization in config.go duplicates the
version-based default RHEL stream logic by re-parsing the release version and
calling GetRHELStream("", version, false) separately from getRHELStream.
Refactor this so the default stream is derived through a shared helper or
returned together with the resolved stream from getRHELStream, and update the
normalization logic in the same Config function to use that shared result so
hash behavior stays aligned if usesRunc handling changes.
In `@hypershift-operator/controllers/nodepool/openstack/openstack_test.go`:
- Line 293: Add a table-driven named-stream test case for OpenstackDefaultImage
so the new OSStreams path is covered instead of only the legacy StreamMetadata
fallback. Update the relevant test cases in openstack_test.go to populate
OSStreams and pass a concrete stream name like “rhel-9” or “rhel-10” through
OpenstackDefaultImage / StreamForName, and keep the existing empty-string cases
as fallback coverage. Ensure the added case exercises the branch introduced by
this PR at the updated call sites.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 28adccd3-0671-4206-ac2d-917bb3007eb9
📒 Files selected for processing (27)
hypershift-operator/controllers/nodepool/aws.gohypershift-operator/controllers/nodepool/aws_test.gohypershift-operator/controllers/nodepool/azure.gohypershift-operator/controllers/nodepool/azure_test.gohypershift-operator/controllers/nodepool/capi_test.gohypershift-operator/controllers/nodepool/conditions.gohypershift-operator/controllers/nodepool/config.gohypershift-operator/controllers/nodepool/config_test.gohypershift-operator/controllers/nodepool/gcp.gohypershift-operator/controllers/nodepool/gcp_test.gohypershift-operator/controllers/nodepool/kubevirt.gohypershift-operator/controllers/nodepool/kubevirt/kubevirt.gohypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.gohypershift-operator/controllers/nodepool/nodepool_controller.gohypershift-operator/controllers/nodepool/openstack.gohypershift-operator/controllers/nodepool/openstack/openstack.gohypershift-operator/controllers/nodepool/openstack/openstack_test.gohypershift-operator/controllers/nodepool/osstream.gohypershift-operator/controllers/nodepool/osstream_test.gohypershift-operator/controllers/nodepool/powervs.gohypershift-operator/controllers/nodepool/powervs_test.gohypershift-operator/controllers/nodepool/stream.gohypershift-operator/controllers/nodepool/stream_test.gohypershift-operator/controllers/nodepool/token.gohypershift-operator/controllers/nodepool/token_test.gohypershift-operator/controllers/nodepool/version.gohypershift-operator/controllers/nodepool/version_test.go
|
@sdminonne: This pull request references CNTRLPLANE-3553 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. DetailsIn response to this:
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. |
|
PR needs rebase. DetailsInstructions 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. |
|
Now I have the full picture. Let me compile the final analysis. Test Failure Analysis CompleteJob Information
Test Failure AnalysisErrorSummaryNo Prow CI jobs ran. The Root CauseThe tide Conflicting PRs merged to
PR #8834 touches all of these files as part of threading Additional blocking factors:
Because of the merge conflict, tide cannot merge the PR and all Prow presubmit jobs remain gated in Recommendations
Evidence
|
Summary
streamName) through Azure, PowerVS, OpenStack, and KubeVirt platform resolvers so each platform selects boot image metadata from the correct OS stream (rhel-9 or rhel-10) instead of always using the legacy defaultStreamMetadata.c.resolvedRHELStreamfromConfigGenerator; condition-setter paths resolve viagetRHELStream().releaseImage.StreamMetadatadirectly now go throughreleaseImage.StreamForName(streamName).PR Dependency Graph
OSImageStreamfield to NodePoolGetRHELStream+ stream constantsPlatforms Updated
defaultAzureNodePoolImage,getAzureMarketplaceMetadatagetPowerVSImage,ibmPowerVSMachineTemplateSpec,setPowerVSconditionsOpenstackDefaultImage,OpenStackReleaseImage,MachineTemplateSpec,ReconcileOpenStackImageSpec,PrefixedClusterImageName,setOpenStackConditions,reconcileOpenStackImageCRdefaultImage,GetImage,MachineTemplateSpec,setKubevirtConditionsTest plan
""(empty/default) stream nameOSStreamspopulated onReleaseImage(integration)e2e-aws-upgrade-hypershift-operatorto validate no spurious rolloutsRef: CNTRLPLANE-3553
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes