Commit f10b4afa authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Don't register embedded registry address as an upstream registry

Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com> (cherry picked from commit 091a5c89) Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com>
parent a0339c8d
...@@ -111,11 +111,15 @@ func init() { ...@@ -111,11 +111,15 @@ func init() {
// Start starts the embedded p2p router, and binds the registry API to an existing HTTP router. // Start starts the embedded p2p router, and binds the registry API to an existing HTTP router.
func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
localAddr := net.JoinHostPort(c.InternalAddress, c.RegistryPort)
// distribute images for all configured mirrors. there doesn't need to be a // distribute images for all configured mirrors. there doesn't need to be a
// configured endpoint, just having a key for the registry will do. // configured endpoint, just having a key for the registry will do.
urls := []url.URL{} urls := []url.URL{}
registries := []string{} registries := []string{}
for host := range nodeConfig.AgentConfig.Registry.Mirrors { for host := range nodeConfig.AgentConfig.Registry.Mirrors {
if host == localAddr {
continue
}
if u, err := url.Parse("https://" + host); err != nil || docker.IsLocalhost(host) { if u, err := url.Parse("https://" + host); err != nil || docker.IsLocalhost(host) {
logrus.Errorf("Distributed registry mirror skipping invalid registry: %s", host) logrus.Errorf("Distributed registry mirror skipping invalid registry: %s", host)
} else { } else {
...@@ -210,7 +214,6 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { ...@@ -210,7 +214,6 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
if err != nil { if err != nil {
return errors.Wrap(err, "failed to read server CA") return errors.Wrap(err, "failed to read server CA")
} }
localAddr := net.JoinHostPort(c.InternalAddress, c.RegistryPort)
client := clientaccess.GetHTTPClient(caCert, c.ClientCertFile, c.ClientKeyFile) client := clientaccess.GetHTTPClient(caCert, c.ClientCertFile, c.ClientKeyFile)
metrics.Register() metrics.Register()
registryOpts := []registry.Option{ registryOpts := []registry.Option{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment