Skip to content

OCPBUGS-100066: skip wildcard sources in IDMS/ICSP image reference parsing - #2351

Open
savio87 wants to merge 2 commits into
openshift:mainfrom
savio87:OCPBUGS-100066
Open

OCPBUGS-100066: skip wildcard sources in IDMS/ICSP image reference parsing#2351
savio87 wants to merge 2 commits into
openshift:mainfrom
savio87:OCPBUGS-100066

Conversation

@savio87

@savio87 savio87 commented Aug 6, 2026

Copy link
Copy Markdown

Bug

https://redhat.atlassian.net/browse/OCPBUGS-100066

oc adm node-image create fails with invalid source "*.redhat.com": invalid reference format when the cluster has an ImageDigestMirrorSet (IDMS) containing wildcard domain sources like *.redhat.com or *.redhat.io.

Root Cause

In pkg/cli/image/strategy/onerror.go, the alternativeImageSourcesIDMS() and alternativeImageSourcesICSP() functions call reference.Parse(rdm.Source) on every IDMS/ICSP source entry. Wildcard sources (e.g. *.redhat.com) are valid in the IDMS CRD schema and handled correctly by CRI-O at runtime, but reference.Parse() rejects them because * is not a valid character in a Docker image reference.

Fix

Skip IDMS/ICSP source entries that start with *. before attempting to parse them as Docker image references. These wildcard entries cannot be meaningfully matched to a specific image reference anyway, so skipping them is the correct behavior. A debug-level log message is emitted when a wildcard source is skipped.

Summary by CodeRabbit

Bug Fixes

  • Bug Fixes
    • Wildcard mirror sources beginning with *. are now skipped during image mirror resolution for ICSP and IDMS configurations.
    • Valid mirror entries continue to be used when mixed with wildcard entries.
    • Configurations containing only wildcard sources now correctly fall back to the original image source.
    • Wildcard entries are logged and excluded before further processing.

@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 Aug 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@savio87: This pull request references Jira Issue OCPBUGS-100066, which is invalid:

  • expected the bug to target the "5.0.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:

Bug

https://redhat.atlassian.net/browse/OCPBUGS-100066

oc adm node-image create fails with invalid source "*.redhat.com": invalid reference format when the cluster has an ImageDigestMirrorSet (IDMS) containing wildcard domain sources like *.redhat.com or *.redhat.io.

Root Cause

In pkg/cli/image/strategy/onerror.go, the alternativeImageSourcesIDMS() and alternativeImageSourcesICSP() functions call reference.Parse(rdm.Source) on every IDMS/ICSP source entry. Wildcard sources (e.g. *.redhat.com) are valid in the IDMS CRD schema and handled correctly by CRI-O at runtime, but reference.Parse() rejects them because * is not a valid character in a Docker image reference.

Fix

Skip IDMS/ICSP source entries that start with *. before attempting to parse them as Docker image references. These wildcard entries cannot be meaningfully matched to a specific image reference anyway, so skipping them is the correct behavior. A debug-level log message is emitted when a wildcard source is skipped.

Made with Cursor

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 Aug 6, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: dc69ff96-0475-4cfd-bc57-798030233fc8

📥 Commits

Reviewing files that changed from the base of the PR and between 1e9f985 and 9395484.

📒 Files selected for processing (1)
  • pkg/cli/image/strategy/onerror_test.go

Walkthrough

ICSP and IDMS mirror resolution now logs and skips wildcard sources beginning with *. before parsing or processing. Tests cover mixed and all-wildcard configurations.

Changes

Mirror source filtering

Layer / File(s) Summary
Filter and validate wildcard sources
pkg/cli/image/strategy/onerror.go, pkg/cli/image/strategy/onerror_test.go
ICSP and IDMS processing skips wildcard sources. Tests confirm that valid mirrors remain and all-wildcard configurations return only the original image source.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: atiratree, ingvagund

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bug and the main change: skipping wildcard sources during IDMS and ICSP image reference parsing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 The added subtest names are static literals: "wildcard source is skipped" and "all wildcard sources skipped returns only original"; no generated values or run-varying data appear in titles.
Test Structure And Quality ✅ Passed The added cases use the package's existing table-driven unit-test pattern, add no cluster resources or waits, and reuse assertions with failure context; BeforeEach/AfterEach is not applicable.
Microshift Test Compatibility ✅ Passed The added tests use Go's standard testing package and t.Run; no new Ginkgo e2e tests or MicroShift-incompatible API references were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added wildcard cases are standard Go unit tests using testing.T and t.Run, not Ginkgo e2e tests; they contain no multi-node or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes only image mirror resolution and tests in pkg/cli/image/strategy; it adds no manifests, controllers, workloads, replicas, affinity, node selectors, tolerations, or PDBs.
Ote Binary Stdout Contract ✅ Passed The PR changes image-strategy logging and unit tests only; it adds no process-level stdout writes, and the OTE main uses klog, whose default output is stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added wildcard cases are standard Go tests in onerror_test.go using TestOnErrorICSPStrategy/TestOnErrorIDMSStrategy, not Ginkgo e2e tests, and contain no IPv4 or external-connectivity assumptions.
No-Weak-Crypto ✅ Passed The PR changes only wildcard-source filtering, logging, and tests; the added lines contain no weak crypto algorithms, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The patch changes only Go files and adds no container or Kubernetes privilege settings, including privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed The new ICSP and IDMS log messages are fixed strings; they do not emit wildcard sources, credentials, identifiers, hostnames, or customer data.
✨ 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.

@openshift-ci
openshift-ci Bot requested review from atiratree and ingvagabund August 6, 2026 09:36
@savio87

savio87 commented Aug 6, 2026

Copy link
Copy Markdown
Author

This fixes a crash in oc adm node-image create when IDMS contains wildcard source entries like *.redhat.com. Could a maintainer please set the target version on OCPBUGS-100066 and run /ok-to-test? Thank you!

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 6, 2026
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Hi @savio87. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/cli/image/strategy/onerror.go (1)

98-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for both wildcard filtering paths.

The implementation matches the PR objective. Add tests for alternativeImageSourcesICSP and alternativeImageSourcesIDMS that verify:

  • wildcard sources do not cause a parse error;
  • wildcard-derived mirrors are not returned;
  • valid non-wildcard sources still work;
  • IDMS preserves the original-source fallback when all entries are skipped.

Also applies to: 236-239

🤖 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/cli/image/strategy/onerror.go` around lines 98 - 101, Add regression
coverage for alternativeImageSourcesICSP and alternativeImageSourcesIDMS
covering wildcard sources without parse errors, excluding wildcard-derived
mirrors, and retaining valid non-wildcard sources. For IDMS, also verify the
original-source fallback remains when every entry is skipped; exercise both
wildcard filtering paths.
🤖 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/cli/image/strategy/onerror.go`:
- Around line 98-101: Add regression coverage for alternativeImageSourcesICSP
and alternativeImageSourcesIDMS covering wildcard sources without parse errors,
excluding wildcard-derived mirrors, and retaining valid non-wildcard sources.
For IDMS, also verify the original-source fallback remains when every entry is
skipped; exercise both wildcard filtering paths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d566006-1940-49f1-bf66-1656bb5f179d

📥 Commits

Reviewing files that changed from the base of the PR and between 345ffe9 and b461bb9.

📒 Files selected for processing (1)
  • pkg/cli/image/strategy/onerror.go

@savio87

savio87 commented Aug 11, 2026

Copy link
Copy Markdown
Author

/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 Aug 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@savio87: This pull request references Jira Issue OCPBUGS-100066, 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 (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
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-robot

Copy link
Copy Markdown

@savio87: This pull request references Jira Issue OCPBUGS-100066, which is valid.

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

In response to this:

Bug

https://redhat.atlassian.net/browse/OCPBUGS-100066

oc adm node-image create fails with invalid source "*.redhat.com": invalid reference format when the cluster has an ImageDigestMirrorSet (IDMS) containing wildcard domain sources like *.redhat.com or *.redhat.io.

Root Cause

In pkg/cli/image/strategy/onerror.go, the alternativeImageSourcesIDMS() and alternativeImageSourcesICSP() functions call reference.Parse(rdm.Source) on every IDMS/ICSP source entry. Wildcard sources (e.g. *.redhat.com) are valid in the IDMS CRD schema and handled correctly by CRI-O at runtime, but reference.Parse() rejects them because * is not a valid character in a Docker image reference.

Fix

Skip IDMS/ICSP source entries that start with *. before attempting to parse them as Docker image references. These wildcard entries cannot be meaningfully matched to a specific image reference anyway, so skipping them is the correct behavior. A debug-level log message is emitted when a wildcard source is skipped.

Summary by CodeRabbit

Bug Fixes

  • Bug Fixes
  • Wildcard mirror sources beginning with *. are now skipped during image mirror resolution for ICSP and IDMS configurations.
  • Valid mirror entries continue to be used when mixed with wildcard entries.
  • Configurations containing only wildcard sources now correctly fall back to the original image source.
  • Wildcard entries are logged and excluded before further processing.

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

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants