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
505 stars 72 forks source link

coordinator: add a from policy route for pod's eth0 #3686

Open cyclinder opened 4 days ago

cyclinder commented 4 days ago

Add a from policy route for pod's eth0, which make sure that packets received from eth0 are forwarded out of eth0. fix to the problem of inconsistent routes.

Thanks for contributing!

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #3683 Special notes for your reviewer:

root@demo1-7fbdd6cc66-bwgtn:/# ip r
default via 169.254.1.1 dev eth0
10.7.0.0/16 dev net1 proto kernel scope link src 10.7.168.202
10.7.168.71 dev eth0 scope link src 10.233.74.111
10.233.0.0/18 via 10.7.168.71 dev eth0 src 10.233.74.111
10.233.64.0/18 via 10.7.168.71 dev eth0 src 10.233.74.111
10.233.74.64 dev eth0 scope link src 10.233.74.111
169.254.0.0/16 via 10.7.168.71 dev eth0 src 10.233.74.111
169.254.1.1 dev eth0 scope link
172.224.168.71 dev eth0 scope link src 10.233.74.111
root@demo1-7fbdd6cc66-bwgtn:/# ip rule
0:  from all lookup local
32764:  from 10.233.74.111 lookup 500.    # ===>> new added
32765:  from 10.7.168.202 lookup 100
32766:  from all lookup main
32767:  from all lookup default
root@demo1-7fbdd6cc66-bwgtn:/# ip r show table 500
default via 169.254.1.1 dev eth0 # ===>> new added
codecov[bot] commented 4 days ago

Codecov Report

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

Project coverage is 81.16%. Comparing base (0cdac43) to head (9b7b289).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3686/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/3686?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 #3686 +/- ## ======================================= Coverage 81.16% 81.16% ======================================= Files 50 50 Lines 4391 4391 ======================================= Hits 3564 3564 Misses 670 670 Partials 157 157 ``` | [Flag](https://app.codecov.io/gh/spidernet-io/spiderpool/pull/3686/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/3686/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spidernet-io) | `81.16% <ø> (ø)` | | 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.
weizhoublue commented 4 days ago

PR 描述中,应该给出详细的 路由变更例子,以方便 PR review 和维护

weizhoublue commented 4 days ago

这个代码变更 比较多,需要详细 评审下 用例的覆盖 情况 ,避免 按下葫芦浮起瓢

cyclinder commented 4 days ago

看起来代码变动多,但其实只加了一个东西。经过评估,目前e2e 已经覆盖大部分case,之前没测出问题,是因为环境配置问题。再加一个指定默认网卡后的联通性case 就可以了