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

Handled taints on node in batch. #49524

Merged
merged 1 commit into from
Aug 7, 2017
Merged

Conversation

k82cn
Copy link
Member

@k82cn k82cn commented Jul 25, 2017

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 #49522

Release note:

None

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 25, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 25, 2017
@k82cn k82cn changed the title [WIP] Handled taints on node in batch. Handled taints on node in batch. Jul 25, 2017
@k82cn k82cn force-pushed the k8s_49522 branch 2 times, most recently from 6fb233e to 2fa5df7 Compare July 25, 2017 05:08
@k82cn
Copy link
Member Author

k82cn commented Jul 25, 2017

/retest

if err != nil {
return fmt.Errorf("Failed to update taint of node!")
}
if ok {
Copy link
Contributor

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -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 {
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@k82cn k82cn force-pushed the k8s_49522 branch 2 times, most recently from 778c373 to 7ed2f29 Compare July 25, 2017 14:36
@k82cn
Copy link
Member Author

k82cn commented Jul 25, 2017

/retest

@deads2k deads2k removed their assignment Jul 25, 2017
@k82cn
Copy link
Member Author

k82cn commented Jul 26, 2017

/assign @gmarek

@gmarek
Copy link
Contributor

gmarek commented Jul 31, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 31, 2017
@k82cn
Copy link
Member Author

k82cn commented Jul 31, 2017

/assign @janetkuo

Would you help to review it?

@k82cn
Copy link
Member Author

k82cn commented Jul 31, 2017

/test pull-kubernetes-bazel

@gmarek
Copy link
Contributor

gmarek commented Jul 31, 2017

/test pull-kubernetes-e2e-gce-etcd3

@k82cn
Copy link
Member Author

k82cn commented Jul 31, 2017

/retest

@gmarek
Copy link
Contributor

gmarek commented Aug 1, 2017

/test pull-kubernetes-e2e-kops-aws

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2017
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 3, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2017
@gmarek
Copy link
Contributor

gmarek commented Aug 3, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 3, 2017
@gmarek
Copy link
Contributor

gmarek commented Aug 3, 2017

/retest

@k82cn
Copy link
Member Author

k82cn commented Aug 4, 2017

ping for approve :). @kubernetes/sig-apps-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Aug 4, 2017
// Short circuit for limiting amount of API calls.
if node != nil {
match := false
MATCHED:
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure :).

Copy link
Contributor

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...

Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

@k82cn k82cn Aug 5, 2017

Choose a reason for hiding this comment

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

handled moving in #50179 .

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 5, 2017
{Key: "key1", Value: "value1", Effect: "NoSchedule"},
{Key: "key2", Value: "value2", Effect: "NoExecute"},
},
requestCount: 3,
Copy link
Member Author

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?

@k82cn
Copy link
Member Author

k82cn commented Aug 7, 2017

/retest

@gmarek
Copy link
Contributor

gmarek commented Aug 7, 2017

@k82cn - please fix gofmt.

@k82cn
Copy link
Member Author

k82cn commented Aug 7, 2017

k82cn@ - please fix gofmt.

Done. Proxy was down those day; can not open the detail of failed test :(.

@gmarek
Copy link
Contributor

gmarek commented Aug 7, 2017

/retest

@gmarek
Copy link
Contributor

gmarek commented Aug 7, 2017

Please squash commits.

@deads2k
Copy link
Contributor

deads2k commented Aug 7, 2017

/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 7, 2017
@gmarek
Copy link
Contributor

gmarek commented Aug 7, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 49524, 46760, 50206, 50166, 49603)

@k8s-github-robot k8s-github-robot merged commit 35eb03e into kubernetes:master Aug 7, 2017
@k82cn k82cn deleted the k8s_49522 branch May 16, 2022 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance helper to handle taints on node in batch.
7 participants