-
Notifications
You must be signed in to change notification settings - Fork 1.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
⚠️ Allow passing a custom webhook server #2293
⚠️ Allow passing a custom webhook server #2293
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman 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 |
webhookServer *webhook.Server | ||
webhookServer webhook.Server |
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.
What are some use cases that require an interface 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.
Basically anything where the default implementation isn't working. The case I have at hand is that the same binary also generates the certificates, so Start
has to wait until they exist.
aaae15c
to
fec57a7
Compare
|
||
// DefaultServer is the default implementation used for Server. | ||
type DefaultServer struct { | ||
Options Options |
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.
Wondering if Options should be private given that we also have a constructor (but no strong opinion)
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.
The reason I left it public is that there are a bunch of tests in the Manager
that check some values in there
Currently it is impossible to pass a custom webhook server, because we reference the concrete type rather than an interface. Change this to an interface.
fec57a7
to
91cdd8c
Compare
Thx! /lgtm /hold |
/hold cancel |
@alvaroaleman: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
@alvaroaleman What's the plan to be able to configure the default webhook server? The |
Not sure if that's what you're trying to do, but I did it like this in Cluster API: https://github.com/kubernetes-sigs/cluster-api/blob/d825a40334ac768405d090ddf8eadb73eced3a6d/main.go#L277-L283 |
@sbueringer Yes! That solves the linter issue for me, I think we probably want to update the deprecation notes there though |
Earlier `webhook.Server` was a struct. All the struct fields like `Port`, `CertDir` is being moved to `Options` struct. kubernetes-sigs/controller-runtime#2293
See kubernetes-sigs/controller-runtime#2122 See kubernetes-sigs/controller-runtime#2293 Signed-off-by: Tarun Gupta Akirala <takirala@users.noreply.github.com>
Currently it is impossible to pass a custom webhook server, because we reference the concrete type rather than an interface. Change this to an interface.