Skip to content

fix(api): preserve registry ports in package images#280

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/package-image-port-parsing
Open

fix(api): preserve registry ports in package images#280
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/package-image-port-parsing

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • Parse package image tags only when the tag separator appears after the final slash.
  • Preserve registry ports such as localhost:5000/org/pkg during package image defaulting.
  • Keep validating explicit tags, including tags on images from registries with ports.

Why

Package image handling split on the first colon, so a registry port was mistaken for a tag. That truncated valid package images like localhost:5000/org/pkg to localhost and made validation treat 5000/org/pkg as the image tag.

Validation

  • go test ./api/v1alpha1
  • go test ./...

@fallintoplace fallintoplace requested a review from a team June 12, 2026 22:16
@github-actions github-actions Bot added component/operator Skyhook operator (controller-manager) component/ci CI workflows, GitHub Actions, and repo tooling labels Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 7c20734c-0ff5-419b-ba2e-39b8caffbe10

📥 Commits

Reviewing files that changed from the base of the PR and between 2007c6a and 440330c.

📒 Files selected for processing (3)
  • operator/api/v1alpha1/skyhook_types.go
  • operator/api/v1alpha1/skyhook_webhook.go
  • operator/api/v1alpha1/skyhook_webhook_test.go

📝 Walkthrough

Walkthrough

This PR refines image tag and digest handling in the Skyhook API. A new splitImageTag helper function correctly extracts tags from image strings by first removing digests (e.g., @sha256:...), then identifying the tag only when a colon appears after the last forward slash. This prevents misidentifying registry port colons (e.g., localhost:5000) as tag separators. The Packages.Images() method and webhook validation now use this helper instead of naive strings.Cut splitting. Test coverage validates behavior with registry ports and confirms image tags are stripped while registry information is preserved.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing image tag parsing to preserve registry ports like localhost:5000.
Description check ✅ Passed The description is clearly related to the changeset, explaining the problem, solution, and validation approach for the registry port preservation fix.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

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

Inline comments:
In `@operator/api/v1alpha1/skyhook_webhook_test.go`:
- Around line 581-594: Add test cases exercising digest parsing: extend the JSON
in the It("packages should preserve registry ports when stripping image tags",
...) test to include entries like "baz":
{"version":"1.2.2","image":"localhost:5000/org/pkg@sha256:abcdef..."} and "qux":
{"version":"1.2.2","image":"localhost:5000/org/pkg:1.2.2@sha256:abcdef..."} (use
a realistic sha256 hex), unmarshal into Packages (ret) and add assertions that
ret["baz"].Name == "baz" and ret["baz"].Image ==
"localhost:5000/org/pkg@sha256:abcdef..." and that ret["qux"].Name == "qux" and
ret["qux"].Image == "localhost:5000/org/pkg@sha256:abcdef..." so the digest
branch behavior in the image parsing (Packages -> Image) is covered while
preserving registry ports.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3b49d0ef-4373-4fbb-920f-6a0ce34b1f45

📥 Commits

Reviewing files that changed from the base of the PR and between 81ef6be and 2007c6a.

📒 Files selected for processing (3)
  • operator/api/v1alpha1/skyhook_types.go
  • operator/api/v1alpha1/skyhook_webhook.go
  • operator/api/v1alpha1/skyhook_webhook_test.go

Comment thread operator/api/v1alpha1/skyhook_webhook_test.go
Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
@fallintoplace fallintoplace force-pushed the fix/package-image-port-parsing branch from 2007c6a to 440330c Compare June 14, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/ci CI workflows, GitHub Actions, and repo tooling component/operator Skyhook operator (controller-manager)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants