Fix potential IP overlapping with node LB#40997
Conversation
|
I just think of another scenario of IP overlapping: Example: I will make some modification to the codes. |
379170b to
e351dd5
Compare
|
If we handle the network cleanup well in This will avoid unnecessary removing networks in below swarmkit scenarios:
And this will in turn help mitigate widely reported issue: |
dfb8a3b to
a6b64f8
Compare
|
Hi, |
|
Why we need remove whole network instead of just not give used for lb IP address to new containers? |
There was a problem hiding this comment.
and swarmkit will not call Shutdown() after task state is FAIL
Was this by design? Should this be changed? @dperny
There was a problem hiding this comment.
This is how current swarmkit works:
https://github.com/docker/swarmkit/blob/master/agent/exec/controller.go#L295
if task.DesiredState >= api.TaskStateShutdown {
if status.State >= api.TaskStateCompleted {
return noop()
}
...
We remove the network only when there's no containers running on this network on this node. The logic is in |
a6b64f8 to
10b0f27
Compare
Remove node LB after task container exits itself or startup failure. For detailed reason, see moby#40989 Signed-off-by: Xinfeng Liu <[email protected]>
add test cases for verifying node LB removal under some conditions. Also add: - `ServiceWithRestartAttempts` and `ServiceWithHealthCheck` for service creation in tests. - Waiting conditions for `CompletedTasksCount` and `FailedTasksCount` Signed-off-by: Xinfeng Liu <[email protected]>
10b0f27 to
f006b4a
Compare
|
Added a new commit for tests:
|
|
Hi @thaJeztah |
|
Looks like this was addressed in #42432 |
Fixes #40989
Signed-off-by: Xinfeng Liu [email protected]
- What I did
This PR removes node LB after container exits itself or starting failure to avoid IP overlapping.
- How I did it
Add
removeNetworks()indaemon/cluster/executor/container/controller.go- How to verify it
Manual verification using the test case in #40989
Also added test cases in CI in this PR.
- Description for the changelog
Fix potential IP overlapping with node LB when container exits itself
- A picture of a cute animal (not mandatory but encouraged)