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

Drainer supports customized kubelet probe check #1977

Merged
merged 3 commits into from
Jan 7, 2021

Conversation

grac3gao-zz
Copy link
Contributor

Changes

  • Besides of directly returning "200 OK", drainer accepts customized kubelet probe check to perform when the handler is not in Drain status.

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Dec 28, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 28, 2020
@codecov
Copy link

codecov bot commented Dec 28, 2020

Codecov Report

Merging #1977 (d73f1e0) into master (27db5ac) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1977   +/-   ##
=======================================
  Coverage   69.06%   69.07%           
=======================================
  Files         210      210           
  Lines        8796     8798    +2     
=======================================
+ Hits         6075     6077    +2     
  Misses       2451     2451           
  Partials      270      270           
Impacted Files Coverage Δ
network/handlers/drain.go 83.33% <100.00%> (+0.83%) ⬆️
version/version.go 87.50% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27db5ac...d73f1e0. Read the comment docs.

@grac3gao-zz
Copy link
Contributor Author

/cc @Harwayne

@grac3gao-zz
Copy link
Contributor Author

/assign @vagababov

Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

I've just got nits
/assign mattmoor

network/handlers/drain.go Outdated Show resolved Hide resolved
network/handlers/drain.go Outdated Show resolved Hide resolved
network/handlers/drain.go Outdated Show resolved Hide resolved
Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

A few nits, but I'll leave to Matt to approve.

/lgtm

network/handlers/drain.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 6, 2021
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 6, 2021
@vagababov
Copy link
Contributor

may be you still need the return after you report failure.

@vagababov
Copy link
Contributor

Nah, that doesn't seem right....

@grac3gao-zz
Copy link
Contributor Author

/retest

network/handlers/drain.go Outdated Show resolved Hide resolved
Comment on lines 63 to 65
// CheckOption is the optional checker
// for kubelet probe to perform when the handler is not in Drain status.
CheckOption CheckOption
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// CheckOption is the optional checker
// for kubelet probe to perform when the handler is not in Drain status.
CheckOption CheckOption
// HealthCheck is an optional health check that is performed until the drain signal is received.
// When unspecified, a "200 OK" is returned, otherwise this function is invoked.
HealthCheck http.HandlerFunc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, I am in favor of custom name too. Do you mind if I change back to CheckOption and keep the comment you suggested?

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the value we're getting from the type alias? inlined, I know it's a well known handler interface I need to implement. outlined I need to look it up before doing the same.

We're not defining our own methods on the type alias, or "constants" we expect to be passed as values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that sounds reasonable to me. I'll keep the current change you suggested, and remove the hold.

@vagababov
Copy link
Contributor

I kind of liked custom name, but 🤷

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold

Holding for discussion around the type alias

@knative-prow-robot knative-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Jan 7, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grac3gao, mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2021
@vagababov
Copy link
Contributor

I am not going to fight for it. For me the alias was preferable, since tomorrow if we decide to change the signature (e.g. to add context) it's just signature and call-sites, now it's more work.
But, all in all, it's soft subjective preference that I am not fighting for, so don't hold on me :)

@grac3gao-zz
Copy link
Contributor Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 7, 2021
@knative-prow-robot knative-prow-robot merged commit 93874f0 into knative:master Jan 7, 2021
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants