Parcourir la source

Merge pull request #46565 from vvoland/c8d-mirrors-fix

daemon/RegistryHosts: Don't lose mirrors
Sebastiaan van Stijn il y a 1 an
Parent
commit
80a9fc6d36
5 fichiers modifiés avec 10 ajouts et 10 suppressions
  1. 2 3
      daemon/daemon.go
  2. 1 1
      vendor.mod
  3. 2 2
      vendor.sum
  4. 4 3
      vendor/github.com/moby/buildkit/util/resolver/resolver.go
  5. 1 1
      vendor/modules.txt

+ 2 - 3
daemon/daemon.go

@@ -197,7 +197,7 @@ func (daemon *Daemon) RegistryHosts(host string) ([]docker.RegistryHost, error)
 	}
 	conf := daemon.registryService.ServiceConfig().IndexConfigs
 	for k, v := range conf {
-		c := resolverconfig.RegistryConfig{}
+		c := m[k]
 		if !v.Secure {
 			t := true
 			c.PlainHTTP = &t
@@ -205,8 +205,7 @@ func (daemon *Daemon) RegistryHosts(host string) ([]docker.RegistryHost, error)
 		}
 		m[k] = c
 	}
-	if _, ok := m[host]; !ok && daemon.registryService.IsInsecureRegistry(host) {
-		c := resolverconfig.RegistryConfig{}
+	if c, ok := m[host]; !ok && daemon.registryService.IsInsecureRegistry(host) {
 		t := true
 		c.PlainHTTP = &t
 		c.Insecure = &t

+ 1 - 1
vendor.mod

@@ -62,7 +62,7 @@ require (
 	github.com/miekg/dns v1.1.43
 	github.com/mistifyio/go-zfs/v3 v3.0.1
 	github.com/mitchellh/copystructure v1.2.0
-	github.com/moby/buildkit v0.12.2
+	github.com/moby/buildkit v0.12.3-0.20231002214633-f94ed7cec313 // v0.12 branch
 	github.com/moby/ipvs v1.1.0
 	github.com/moby/locker v1.0.1
 	github.com/moby/patternmatcher v0.6.0

+ 2 - 2
vendor.sum

@@ -909,8 +909,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
 github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
 github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs=
 github.com/moby/buildkit v0.8.1/go.mod h1:/kyU1hKy/aYCuP39GZA9MaKioovHku57N6cqlKZIaiQ=
-github.com/moby/buildkit v0.12.2 h1:B7guBgY6sfk4dBlv/ORUxyYlp0UojYaYyATgtNwSCXc=
-github.com/moby/buildkit v0.12.2/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI=
+github.com/moby/buildkit v0.12.3-0.20231002214633-f94ed7cec313 h1:6obdxayNqgEFbed+9RL6NzejXtP9wuMa7ouqxYsEGXA=
+github.com/moby/buildkit v0.12.3-0.20231002214633-f94ed7cec313/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI=
 github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ=
 github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs=
 github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=

+ 4 - 3
vendor/github.com/moby/buildkit/util/resolver/resolver.go

@@ -130,9 +130,10 @@ func NewRegistryConfig(m map[string]config.RegistryConfig) docker.RegistryHosts
 
 			var out []docker.RegistryHost
 
-			for _, mirror := range c.Mirrors {
-				h := newMirrorRegistryHost(mirror)
-				hosts, err := fillInsecureOpts(mirror, m[mirror], h)
+			for _, rawMirror := range c.Mirrors {
+				h := newMirrorRegistryHost(rawMirror)
+				mirrorHost := h.Host
+				hosts, err := fillInsecureOpts(mirrorHost, m[mirrorHost], h)
 				if err != nil {
 					return nil, err
 				}

+ 1 - 1
vendor/modules.txt

@@ -667,7 +667,7 @@ github.com/mitchellh/hashstructure/v2
 # github.com/mitchellh/reflectwalk v1.0.2
 ## explicit
 github.com/mitchellh/reflectwalk
-# github.com/moby/buildkit v0.12.2
+# github.com/moby/buildkit v0.12.3-0.20231002214633-f94ed7cec313
 ## explicit; go 1.20
 github.com/moby/buildkit/api/services/control
 github.com/moby/buildkit/api/types