Skip to content

Prevent ingress deletion when endpoint count == 1#2101

Merged
fcrisciani merged 1 commit intomoby:masterfrom
ctelfer:ingress-fix
Mar 8, 2018
Merged

Prevent ingress deletion when endpoint count == 1#2101
fcrisciani merged 1 commit intomoby:masterfrom
ctelfer:ingress-fix

Conversation

@ctelfer
Copy link
Copy Markdown
Contributor

@ctelfer ctelfer commented Mar 6, 2018

Libnetwork should not delete an ingress network just because its endpoint count
drops to 1 (the IP address of the sandbox). This addresses a regression
where the ingress sandbox could be deleted on workers when the last
container leave said sandbox.

Adding this fix will ultimately require and accompanying moby/moby fix in order to
preserve the ability to remove the ingress network manually. As it turns out, moby
already has the code required to remove the load balancing endpoint in the
daemon.deleteLoadBalancerSandbox() method. Since removing the ingress network
in moby invokes the daemon.releaseIngress() function to help it, the only change
required to reinstate ingress network removal along with this fix is to invoke
deleteLoadBalancerSandbox() within releaseIngress(). This will obviously be in a
moby PR that also adjusts for the libnetwork vendoring (once this fix is in).

Signed-off-by: Chris Telfer [email protected]

We should not delete an ingress network just because its endpoint count
drops to 1 (the IP address of the sandbox).  This addresses a regression
where the ingress sandbox could be deleted on workers when the last
container leave said sandbox.

Signed-off-by: Chris Telfer <[email protected]>
@ctelfer
Copy link
Copy Markdown
Contributor Author

ctelfer commented Mar 6, 2018

This is intended as the first part of a fix for #2097.

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2101 into master will increase coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2101      +/-   ##
==========================================
+ Coverage   40.38%   40.44%   +0.05%     
==========================================
  Files         139      139              
  Lines       22356    22356              
==========================================
+ Hits         9029     9042      +13     
+ Misses      12000    11983      -17     
- Partials     1327     1331       +4
Impacted Files Coverage Δ
network.go 63.64% <0%> (ø) ⬆️
cmd/proxy/tcp_proxy.go 82.97% <0%> (-2.13%) ⬇️
drivers/overlay/ov_network.go 5.11% <0%> (+2.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f6d309...0ff9624. Read the comment docs.

@selansen
Copy link
Copy Markdown
Contributor

selansen commented Mar 6, 2018

LGTM

@mavenugo
Copy link
Copy Markdown
Contributor

mavenugo commented Mar 6, 2018

@ctelfer since this is a regression, could you pls point to the PR that brought in this breakage ?
Also, it would be great if we can add an integration-cli test in moby to catch these issues early.

Please edit the description of this PR and clearly mention that this PR is dependent on another fix in moby as you described in #2097 (comment) That also makes it appropriate to justify the lack of test in libnetwork and the need for it in moby/moby.

@ctelfer
Copy link
Copy Markdown
Contributor Author

ctelfer commented Mar 6, 2018

This regression was introduced with this PR: #2011.

@ctelfer
Copy link
Copy Markdown
Contributor Author

ctelfer commented Mar 6, 2018

Re: a test in integration-cli ... according to @selansen no further tests are allowed to be added there. They now have to be added to integration/ in moby. Putting a test in integration/ seems reasonable.

I do have a concern that the test might be unreliable if there is no way to guarantee that docker has completely cleaned up any endpoints in the ingress network from previous tests. (i.e. the test may have completed but the container/endpoint might still be in the process of removal and so the ingress network reference count could be > 1) This would apply to any test framework that isn't paying close attention to clean-up in every single test.

@fcrisciani
Copy link
Copy Markdown

LGTM

Copy link
Copy Markdown
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ctelfer
Copy link
Copy Markdown
Contributor Author

ctelfer commented Mar 8, 2018

Moby PR for this along with integration test is in moby/moby#36538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants