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

🐛 fix webhook injector #316

Closed
wants to merge 3 commits into from

Conversation

mengqiy
Copy link
Member

@mengqiy mengqiy commented Feb 4, 2019

fixes #309

Based on #300.

use mgr.SetFields() for webhook server and implement Injector interface for webhooks.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 4, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mengqiy
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: pwittrock

If they are not already assigned, you can assign the PR to them by writing /assign @pwittrock in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 4, 2019
@mengqiy
Copy link
Member Author

mengqiy commented Feb 4, 2019

cc: @kdada

@DirectXMan12
Copy link
Contributor

can you provide a bit more detail in the PR description/commit message? Otherwise LGTM

@mengqiy
Copy link
Member Author

mengqiy commented Feb 4, 2019

can you provide a bit more detail in the PR description/commit message?

Done. Updated both.

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

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 ?

Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 12, 2019
@mengqiy
Copy link
Member Author

mengqiy commented Feb 12, 2019

The first 2 commits are from #300.

Copy link
Contributor

@droot droot left a 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()
Copy link
Contributor

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

mengqiy pushed a commit to mengqiy/controller-runtime that referenced this pull request Feb 13, 2019
drop server name and client
fix injector
@mengqiy
Copy link
Member Author

mengqiy commented Feb 13, 2019

Closing since the commit will be in #300.

@mengqiy mengqiy closed this Feb 13, 2019
@mengqiy mengqiy deleted the fixinjectorforwebhook branch February 14, 2019 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Webhook: Need more injection Interface in webhook server
4 participants