Skip to content

[release-4.21] OCPBUGS-94179: fix registry override matching and propagation to init containers#8879

Open
avollmer-redhat wants to merge 1 commit into
openshift:release-4.21from
avollmer-redhat:fix/OCPBUGS-94179-combined-backport-4.21
Open

[release-4.21] OCPBUGS-94179: fix registry override matching and propagation to init containers#8879
avollmer-redhat wants to merge 1 commit into
openshift:release-4.21from
avollmer-redhat:fix/OCPBUGS-94179-combined-backport-4.21

Conversation

@avollmer-redhat

@avollmer-redhat avollmer-redhat commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Combined manual backport of #8509 and #8824 to release-4.21.

The cherry-pick bot could not create this backport automatically because the support/util/registryoverride/ package does not exist on release-4.21 (it was introduced on main by #8509), causing merge conflicts.

What this fixes

  1. Registry override substring matching bug (OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509): RegistryMirrorProviderDecorator.Lookup() used strings.Replace which could match substrings inside hostnames (e.g. quay.io inside quay.io.example.com). Replaced with strict longest-prefix matching via new registryoverride.Replace() helper.

  2. Digest/tag separator handling (OCPBUGS-92034: fix registry override matching for digest and tag separators #8824): The strict matching from OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509 only accepted / as a valid separator. Repository-level overrides failed to match digest-based references (repo@sha256:...). Fixed matchesPrefix() to also accept @ (digest) and : (tag, when source contains a path component).

  3. Init container image override propagation (OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509): CPO-managed init containers (e.g. availability-prober) were not getting registry overrides applied because imageprovider.New() populated component images without running them through override logic. Added NewWithRegistryOverrides() and wired it into the HCP controller.

Root cause

Without these fixes, ValidatingAdmissionPolicies in Deny mode block HCP creation because CPO init containers still reference original registries (e.g. quay.io/redhat-user-workloads/...) instead of the configured mirror/ACR.

Changes

  • New: support/util/registryoverride/ package with Replace() and comprehensive tests (18 test cases)
  • Modified: support/releaseinfo/registry_mirror_provider.go — use registryoverride.Replace() instead of strings.Replace
  • Modified: control-plane-operator/.../imageprovider/imageprovider.go — add NewWithRegistryOverrides()
  • Modified: control-plane-operator/.../hostedcontrolplane_controller.go — wire NewWithRegistryOverrides with registry overrides from the release provider

Test plan

  • 18 unit tests for registryoverride.Replace covering boundary matching, longest-prefix, digest/tag separators, false-positive rejection, mutation safety
  • All existing releaseinfo tests pass
  • All existing imageprovider tests pass (compilation verified)

Related

/cc @muraee @sjenning @raelga

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added 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 Jun 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected Jira Issue OCPBUGS-94179 to depend on a bug targeting a version in 4.22.0 and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but no dependents were found

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:

Summary\nCombined manual backport of #8509 and #8824 to release-4.21.\n\nThe cherry-pick bot could not create this backport automatically because the support/util/registryoverride/ package does not exist on release-4.21 (it was introduced on main by #8509), causing merge conflicts.\n\n## What this fixes\n\n1. Registry override substring matching bug (#8509): RegistryMirrorProviderDecorator.Lookup() used strings.Replace which could match substrings inside hostnames (e.g. quay.io inside quay.io.example.com). Replaced with strict longest-prefix matching via new registryoverride.Replace() helper.\n\n2. Digest/tag separator handling (#8824): The strict matching from #8509 only accepted / as a valid separator. Repository-level overrides failed to match digest-based references (repo@sha256:...). Fixed matchesPrefix() to also accept @ (digest) and : (tag, when source contains a path component).\n\n3. Init container image override propagation (#8509): CPO-managed init containers (e.g. availability-prober) were not getting registry overrides applied because imageprovider.New() populated component images without running them through override logic. Added NewWithRegistryOverrides() and wired it into the HCP controller.\n\n## Root cause\nWithout these fixes, ValidatingAdmissionPolicies in Deny mode block HCP creation because CPO init containers still reference original registries (e.g. quay.io/redhat-user-workloads/...) instead of the configured mirror/ACR.\n\n## Changes\n- New: support/util/registryoverride/ package with Replace() and comprehensive tests (18 test cases)\n- Modified: support/releaseinfo/registry_mirror_provider.go — use registryoverride.Replace() instead of strings.Replace\n- Modified: control-plane-operator/.../imageprovider/imageprovider.go — add NewWithRegistryOverrides()\n- Modified: control-plane-operator/.../hostedcontrolplane_controller.go — wire NewWithRegistryOverrides with registry overrides from the release provider\n\n## Test plan\n- [x] 18 unit tests for registryoverride.Replace covering boundary matching, longest-prefix, digest/tag separators, false-positive rejection, mutation safety\n- [x] All existing releaseinfo tests pass\n- [x] All existing imageprovider tests pass (compilation verified)\n\n## Related\n- Upstream PRs: #8509, #8824\n- 4.22 backport: #8877\n- Jira: OCPBUGS-94179, OCPBUGS-85585\n\n/cc @muraee @sjenning @raelga

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.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 549df5ee-777b-4936-903f-e63534b93e5f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@avollmer-redhat

Copy link
Copy Markdown
Author

/label backport-risk-assessed

@openshift-ci

openshift-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@avollmer-redhat: The label(s) backport-risk-assessed cannot be applied or removed, because you are not in one of the allowed teams and are not an allowed user. Must be a member of one of these teams: openshift-patch-managers, openshift-staff-engineers, openshift-release-oversight, openshift-sustaining-engineers

Details

In response to this:

/label backport-risk-assessed

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 openshift-ci Bot requested review from devguyio and sjenning June 30, 2026 16:38
@openshift-ci openshift-ci Bot added 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 Jun 30, 2026
@avollmer-redhat

Copy link
Copy Markdown
Author

/area control-plane-operator
/area hypershift-operator

@avollmer-redhat

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected dependent Jira Issue OCPBUGS-94180 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is New instead
  • expected dependent Jira Issue OCPBUGS-94180 to target a version in 4.22.0, but it targets "4.20.0" 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.

@avollmer-redhat avollmer-redhat force-pushed the fix/OCPBUGS-94179-combined-backport-4.21 branch from a8c2207 to 34efa85 Compare June 30, 2026 21:58
@avollmer-redhat

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected dependent Jira Issue OCPBUGS-94180 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is POST instead
  • expected dependent Jira Issue OCPBUGS-94180 to target a version in 4.22.0, but it targets "4.20.0" 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.

@avollmer-redhat avollmer-redhat force-pushed the fix/OCPBUGS-94179-combined-backport-4.21 branch from 34efa85 to 697d0b5 Compare July 1, 2026 15:23
@avollmer-redhat

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected Jira Issue OCPBUGS-94179 to depend on a bug targeting a version in 4.22.0 and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but no dependents were found

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.

…t containers

Combined manual backport of openshift#8509 and openshift#8824 to release-4.21.
Introduces strict longest-prefix registry override matching and
wires overrides into CPO init container image resolution.
@avollmer-redhat avollmer-redhat force-pushed the fix/OCPBUGS-94179-combined-backport-4.21 branch from 697d0b5 to 9c3c3ac Compare July 1, 2026 16:41
@avollmer-redhat

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected dependent Jira Issue OCPBUGS-94170 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is POST 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.

@avollmer-redhat avollmer-redhat changed the title OCPBUGS-94179: fix registry override matching and propagation to init containers [release-4.21] OCPBUGS-94179: fix registry override matching and propagation to init containers Jul 2, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@avollmer-redhat: This pull request references Jira Issue OCPBUGS-94179, which is invalid:

  • expected dependent Jira Issue OCPBUGS-94170 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is POST 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.

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

Details

In response to this:

Summary

Combined manual backport of #8509 and #8824 to release-4.21.

The cherry-pick bot could not create this backport automatically because the support/util/registryoverride/ package does not exist on release-4.21 (it was introduced on main by #8509), causing merge conflicts.

What this fixes

  1. Registry override substring matching bug (OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509): RegistryMirrorProviderDecorator.Lookup() used strings.Replace which could match substrings inside hostnames (e.g. quay.io inside quay.io.example.com). Replaced with strict longest-prefix matching via new registryoverride.Replace() helper.

  2. Digest/tag separator handling (OCPBUGS-92034: fix registry override matching for digest and tag separators #8824): The strict matching from OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509 only accepted / as a valid separator. Repository-level overrides failed to match digest-based references (repo@sha256:...). Fixed matchesPrefix() to also accept @ (digest) and : (tag, when source contains a path component).

  3. Init container image override propagation (OCPBUGS-85585: tighten registry override matching to strict longest-prefix across release-image consumers #8509): CPO-managed init containers (e.g. availability-prober) were not getting registry overrides applied because imageprovider.New() populated component images without running them through override logic. Added NewWithRegistryOverrides() and wired it into the HCP controller.

Root cause

Without these fixes, ValidatingAdmissionPolicies in Deny mode block HCP creation because CPO init containers still reference original registries (e.g. quay.io/redhat-user-workloads/...) instead of the configured mirror/ACR.

Changes

  • New: support/util/registryoverride/ package with Replace() and comprehensive tests (18 test cases)
  • Modified: support/releaseinfo/registry_mirror_provider.go — use registryoverride.Replace() instead of strings.Replace
  • Modified: control-plane-operator/.../imageprovider/imageprovider.go — add NewWithRegistryOverrides()
  • Modified: control-plane-operator/.../hostedcontrolplane_controller.go — wire NewWithRegistryOverrides with registry overrides from the release provider

Test plan

  • 18 unit tests for registryoverride.Replace covering boundary matching, longest-prefix, digest/tag separators, false-positive rejection, mutation safety
  • All existing releaseinfo tests pass
  • All existing imageprovider tests pass (compilation verified)

Related

/cc @muraee @sjenning @raelga

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.

@raelga raelga left a comment

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.

Cherry picks two already tested and shiped changes.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test verify-deps

@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: avollmer-redhat, raelga
Once this PR has been reviewed and has the lgtm label, please assign csrwng 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

@raelga

raelga commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

/retest

@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@avollmer-redhat: 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-aws 9c3c3ac link true /test e2e-aws
ci/prow/e2e-aks 9c3c3ac link true /test e2e-aks

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.

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

Labels

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/invalid-bug Indicates that a referenced Jira bug is invalid 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants