-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Fix ipvs proxier nodeport #56685
Fix ipvs proxier nodeport #56685
Conversation
@m1093782566: GitHub didn't allow me to assign the following users: brendanburns. Note that only kubernetes members can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@m1093782566: GitHub didn't allow me to assign the following users: brendanburns. Note that only kubernetes members can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
642eb52
to
9da9b34
Compare
9da9b34
to
4aa6fc6
Compare
pkg/proxy/ipvs/proxier.go
Outdated
@@ -171,36 +170,27 @@ type IPGetter interface { | |||
NodeIPs() ([]net.IP, error) | |||
} | |||
|
|||
// realIPGetter is a real NodeIP handler, it implements IPGetter. | |||
type realIPGetter struct{} | |||
|
|||
func (r *realIPGetter) NodeIPs() (ips []net.IP, err error) { |
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.
This function could use a comment explaining what it does, and what the heuristic is.
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.
It also seems to have no tests
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.
This function could use a comment explaining what it does, and what the heuristic is.
Sounds fair, added now. PTAL.
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.
It also seems to have no tests
It's fixed now. PTAL.
// 10.0.0.10 scope host src 10.0.0.10 | ||
// Then cut the unique src IP fields, | ||
// --> result set: [10.0.0.1, 10.0.0.10] | ||
func (h *netlinkHandle) GetLocalAddresses(filterDev string) (sets.String, error) { |
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.
Where are the tests?
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.
Believe me, I am 100% want to add tests.
The reason why I didn't do that is I am unable to do that. GetLocalAddresses()
will revoke netlink.LinkByName()
to get a REAL network interface and netlink.RouteListFiltered()
to list REAL route table. In order to testing them, I have to create a REAL network interface and give the test code root privilege. Unfortunately, the UT codes run in upstream CI can NOT acquire such privileges. Am I missing something?
Or, Should we check the user id before running tests? e.g.
if user.Current().Uid == 0 {
do test
}
??
It seems odd.
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.
In my view, we can add tests for the caller side: NodeIPs()
?
I don't like having to ask for tests. I know they are tedious, but they really are required. The project in general, and this effort (ipvs overall) in particular are too important. |
9286de9
to
75b21fe
Compare
I apologize - if the missing tests make you unhappy. Tests are already there. Please take a look again when you have time. |
4f0d379
to
21f682b
Compare
/lgtm |
/retest Review the full test history for this PR. |
21f682b
to
2689955
Compare
2689955
to
22a4edc
Compare
PR rebased to resolve conflicts.... It needs re-lgtm. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, m1093782566, thockin Associated issue: #55923 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 54379, 56593, 56685, 54174, 57309). If you want to cherry-pick this change to another branch, please follow the instructions here. |
@m1093782566 can you please back merge this to 1.9.0? As in 1.9.0, ipvs claimed it is already beta, but |
What this PR does / why we need it:
Fix ipvs proxier nodeport.
Which issue(s) this PR fixes:
Fixes #55923
Special notes for your reviewer:
We bump the netwlink version in the 1st commit because:
We call
netlink.RouteListFiltered()
to filter LOCAL type addresses from kernel route table.netlink.RouteListFiltered()
exists in newer-version netlink packagenewer-version netlink package migrate
syscall
togolang.org/x/sys/unix
, k8s cross-build can benefit from it as well. The Go doc for syscall says:Release note: