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
    • Wildcard mirror sources beginning with *. are now skipped during image mirror resolution.
    • Invalid 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

Walkthrough

ICSP and IDMS mirror resolution now logs and skips wildcard sources beginning with *. before parsing or processing.

Changes

Mirror source filtering

Layer / File(s) Summary
Wildcard source handling
pkg/cli/image/strategy/onerror.go
ICSP and IDMS processing logs and skips sources beginning with *..

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

Suggested reviewers: atiratree, ingvagund

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
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 PR changes only pkg/cli/image/strategy/onerror.go; no test files or Ginkgo title calls were added or modified.
Test Structure And Quality ✅ Passed The PR changes only onerror.go; it adds or modifies no Ginkgo tests. The related tests use standard table-driven testing, so the listed Ginkgo quality checks are not applicable.
Microshift Test Compatibility ✅ Passed The pull request changes only pkg/cli/image/strategy/onerror.go and adds no Ginkgo e2e tests, so the MicroShift test compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request changes only two log-message lines in pkg/cli/image/strategy/onerror.go and adds no Ginkgo e2e tests requiring SNO review.
Topology-Aware Scheduling Compatibility ✅ Passed The only changed file is the CLI image strategy; the diff only changes wildcard-source logging and adds no manifests, controllers, replicas, affinities, selectors, tolerations, or topology constrai...
Ote Binary Stdout Contract ✅ Passed The PR adds only klog calls inside alternativeImageSourcesICSP/IDMS, not process-level OTE setup; klog v2 documents stderr as its default output.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR changes only pkg/cli/image/strategy/onerror.go; the full two-commit diff adds no Ginkgo e2e tests, IPv4 assumptions, or external connectivity.
No-Weak-Crypto ✅ Passed The patch adds only two debug log calls and no cryptographic imports, algorithms, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes only pkg/cli/image/strategy/onerror.go. The full PR diff adds no manifests or prohibited privilege settings.
No-Sensitive-Data-In-Logs ✅ Passed The PR adds only fixed-text debug logs for skipped ICSP and IDMS entries; it does not log source values or other sensitive data.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes skipping wildcard sources during IDMS and ICSP image reference parsing.
✨ 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

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

Labels

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. 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