Skip to content

feat: registry mirrors - #564

Merged
squidboylan merged 4 commits into
cnoe-io:mainfrom
Argannor:local-registry-mirror
Apr 8, 2026
Merged

squidboylan merged 4 commits into
cnoe-io:mainfrom
Argannor:local-registry-mirror

Conversation

@Argannor

Copy link
Copy Markdown
Contributor

This MR adds the option to configure registry mirrors.

Closes #563

Signed-off-by: Argannor <arga@argannor.com>

[host."{{ .RegistryAddress }}"]
capabilities = ["pull", "resolve"]
skip_verify = true No newline at end of file

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.

it would be nice if we had a way to make this optional, not sure if there's an elegant way to do so though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can remove it be default and

  1. introduce an extra flag to skip verify for mirrors, or
  2. make it part of the current flags syntax
  3. skip verify only for registries configured as http://

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.

we could consider adding a second flag for insecure registries? what do you think about that? Maybe --insecure-registry-mirror that follows the same code path but toggles verification skip? That way it can be configured for individual mirrors. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added --insecure-registry-mirrors (plural, as it applies to all specified mirrors) as an optional flag that defaults to false if not set. The skip_verify = true line will be omitted if the flag is not present.

@squidboylan

Copy link
Copy Markdown
Contributor

/e2e

@squidboylan

Copy link
Copy Markdown
Contributor

Looks great overall, left one small comment, hoping we can get a second look by someone like @punkwalker

Signed-off-by: Argannor <arga@argannor.com>
@Argannor

Argannor commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @squidboylan, thank you for the initial review. Code is now adjusted, @punkwalker do you mind taking a look so we can finalize this?

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

@Argannor Few comment otherwise LGTM

Comment thread pkg/cmd/create/root.go Outdated
Comment on lines +229 to +234
_, err = parseRegistryMirrors(registryMirrors)
if err != nil {
return err
}

return nil

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.

nit: Can we just return the err here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment thread pkg/cmd/create/root.go
Comment on lines +281 to +283
if address == "" {
return nil, fmt.Errorf("registry address cannot be empty in mirror: %s", mirror)
}

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.

should we check for valid URL format for address?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added input validation and reference to the containerd docs for both target (real registry) and address of the mirror, and added test cases for the newly added validation

Argannor added 2 commits April 2, 2026 14:53
Signed-off-by: Argannor <arga@argannor.com>
Signed-off-by: Argannor <arga@argannor.com>
@Argannor

Argannor commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you for the review @punkwalker! I adjusted the code according to your comments and ran make build to regenerate the manifests. I was using a >1.25 version of go, which failed the build earlier locally, so I only ran the tests manually before, sorry!

@squidboylan

Copy link
Copy Markdown
Contributor

/e2e

@squidboylan
squidboylan merged commit 50580da into cnoe-io:main Apr 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: local registry mirrors

3 participants