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 service Flags #52330
Fix IPVS service Flags #52330
Conversation
@m1093782566: Your pull request title starts with "[WIP]", so the do-not-merge/work-in-progress label will be added. This label will ensure that your pull request will not be merged. Remove the prefix from your pull request title to trigger the removal of the label and allow for your pull request to be merged. 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. |
45a5b7d
to
e834520
Compare
pkg/util/ipvs/ipvs_linux.go
Outdated
Timeout: svc.Timeout, | ||
} | ||
|
||
if svc.Flags < uint32(FlagHashed) { |
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.
If flags are treated as a bitmap, we should use bit tests for them,
if svc.Flags & FlagHashed == 0
, and so on.
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.
Thanks. It's fixed now. Please take a look?
fca83ea
to
6b9e414
Compare
pkg/util/ipvs/ipvs_linux.go
Outdated
if svc.Flags&FlagHashed == 0 { | ||
return nil, fmt.Errorf("Flags of successfully created IPVS service should be >= %d since every service is hashed into the service table", FlagHashed) | ||
} | ||
vs.Flags = ServiceFlags(svc.Flags - uint32(FlagHashed)) |
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.
I would say &^, buut OK
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.
I understand your meaning, since the valid value range is [2, 3] for now, I think it's fine to use bit operator &^
. Then, we need to update test cases because a &^ b
is not always equal to a - b
. BTW, I would like to add some comments...
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -162,7 +162,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Protocol: "UDP", | |||
Port: 33434, | |||
Scheduler: "wlc", | |||
Flags: 1234, | |||
Flags: 1232, |
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.
constants please?
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -128,7 +128,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Port: 80, | |||
FWMark: 0, | |||
SchedName: "", | |||
Flags: 0, | |||
Flags: 2, |
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.
constants please?
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.
Done, Please check it and below.
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -172,7 +172,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Port: 0, | |||
FWMark: 0, | |||
SchedName: "lc", | |||
Flags: 0, | |||
Flags: 3, |
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.
constants please?
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -184,7 +184,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Protocol: "", | |||
Port: 0, | |||
Scheduler: "lc", | |||
Flags: 0, | |||
Flags: 1, |
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.
constants please?
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -194,7 +194,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Port: 0, | |||
FWMark: 0, | |||
SchedName: "wrr", | |||
Flags: 0, | |||
Flags: 10, |
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.
constants please?
pkg/util/ipvs/ipvs_linux_test.go
Outdated
@@ -206,7 +206,7 @@ func Test_toFrontendService(t *testing.T) { | |||
Protocol: "", | |||
Port: 0, | |||
Scheduler: "wrr", | |||
Flags: 0, | |||
Flags: 8, |
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.
constants please?
6b9e414
to
5b0f69e
Compare
698ab39
to
1003204
Compare
1003204
to
21b02ad
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: m1093782566, thockin Associated issue: 52393 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 |
/retest Review the full test history for this PR. |
Automatic merge from submit-queue (batch tested with PRs 52469, 52574, 52330, 52689, 52829). If you want to cherry-pick this change to another branch, please follow the instructions here.. |
What this PR does / why we need it:
Which issue this PR fixes:
fixes #52393
Special notes for your reviewer:
Release note: