Remove filtering of wildcard mirror entry

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit b5a4846e9d)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/9707/head
Brad Davidson 9 months ago committed by Brad Davidson
parent 6ceba8be08
commit a0339c8d1f

@ -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
}

@ -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)

Loading…
Cancel
Save