Skip to content

OCPBUGS-74247: CAPI image overrides aware of registry config#7575

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
clebs:capi-image-overrides
Jan 31, 2026
Merged

OCPBUGS-74247: CAPI image overrides aware of registry config#7575
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
clebs:capi-image-overrides

Conversation

@clebs
Copy link
Copy Markdown
Member

@clebs clebs commented Jan 23, 2026

What this PR does / why we need it:

The current behavior of the CAPI image overrides is not aware of registry configuration and does not apply it, causing CAPI images to be downloaded from quay.io even if a different registry is configured.

To fix the issue:

  • CAPI image overrides now apply registry overrides by using the registry Provider instead of being hardcoded.
  • the override version has been pinned to 4.20.10 instead of a hash.
  • Moved all the logic to the support/backwardscompat package for better isolation and future cleanup.

Which issue(s) this PR fixes:

Fixes OCPBUGS-74247

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jan 23, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@clebs: This pull request references Jira Issue OCPBUGS-74247, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

The current behavior of the CAPI image overrides is not aware of registry configuration and does not apply it, causing CAPI images to be downloaded from quay.io even if a different registry is configured.

To fix the issue:

  • CAPI image overrides now apply registry overrides by using the registry Provider instead of being hardcoded.
  • the override version has been pinned to 4.20.12 instead of a hash.

Which issue(s) this PR fixes:

Fixes OCPBUGS-74247

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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 Jan 23, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jan 23, 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 23, 2026

Walkthrough

Replaces hardcoded CAPI image override logic with a new backwardcompat.GetBackwardCompatibleCAPIImage call (uses release payloads for versions ≥4.21.0), updates hostedcluster controller and platform branches to use it, and refactors payload image lookup into GetPayloadImageFromRelease. Adds tests for the new behavior.

Changes

Cohort / File(s) Summary
CAPI Backward Compatibility Implementation
support/backwardcompat/backwardcompat.go
Adds GetBackwardCompatibleCAPIImage(ctx, pullSecret, releaseProvider, releaseVersion, component) which returns a pinned CAPI image for releases ≥ 4.21.0-0 by querying the release payload, otherwise returns empty string.
CAPI Controller Integration
hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go
Replaces prior hard-coded image-override logic in reconcileCAPIManager with logic that fetches pull secret bytes and calls GetBackwardCompatibleCAPIImage to derive imageOverride when annotation is not set; preserves existing error handling and manager initialization.
Platform-Specific Image Resolution
hypershift-operator/controllers/hostedcluster/internal/platform/platform.go
AWS and Azure branches now call GetBackwardCompatibleCAPIImage when payloadVersion is present and replace the capiImageProvider if a non-empty override is returned. Adds nil-checks around payloadVersion and groups platform _ Platform = ... declarations into a single var (...) block.
Image Metadata Utilities
support/util/imagemetadata.go
Introduces GetPayloadImageFromRelease(ctx, releaseImageProvider, release, component, pullSecret) to perform release lookup and component extraction; GetPayloadImage now delegates to this new function.
Test Coverage
support/backwardcompat/backwardcompat_test.go
Adds tests with a mock releaseinfo.Provider covering versions below, at, and above 4.21.0, error propagation, and missing component cases for GetBackwardCompatibleCAPIImage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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

@openshift-ci openshift-ci Bot added do-not-merge/needs-area area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed do-not-merge/needs-area labels Jan 23, 2026
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 23, 2026

/area hypershift-operator

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 23, 2026

/auto-cc

@openshift-ci openshift-ci Bot requested review from devguyio and sjenning January 23, 2026 08:54
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 23, 2026

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@clebs: This pull request references Jira Issue OCPBUGS-74247, which is invalid:

  • expected the bug to target either version "4.22." or "openshift-4.22.", but it targets "4.21" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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.

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 23, 2026

/test all

Comment thread hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go Outdated
@clebs clebs force-pushed the capi-image-overrides branch 2 times, most recently from 43b8854 to 61189df Compare January 23, 2026 14:23
Comment thread support/backwardcompat/backwardcompat.go Outdated
Comment thread support/backwardcompat/backwardcompat.go Outdated
Comment thread support/backwardcompat/backwardcompat.go Outdated
Comment thread support/util/imagemetadata.go
Copy link
Copy Markdown
Contributor

@devguyio devguyio left a comment

Choose a reason for hiding this comment

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

LGTM given the comments above will be addressed.

@devguyio
Copy link
Copy Markdown
Contributor

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jan 23, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@devguyio: This pull request references Jira Issue OCPBUGS-74247, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @xiuwang

Details

In response to this:

/jira refresh

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 requested a review from xiuwang January 23, 2026 15:16
@devguyio
Copy link
Copy Markdown
Contributor

/test ?

@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD c077134 and 2 for PR HEAD fa4ee58 in total

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 29, 2026

/test e2e-aks

1 similar comment
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 29, 2026

/test e2e-aks

@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 100d202 and 1 for PR HEAD fa4ee58 in total

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

/test e2e-aks-4-21

- capi image overrides now apply registry overrides by using the
  registry Provider instead of being hardcoded.
- the override version has been pinned to 4.20.12

Signed-off-by: Borja Clemente <bclement@redhat.com>
@clebs clebs force-pushed the capi-image-overrides branch from fa4ee58 to c19038b Compare January 30, 2026 08:18
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Jan 30, 2026
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2026
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

/test e2e-aks

@mgencur
Copy link
Copy Markdown
Contributor

mgencur commented Jan 30, 2026

@clebs Do we plan to ship this in 4.21? If yes, we will probably need to document how to use the product in disconnected environment. It is using an image from an older release so users will have to call oc adm release mirror with this older release too so as to get the image mirrored/available. I had to use a workaround with the previous solution and this will need a similar one, see my attempts in https://github.com/openshift/release/pull/73933/changes#diff-e12a43ad1798ff5e7b7d10a8439c3470f48ffe5a281f96afbf565adf21ef71a3R165 I'm mirroring just a single image but for a user it might be easier to just mirror all image from the release.
We're already hitting https://issues.redhat.com/browse/OCPBUGS-74263 in CI. This new solution is better but the image is still not available in disconnected env.

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

@mgencur this override is already on 4.21, this PR fixes the issue where it is not reflecting registry overrides.
And yes, 4.20 images need to be mirrored and it needs to be documented.

I did align with ACM and ARO to make sure they were aware of this and @lahinson took up the item to document this requirement.

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

/test e2e-aks

@devguyio
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2026
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

/test e2e-aks

2 similar comments
@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 30, 2026

/test e2e-aks

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 31, 2026

/test e2e-aks

@clebs
Copy link
Copy Markdown
Member Author

clebs commented Jan 31, 2026

/verified by @xiuwang

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

@clebs: This PR has been marked as verified by @xiuwang.

Details

In response to this:

/verified by @xiuwang

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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jan 31, 2026

@clebs: 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.

@openshift-merge-bot openshift-merge-bot Bot merged commit 940153d into openshift:main Jan 31, 2026
23 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@clebs: Jira Issue Verification Checks: Jira Issue OCPBUGS-74247
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-74247 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

What this PR does / why we need it:

The current behavior of the CAPI image overrides is not aware of registry configuration and does not apply it, causing CAPI images to be downloaded from quay.io even if a different registry is configured.

To fix the issue:

  • CAPI image overrides now apply registry overrides by using the registry Provider instead of being hardcoded.
  • the override version has been pinned to 4.20.12 instead of a hash.
  • Moved all the logic to the support/backwardscompat package for better isolation and future cleanup.

Which issue(s) this PR fixes:

Fixes OCPBUGS-74247

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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.

@clebs clebs deleted the capi-image-overrides branch January 31, 2026 11:55
@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in accepted release 4.22.0-0.nightly-2026-02-02-081748

@clebs
Copy link
Copy Markdown
Member Author

clebs commented May 20, 2026

/cherry-pick release-4.21

@openshift-cherrypick-robot
Copy link
Copy Markdown

@clebs: new pull request created: #8559

Details

In response to this:

/cherry-pick release-4.21

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.

@openshift-ci-robot
Copy link
Copy Markdown

@clebs: Jira Issue OCPBUGS-74247 is in an unrecognized state (Verified) and will not be moved to the MODIFIED state.

Details

In response to this:

What this PR does / why we need it:

The current behavior of the CAPI image overrides is not aware of registry configuration and does not apply it, causing CAPI images to be downloaded from quay.io even if a different registry is configured.

To fix the issue:

  • CAPI image overrides now apply registry overrides by using the registry Provider instead of being hardcoded.
  • the override version has been pinned to 4.20.10 instead of a hash.
  • Moved all the logic to the support/backwardscompat package for better isolation and future cleanup.

Which issue(s) this PR fixes:

Fixes OCPBUGS-74247

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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.

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. area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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.

9 participants