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: ensure detect gateway and ip conflict in pod's netns #2962

Merged

Conversation

cyclinder
Copy link
Collaborator

The coordinator plugin uses errgroup to concurrently check the reachability of gateways and whether IP addresses conflict.However, when launching goroutines in netns.Do, the Go runtime cannot guarantee that the code will be executed in the specified network namespace. Therefore, we modified the Go method of errgroup: manually switch to the target network namespace when launching a goroutine and return to the original network namespace after execution.

Thanks for contributing!

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #2761

Special notes for your reviewer:

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3b3a4fb) 80.83% compared to head (17a5909) 80.98%.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release-v0.7    #2962      +/-   ##
================================================
+ Coverage         80.83%   80.98%   +0.15%     
================================================
  Files                49       49              
  Lines              5274     5274              
================================================
+ Hits               4263     4271       +8     
+ Misses              851      845       -6     
+ Partials            160      158       -2     
Flag Coverage Δ
unittests 80.98% <ø> (+0.15%) ⬆️

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

see 1 file with indirect coverage changes

The coordinator plugin uses errgroup to concurrently check the reachability of gateways and whether IP addresses conflict.However, when launching goroutines in [netns.Do]("github.com/containernetworking/plugins/pkg/ns"), the Go runtime cannot guarantee that the code will be executed in the specified network namespace. Therefore, we modified the Go method of errgroup: manually switch to the target network namespace when launching a goroutine and return to the original network namespace after execution.
@cyclinder cyclinder force-pushed the coordinator/fix_detect_gateway1 branch from 076dc1e to 17a5909 Compare December 20, 2023 10:13
@cyclinder cyclinder merged commit 218c048 into spidernet-io:release-v0.7 Dec 21, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant