-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Handled taints on node in batch. #49524
Conversation
6fb233e
to
2fa5df7
Compare
/retest |
pkg/controller/controller_utils.go
Outdated
if err != nil { | ||
return fmt.Errorf("Failed to update taint of node!") | ||
} | ||
if 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 miss languages where you can write updated |= 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.
done
pkg/controller/controller_utils.go
Outdated
@@ -916,20 +934,11 @@ func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taint *v1.Ta | |||
// won't fail if target taint doesn't exist or has been removed. | |||
// If passed a node it'll check if there's anything to be done, if taint is not present it won't issue | |||
// any API calls. | |||
func RemoveTaintOffNode(c clientset.Interface, nodeName string, taint *v1.Taint, node *v1.Node) error { | |||
// Short circuit for limiting amount of API calls. | |||
if node != nil { |
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.
Can we keep this logic? It was added to prevent calling API server if there are no matching Taints.
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.
778c373
to
7ed2f29
Compare
/retest |
/assign @gmarek |
/lgtm |
/assign @janetkuo Would you help to review it? |
/test pull-kubernetes-bazel |
/test pull-kubernetes-e2e-gce-etcd3 |
/retest |
/test pull-kubernetes-e2e-kops-aws |
/lgtm |
/retest |
ping for approve :). @kubernetes/sig-apps-pr-reviews |
pkg/controller/controller_utils.go
Outdated
// Short circuit for limiting amount of API calls. | ||
if node != nil { | ||
match := false | ||
MATCHED: |
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 don't like loop labels. Can you instead wrap for _, taint...
into a annonymous function that returns 'match' and break if it returns true?
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.
sure :).
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.
Also we should have some simple unit test for those functions...
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.
hm... try to add unit test when creating this PR; it will import node/testutil
for FakeNodeHandler
, although it did not introduce Circular Dependency. Do you think we should move it node/testutil
to controller/testutil
which is also used by cloud controller, or just import it for test.
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.
moving node/testutil to controller/testutil SG
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.
handled moving in #50179 .
{Key: "key1", Value: "value1", Effect: "NoSchedule"}, | ||
{Key: "key2", Value: "value2", Effect: "NoExecute"}, | ||
}, | ||
requestCount: 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.
@gmarek , do you think we should also pass *v1.Node to reduce api call?
/retest |
@k82cn - please fix gofmt. |
Done. Proxy was down those day; can not open the detail of failed test :(. |
/retest |
Please squash commits. |
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, gmarek, k82cn Associated issue: 49522 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 49524, 46760, 50206, 50166, 49603) |
What this PR does / why we need it:
Enhanced helpers to handled taints on node in batch.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #49522Release note: