Skip to content
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

coordinator: fix wrong policy route when there is more than 1 secondary nics #3873

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

cyclinder
Copy link
Collaborator

@cyclinder cyclinder commented Aug 12, 2024

Thanks for contributing!

What type of PR is this?

  • release/bug

What this PR does / why we need it:

  • No longer rely on the API to get the rule number of the NIC, getting it through the API may cause the number to be wrong, which can avoid the wrong policy route when there is more than 1 secondary nics.
  • New a netlink.Route object without use of raw object when adding the route, which can avoid netlink return "invalid argument" error.

Which issue(s) this PR fixes:

Fixes #3877

Special notes for your reviewer:

@cyclinder cyclinder added release/bug cherrypick-release-v0.9 cherrypick-release-v1.0 Cherry-pick the PR to branch release-v1.0. labels Aug 12, 2024
@cyclinder cyclinder marked this pull request as draft August 12, 2024 11:04
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.83%. Comparing base (53dcfeb) to head (f52c78d).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3873   +/-   ##
=======================================
  Coverage   80.83%   80.83%           
=======================================
  Files          51       51           
  Lines        4514     4514           
=======================================
  Hits         3649     3649           
  Misses        699      699           
  Partials      166      166           
Flag Coverage Δ
unittests 80.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

if err = netlink.RouteAdd(&route); err != nil && !os.IsExist(err) {
logger.Error("failed to RouteAdd in new table ", zap.String("route", route.String()), zap.Error(err))
Copy link
Collaborator

Choose a reason for hiding this comment

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

route netlink.Route 进行 copy 修改,避免潜在 bug
相关日志也把 要生效的最终路由 打下

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@ty-dc
Copy link
Collaborator

ty-dc commented Aug 13, 2024

Can we add an issue?

@cyclinder cyclinder marked this pull request as ready for review August 13, 2024 07:58
@weizhoublue weizhoublue changed the title coordinator: Fix error to add route when the nic is down coordinator: fix wrong route when there is more than 2 secondary nics Aug 13, 2024
@weizhoublue
Copy link
Collaborator

need detailed description in the PR to explain the bug's influence , for release note

@weizhoublue weizhoublue changed the title coordinator: fix wrong route when there is more than 2 secondary nics coordinator: fix wrong route when there is more than 1 secondary nics Aug 14, 2024
@weizhoublue weizhoublue changed the title coordinator: fix wrong route when there is more than 1 secondary nics coordinator: fix wrong policy route when there is more than 1 secondary nics Aug 14, 2024
@cyclinder cyclinder force-pushed the coordinator/tune_pod_route branch 3 times, most recently from b550613 to 18d6279 Compare August 14, 2024 09:54
@weizhoublue
Copy link
Collaborator

weizhoublue commented Aug 14, 2024

相关 文档,提到了 pod 内

32762:from 10.233.120.101 lookup 500

# ip route show table 500

return fmt.Errorf("when creating interface %s in underlay mode, it detects that the auxiliary interface %s was not created by previous interface. please enable coordinator plugin in previous interface", c.currentInterface, podFirstInterface)
}

// eth0, net1 ==> 101
Copy link
Collaborator

Choose a reason for hiding this comment

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

这些 comment 正式一点

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@cyclinder cyclinder force-pushed the coordinator/tune_pod_route branch 7 times, most recently from c7b3cb1 to fc2e500 Compare August 16, 2024 06:37
@cyclinder cyclinder force-pushed the coordinator/tune_pod_route branch 9 times, most recently from 788bf40 to 283cef7 Compare August 20, 2024 01:59
@cyclinder
Copy link
Collaborator Author

wait for #3906

@cyclinder cyclinder force-pushed the coordinator/tune_pod_route branch 7 times, most recently from 137e0c2 to 3957954 Compare August 24, 2024 03:07
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
@@ -587,7 +587,7 @@ var _ = Describe("test ip with reclaim ip case", Label("reclaim"), func() {
Expect(frame.DeletePod(podName, namespace)).To(Succeed(), "Failed to delete pod %v/%v\n", namespace, podName)
GinkgoWriter.Printf("succeed to delete pod %v/%v\n", namespace, podName)
},
Entry("a dirty IP record (pod name is wrong or containerID is wrong) in the IPPool should be auto clean by Spiderpool", Serial, Label("G00005", "G00007")),
PEntry("a dirty IP record (pod name is wrong or containerID is wrong) in the IPPool should be auto clean by Spiderpool", Serial, Label("G00005", "G00007")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ty-dc 该ci是否已修复? 后续打开

Copy link
Collaborator

Choose a reason for hiding this comment

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

#3926 中打开

@cyclinder cyclinder merged commit 22a3384 into spidernet-io:main Aug 26, 2024
59 checks passed
@cyclinder cyclinder added the cherrypick-release-v0.8 Cherry-pick the PR to branch release-v0.8. label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick-release-v0.8 Cherry-pick the PR to branch release-v0.8. cherrypick-release-v0.9 cherrypick-release-v1.0 Cherry-pick the PR to branch release-v1.0. release/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod failed to run due to coordinator failed to add routing table
3 participants