-
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
🐛 fix webhook injector #316
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mengqiy If they are not already assigned, you can assign the PR to them by writing 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 |
cc: @kdada |
can you provide a bit more detail in the PR description/commit message? Otherwise LGTM |
aa84331
to
859819e
Compare
Done. Updated both. |
pkg/webhook/server.go
Outdated
@@ -181,6 +180,11 @@ func (s *Server) Register(webhooks ...Webhook) error { | |||
} | |||
s.registry[webhook.GetPath()] = webhooks[i] | |||
s.sMux.Handle(webhook.GetPath(), webhook.Handler()) | |||
|
|||
// Inject dependencies into each webhook | |||
if err := s.manager.SetFields(webhooks[i]); err != 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.
Interesting... Won't manager call SetField
on webhook server and that should call the inject field for each of the webhooks ? because manager knows when all the deps are resolved ?
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.
yeah, this should be receiving an injectfunc, which it should be using to inject things, as opposed to having a reference to the manager.
859819e
to
c5c7205
Compare
c5c7205
to
47a7b28
Compare
…face for webhooks
47a7b28
to
a4ef929
Compare
The first 2 commits are from #300. |
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.
overall looks good to me.
Mutating(). | ||
Operations(admissionregistrationv1beta1.Create, admissionregistrationv1beta1.Update). | ||
WithManager(mgr). | ||
ForType(&corev1.Pod{}). | ||
Handlers(&podAnnotator{}). | ||
Build() |
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.
This looks a lot simpler now :)
drop server name and client fix injector
Closing since the commit will be in #300. |
fixes #309
Based on #300.
use
mgr.SetFields()
for webhook server and implementInjector
interface for webhooks.