Remove filtering of wildcard mirror entry

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2024-02-29 23:05:43 +00:00 committed by Brad Davidson
parent 84a071a81e
commit b5a4846e9d
2 changed files with 5 additions and 4 deletions

View File

@ -30,8 +30,8 @@ func (c *Config) InjectMirror(nodeConfig *config.Node) error {
registry.Mirrors = map[string]registries.Mirror{}
}
for host, mirror := range registry.Mirrors {
// Don't handle wildcard or local registry entries
if host != "*" && !docker.IsLocalhost(host) {
// Don't handle local registry entries
if !docker.IsLocalhost(host) {
mirror.Endpoints = append([]string{mirrorURL}, mirror.Endpoints...)
registry.Mirrors[host] = mirror
}

View File

@ -12,6 +12,7 @@ import (
"strconv"
"time"
"github.com/containerd/containerd/remotes/docker"
"github.com/k3s-io/k3s/pkg/clientaccess"
"github.com/k3s-io/k3s/pkg/daemons/config"
"github.com/k3s-io/k3s/pkg/version"
@ -115,8 +116,8 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
urls := []url.URL{}
registries := []string{}
for host := range nodeConfig.AgentConfig.Registry.Mirrors {
if u, err := url.Parse("https://" + host); err != nil || host == "*" {
logrus.Errorf("Distributed registry mirror skipping unsupported registry: %s", host)
if u, err := url.Parse("https://" + host); err != nil || docker.IsLocalhost(host) {
logrus.Errorf("Distributed registry mirror skipping invalid registry: %s", host)
} else {
urls = append(urls, *u)
registries = append(registries, host)