mirror of
https://github.com/k3s-io/k3s.git
synced 2026-02-03 20:39:49 -05:00
Fix filter for wildcards
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Wildcard entry should be bare `*` or `_default`, not a URL Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
b3962bd057
commit
e69d18614f
2 changed files with 12 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
|
@ -59,6 +60,8 @@ var (
|
|||
|
||||
resolveLatestTag = false
|
||||
|
||||
wildcardRegistries = []string{"_default", "*"}
|
||||
|
||||
// Agents request a list of peers when joining, and then again periodically afterwards.
|
||||
// Limit the number of concurrent peer list requests that will be served simultaneously.
|
||||
maxNonMutatingPeerInfoRequests = 20 // max concurrent get/list/watch requests
|
||||
|
|
@ -123,6 +126,9 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node, criReadyCha
|
|||
}
|
||||
if _, err := url.Parse("https://" + host); err != nil || docker.IsLocalhost(host) {
|
||||
logrus.Errorf("Distributed registry mirror skipping invalid registry: %s", host)
|
||||
} else if slices.Contains(wildcardRegistries, host) {
|
||||
urls = append(urls, host)
|
||||
registries = append(registries, host)
|
||||
} else {
|
||||
urls = append(urls, "https://"+host)
|
||||
registries = append(registries, host)
|
||||
|
|
|
|||
|
|
@ -80,10 +80,12 @@ func (ds *deferredStore) Subscribe(ctx context.Context) (<-chan oci.OCIEvent, er
|
|||
|
||||
// Close is not part of the Store interface, but probably should be. Containerd impliments it.
|
||||
func (ds *deferredStore) Close() error {
|
||||
store := ds.store
|
||||
ds.store = nil
|
||||
if closer, ok := store.(io.Closer); ok {
|
||||
return closer.Close()
|
||||
if ds.store != nil {
|
||||
store := ds.store
|
||||
ds.store = nil
|
||||
if closer, ok := store.(io.Closer); ok {
|
||||
return closer.Close()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue