spidernet-io / spiderpool

Underlay and RDMA network solution of the Kubernetes, for bare metal, VM and any public cloud
https://spidernet-io.github.io/spiderpool/
Apache License 2.0
523 stars 76 forks source link

coordinator: Use ARP to detect the gateway rather than ICMP #3584

Closed cyclinder closed 3 months ago

cyclinder commented 3 months ago

Thanks for contributing!

1 use arp to accelerate rather than icmp 2 some gateway forbid icmp

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes https://github.com/spidernet-io/spiderpool/issues/3535

Special notes for your reviewer:

{"level":"DEBUG","ts":"2024-06-17T15:53:48.694+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:78","msg":"[RetryNum: 1]try to send arp request","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
{"level":"DEBUG","ts":"2024-06-17T15:53:53.703+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:217","msg":"Detect gateway: found the response","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default","TargetAddress":"fd00:10:7::103"}
{"level":"INFO","ts":"2024-06-17T15:53:53.704+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:182","msg":"gateway fd00:10:7::103 is reachable, it's located at 00:50:56:b4:27:ca","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
{"level":"ERROR","ts":"2024-06-17T15:53:53.705+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:100","msg":"[RetryNum: 1]failed to resolve: read packet 0a:3a:c7:44:2d:95: i/o timeout","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
{"level":"DEBUG","ts":"2024-06-17T15:53:58.706+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:78","msg":"[RetryNum: 2]try to send arp request","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
{"level":"ERROR","ts":"2024-06-17T15:54:03.711+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:100","msg":"[RetryNum: 2]failed to resolve: read packet 0a:3a:c7:44:2d:95: i/o timeout","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}

{"level":"DEBUG","ts":"2024-06-17T15:54:08.713+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:78","msg":"[RetryNum: 3]try to send arp request","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
{"level":"INFO","ts":"2024-06-17T15:54:08.714+0800","logger":"coordinator.new1","caller":"gwconnection/connection.go:106","msg":"Gateway 10.7.0.2 is reachable, gateway is located at 00:50:56:b4:27:ca","Action":"ADD","ContainerID":"860b7454527609f2e67224571977d4a18f5c286fb365709fc353abd8ef9bec77","Netns":"/proc/2572117/ns/net","IfName":"eth0","PodName":"macvlan-160-c-848cf7bf6f-lwbcj","PodNamespace":"default"}
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.16%. Comparing base (cd571c1) to head (e3b1715).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3584/graphs/tree.svg?width=650&height=150&src=pr&token=YKXY2E4Q8G&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io)](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3584?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) ```diff @@ Coverage Diff @@ ## main #3584 +/- ## ========================================== - Coverage 81.21% 81.16% -0.05% ========================================== Files 50 50 Lines 4391 4391 ========================================== - Hits 3566 3564 -2 - Misses 669 670 +1 - Partials 156 157 +1 ``` | [Flag](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3584/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3584/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | `81.16% <ø> (-0.05%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io#carryforward-flags-in-the-pull-request-comment) to find out more. [see 1 file with indirect coverage changes](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3584/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io)
cyclinder commented 3 months ago

Waiting for https://github.com/spidernet-io/spiderpool/pull/3603 and https://github.com/spidernet-io/spiderpool/pull/3608 merge.