-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Refactor controller-manager: turn Serve func into handlerchain builder #60197
Refactor controller-manager: turn Serve func into handlerchain builder #60197
Conversation
/assign @lavalamp |
dfb7068
to
d20e4e5
Compare
/cc @stewart-yu |
@hzxuzhonghu: GitHub didn't allow me to request PR reviews from the following users: stewart-yu. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
cmd/controller-manager/app/serve.go
Outdated
// Serve creates a base handler chain for a controller manager. It runs the | ||
// the chain with the given serveFunc. | ||
func Serve(c *CompletedConfig, serveFunc serveFunc, stopCh <-chan struct{}) error { | ||
func DefaultBuildHandlerChain(c *CompletedConfig) http.Handler { |
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.
take a handler in? Trying to match func(apiHandler http.Handler, c *Config) (secure http.Handler)
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.
No, remove serverFunc. DefaultBuildHandlerChain
only takes in config and return a handler like it does in apiserver.
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.
github does not compare accurately
400d5d6
to
5654c2d
Compare
cmd/controller-manager/app/serve.go
Outdated
// the chain with the given serveFunc. | ||
func Serve(c *CompletedConfig, serveFunc serveFunc, stopCh <-chan struct{}) error { | ||
// DefaultBuildHandlerChain takes in CompletedConfig and returns a handler. | ||
func DefaultBuildHandlerChain(c *CompletedConfig) http.Handler { |
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.
We're trying to match this: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/server/config.go#L130 so that we'll have choices about using this instead.
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 for your explanation. And will think about tomorrow morning。
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.
@deads2k PTAL
5654c2d
to
d7ac2be
Compare
d7ac2be
to
e32aebe
Compare
/assign @cheftako |
cmd/controller-manager/app/serve.go
Outdated
// the chain with the given serveFunc. | ||
func Serve(c *CompletedConfig, serveFunc serveFunc, stopCh <-chan struct{}) error { | ||
// NewDebugHandler takes in CompletedConfig and returns a handler. | ||
func NewDebugHandler(c *CompletedConfig) http.Handler { |
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.
healthz is not really debug. Can we call it NewBaseHandler or something like that?
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.
ok to me
Lgtm, only the name DebugHandler is not so good IMO. |
e32aebe
to
d3b3db9
Compare
d3b3db9
to
51c6043
Compare
51c6043
to
9243339
Compare
Done, renamed to |
cmd/controller-manager/app/serve.go
Outdated
@@ -33,11 +32,23 @@ import ( | |||
"k8s.io/kubernetes/pkg/util/configz" | |||
) | |||
|
|||
type serveFunc func(handler http.Handler, shutdownTimeout time.Duration, stopCh <-chan struct{}) error | |||
// DefaultBuildHandlerChain takes in handler and CompletedConfig and returns a handler. | |||
func DefaultBuildHandlerChain(apiHandler http.Handler, c *CompletedConfig) http.Handler { |
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.
nit: as this is hardcoded anyway, we could just call is BuildHandlerChain
. In the apiserver it can be customized for the config. So we called it DefaultBuildHandlerChain
because it is the default func.
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.
oh, ic, missed it. fixed now
/approve |
9243339
to
1233b17
Compare
/retest |
/lgtm |
1233b17
to
540a1de
Compare
rebased @thockin for approval |
kindly ping @thockin for approval |
@luxas can you approve? |
ping @luxas can you approve? |
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.
/approve
Thanks @sttts for the ping on Slack. I'm and have been OOO for the first four months of the year, so I don't watch Github or notification email. Sorry for not seeing this.
Thanka for the patch!
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, hzxuzhonghu, luxas, sttts 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 |
/retest Review the full test history for this PR. Silence the bot with an |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue (batch tested with PRs 60197, 61614, 62074, 62071, 62301). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
follow up #59582 fix
Special notes for your reviewer:
Release note: