-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up stale IP addresses on Antrea host gateway #1900
Clean up stale IP addresses on Antrea host gateway #1900
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the comprehensive fix.
/test-all |
/test-ipv6-all |
Codecov Report
@@ Coverage Diff @@
## main #1900 +/- ##
=======================================
Coverage ? 53.04%
=======================================
Files ? 201
Lines ? 17284
Branches ? 0
=======================================
Hits ? 9169
Misses ? 6953
Partials ? 1162
Flags with carried forward coverage won't be shown. Click here to find out more. |
pkg/agent/util/net_windows.go
Outdated
return addr1.IP.Equal(addr2.IP) && size1 == size2 | ||
} | ||
|
||
addrSliceDifference := func(s1, s2 []*net.IPNet) []*net.IPNet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you consider to move the function out to make it a util function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asked the same question in net_linux.go :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extracted the function definition. However, note that the signature is different for the Linux & Windows case. When go has support for generics, we can have a true common utility function to compute slice differences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Antonin for the PR. LGTM, just minor comments.
pkg/agent/util/net_linux.go
Outdated
} | ||
} | ||
|
||
addrSliceDifference := func(s1, s2 []netlink.Addr) []*netlink.Addr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it helps to move the func to an independent one?
pkg/agent/util/net_windows.go
Outdated
return addr1.IP.Equal(addr2.IP) && size1 == size2 | ||
} | ||
|
||
addrSliceDifference := func(s1, s2 []*net.IPNet) []*net.IPNet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asked the same question in net_linux.go :)
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
326f82f
to
3b086f4
Compare
/test-all |
/test-all |
/test-ipv6-only-networkpolicy |
1 similar comment
/test-ipv6-only-networkpolicy |
|
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes #1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes #1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes antrea-io#1685
When a Node leaves a K8s cluster and joins it again later, it is likely that it will receive a different Pod CIDR. If we simply add the new gateway IP (first IP in the CIDR) to the host gateway interface without removing the previous one, we have observed that it can lead to connectivity issues. This commit ensures that all stale IPs are removed when configuring the gateway interface on an Agent restart. Link-local addresses are left untouched. An integration test is added for both Linux & Windows. Fixes #1685
When a Node leaves a K8s cluster and joins it again later, it is likely
that it will receive a different Pod CIDR. If we simply add the new
gateway IP (first IP in the CIDR) to the host gateway interface without
removing the previous one, we have observed that it can lead to
connectivity issues. This commit ensures that all stale IPs are removed
when configuring the gateway interface on an Agent restart. Link-local
addresses are left untouched. An integration test is added for both
Linux & Windows.
Fixes #1685