{"action":"created","issue":{"url":"https://api.github.com/repos/moby/moby/issues/36538","repository_url":"https://api.github.com/repos/moby/moby","labels_url":"https://api.github.com/repos/moby/moby/issues/36538/labels{/name}","comments_url":"https://api.github.com/repos/moby/moby/issues/36538/comments","events_url":"https://api.github.com/repos/moby/moby/issues/36538/events","html_url":"https://github.com/moby/moby/pull/36538","id":303594118,"number":36538,"title":"Fix automatic removal of ingress sandbox when last service leaves","user":{"login":"ctelfer","id":11477598,"avatar_url":"https://avatars3.githubusercontent.com/u/11477598?v=4","gravatar_id":"","url":"https://api.github.com/users/ctelfer","html_url":"https://github.com/ctelfer","followers_url":"https://api.github.com/users/ctelfer/followers","following_url":"https://api.github.com/users/ctelfer/following{/other_user}","gists_url":"https://api.github.com/users/ctelfer/gists{/gist_id}","starred_url":"https://api.github.com/users/ctelfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctelfer/subscriptions","organizations_url":"https://api.github.com/users/ctelfer/orgs","repos_url":"https://api.github.com/users/ctelfer/repos","events_url":"https://api.github.com/users/ctelfer/events{/privacy}","received_events_url":"https://api.github.com/users/ctelfer/received_events","type":"User","site_admin":false},"labels":[{"id":237472034,"url":"https://api.github.com/repos/moby/moby/labels/area/networking","name":"area/networking","color":"fbca04","default":false},{"id":392678049,"url":"https://api.github.com/repos/moby/moby/labels/area/swarm","name":"area/swarm","color":"fbca04","default":false},{"id":237472270,"url":"https://api.github.com/repos/moby/moby/labels/impact/changelog","name":"impact/changelog","color":"bfe5bf","default":false},{"id":175375407,"url":"https://api.github.com/repos/moby/moby/labels/status/2-code-review","name":"status/2-code-review","color":"fad8c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-03-08T19:03:22Z","updated_at":"2018-03-13T20:15:43Z","closed_at":"2018-03-13T19:56:04Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/moby/moby/pulls/36538","html_url":"https://github.com/moby/moby/pull/36538","diff_url":"https://github.com/moby/moby/pull/36538.diff","patch_url":"https://github.com/moby/moby/pull/36538.patch"},"body":"<!--\r\nPlease make sure you've read and understood our contributing guidelines;\r\nhttps://github.com/moby/moby/blob/master/CONTRIBUTING.md\r\n\r\n** Make sure all your commits include a signature generated with `git commit -s` **\r\n\r\nFor additional information on our contributing process, read our contributing\r\nguide https://docs.docker.com/opensource/code/\r\n\r\nIf this is a bug fix, make sure your description includes \"fixes #xxxx\", or\r\n\"closes #xxxx\"\r\n\r\nPlease provide the following information:\r\n-->\r\n\r\n**- What I did**\r\nPatched libnetwork to avoid automatically deleting ingress networks when the only endpoint remaining in the network was the ingress load balancer IP.  Then adjust the moby code so that it explicitly removes this endpoint when explicit ingress removal is requested.  The issue this fixes is detailed in https://github.com/docker/libnetwork/issues/2097.\r\n\r\n**- How I did it**\r\nTwo separate patches are required.  The first is to libnetwork to avoid an issue introduced in https://github.com/docker/libnetwork/pull/2011 that automatically removes *any* network (including ingress) when the number of endpoints drops to 1 and the network contains a load balancing IP.  The patch prevents the removal if the network is marked as ingress.   The second patch adds logic to the daemon.releaseIngress() call in moby to remove the ingress load balancing endpoint before invoking libnetwork.network.Delete().\r\n\r\n**- How to verify it**\r\nI added a test to the moby integration tests called TestServiceWithIngressNetwork.   This test:\r\n  *  spins up a swarm\r\n  * waits for the ingress network to \"settle\"\r\n  * creates a simple service and waits for it to converge\r\n  * removes the service\r\n  * waits and then verifies that the ingress network is still present and is not corrupted\r\n\r\nIf one applies the test patch (the first in the series) without the other two fix patches, the test will fail noting ingress corruption.  If one applies the entire PR set of patches, and runs the test, it will pass.  (running the test as `TESTFLAGS='-test.run TestServiceWithIngressNetwork' make test-integration`)\r\n\r\n**- Description for the changelog**\r\nPrevent implicit removal of the ingress network\r\n\r\n**- A picture of a cute animal (not mandatory but encouraged)**\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/moby/moby/issues/comments/372803320","html_url":"https://github.com/moby/moby/pull/36538#issuecomment-372803320","issue_url":"https://api.github.com/repos/moby/moby/issues/36538","id":372803320,"user":{"login":"ctelfer","id":11477598,"avatar_url":"https://avatars3.githubusercontent.com/u/11477598?v=4","gravatar_id":"","url":"https://api.github.com/users/ctelfer","html_url":"https://github.com/ctelfer","followers_url":"https://api.github.com/users/ctelfer/followers","following_url":"https://api.github.com/users/ctelfer/following{/other_user}","gists_url":"https://api.github.com/users/ctelfer/gists{/gist_id}","starred_url":"https://api.github.com/users/ctelfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctelfer/subscriptions","organizations_url":"https://api.github.com/users/ctelfer/orgs","repos_url":"https://api.github.com/users/ctelfer/repos","events_url":"https://api.github.com/users/ctelfer/events{/privacy}","received_events_url":"https://api.github.com/users/ctelfer/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T20:15:42Z","updated_at":"2018-03-13T20:15:42Z","author_association":"NONE","body":"Thanks for all the help!"}}
{"actor":{"display_login":"ctelfer"}}