Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T7092: Add Container Registry Mirror #4321

Open
wants to merge 2 commits into
base: current
Choose a base branch
from
Open

Conversation

sskaje
Copy link
Contributor

@sskaje sskaje commented Jan 27, 2025

Change summary

Add Container Registry Mirror

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T7092

Related PR(s)

How to test / Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Jan 27, 2025

👍
No issues in PR Title / Commit Title

@@ -538,6 +538,17 @@
<children>
#include <include/interface/authentication.xml.i>
#include <include/generic-disable-node.xml.i>
<leafNode name="insecure">
Copy link
Member

Choose a reason for hiding this comment

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

How common are HTTP-only mirrors in the age of Let's Encrypt? Are there compelling arguments to support them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't tell how common, but those I have access to are all ip:port only and only for development servers and developer's machines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should insecure & authentication nodes be mutually exclusive?
Can't see it ever being advisable to send credentials over plaintext...

Copy link
Contributor Author

@sskaje sskaje Jan 29, 2025

Choose a reason for hiding this comment

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

Should insecure & authentication nodes be mutually exclusive? Can't see it ever being advisable to send credentials over plaintext...

Theoritically yes, but you can't expect small company do everything right in their LAN.
throw a warning is enough.

Also, insecure can be used for self-signed certificate: https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md

insecure : true or false. By default, container runtimes require TLS when retrieving images from a registry. If insecure is set to true, unencrypted HTTP as well as TLS connections with untrusted certificates are allowed.

</leafNode>
<leafNode name="mirror">
<properties>
<help>Registry mirror, use host:port</help>
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's better to make host and port separate options so that we can validate them. URLs are quite difficult to validate but leaving an option without any validation at all certainly rubs me the wrong way.

Even more so in cases where the effect of a keyboard cat entering something like '[[fdfs89. will not cause any immediate errors in the target component, either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My opinion, simple regex is enough, like [a-z0-9\-\.]+(:\d+)?.

Copy link
Contributor Author

@sskaje sskaje Jan 28, 2025

Choose a reason for hiding this comment

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

all we need to support

1.1.1.1:80
2.2.2.2
simple:80
simplewithoutport
test-server-with-dash
test.lan
test.lan:8080
normal.domain.com
domain.with.port:80

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md

pattern with url path should also be supported, then the regex would be sth like

^(?:[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*|(?:\d{1,3}\.){3}\d{1,3}|\[[a-fA-F0-9:]+])(?::\d+)?(?:\/[^\s?#]*)?$

for host name, ipv4, ipv6 + optional port + optional path

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just use URL validator?
Something like: <validator name="url" argument="--scheme http --scheme https"/> might cover most of what's needed without the regex hieroglyphs.

Copy link
Contributor Author

@sskaje sskaje Jan 29, 2025

Choose a reason for hiding this comment

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

Can't we just use URL validator? Something like: <validator name="url" argument="--scheme http --scheme https"/> might cover most of what's needed without the regex hieroglyphs.

prefix: A prefix of the user-specified image name, i.e. using one of the following formats:

host[:port]
host[:port]/namespace[/namespace…]
host[:port]/namespace[/namespace…]/repo
host[:port]/namespace[/namespace…]/repo(:_tag|@digest)
[*.]host

location : Accepts the same format as the prefix field, and specifies the physical location of the prefix-rooted namespace.

https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md

I don't ever use the line with (:_tag|@digest) before, but I used other formats before.

If the url validator can disallow scheme and query string, it should work

Copy link
Contributor

Choose a reason for hiding this comment

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

If the url validator can disallow scheme and query string, it should work

I don't think url validator works without --scheme. It is unlikely to work in this case, unfortunately.

Copy link

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

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

Successfully merging this pull request may close these issues.

5 participants