From a8b9eff902903246aed22a0e49fbc713abcb6a94 Mon Sep 17 00:00:00 2001 From: Rob Murray Date: Wed, 15 Jan 2025 18:03:41 +0000 Subject: [PATCH] Don't set up DNS in Network.createEndpoint DNS is set up when the endpoint is joined to a network. It was added in commit 4850c5f (Avoid duplicate entries in /etc/hosts) then simplified in bcca214 (libnetwork: open-code updating svc records) and seems to be related to setting up a name on a swarm node that isn't running the container with the endpoint. But, all callers of Network.createEndpoint follow up with an Endpoint.Join, which also sets up the DNS entry. Those callers are: Network.createLoadBalancerSandbox Network.CreateEndpoint - called by Daemon.connectToNetwork - called by Sandbox.setupDefaultGateway - called by builder-net/executor.go: iface.init None of them bail out before the Join for a Swarm case. So, it looks like enough has changed that the createEndpoint code is no longer needed (it predates the internal DNS server) ... remove it. Signed-off-by: Rob Murray --- daemon/libnetwork/network.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/daemon/libnetwork/network.go b/daemon/libnetwork/network.go index 49ad9847be..4707ee9189 100644 --- a/daemon/libnetwork/network.go +++ b/daemon/libnetwork/network.go @@ -1268,15 +1268,6 @@ func (n *Network) createEndpoint(ctx context.Context, name string, options ...En } }() - if !n.getController().isSwarmNode() || n.Scope() != scope.Swarm || !n.driverIsMultihost() { - n.updateSvcRecord(context.WithoutCancel(ctx), ep, true) - defer func() { - if err != nil { - n.updateSvcRecord(context.WithoutCancel(ctx), ep, false) - } - }() - } - return ep, nil }