Browse code

Disable service on release network

This PR contains a fix for moby/moby#30321. There was a moby/moby#31142
PR intending to fix the issue by adding a delay between disabling the
service in the cluster and the shutdown of the tasks. However
disabling the service was not deleting the service info in the cluster.
Added a fix to delete service info from cluster and verified using siege
to ensure there is zero downtime on rolling update of a service.In order
to support it and ensure consitency of enabling and disable service knob
from the daemon, we need to ensure we disable service when we release
the network from the container. This helps in making the enable and
disable service less racy. The corresponding part of libnetwork fix is
part of docker/libnetwork#1824

Signed-off-by: abhi <abhi@docker.com>

Abhinandan Prativadi authored on 2018/01/09 07:25:50
Showing 1 changed files
... ...
@@ -966,6 +966,9 @@ func (daemon *Daemon) releaseNetwork(container *container.Container) {
966 966
 		logrus.Warnf("error locating sandbox id %s: %v", sid, err)
967 967
 		return
968 968
 	}
969
+	if err := sb.DisableService(); err != nil {
970
+		logrus.WithFields(logrus.Fields{"container": container.ID, "sandbox": sid}).WithError(err).Error("Error removing service from sandbox")
971
+	}
969 972
 
970 973
 	if err := sb.Delete(); err != nil {
971 974
 		logrus.Errorf("Error deleting sandbox id %s for container %s: %v", sid, container.ID, err)