-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[WIP] 🌱 Enable webhook envtests #5722
[WIP] 🌱 Enable webhook envtests #5722
Conversation
Signed-off-by: Stefan Büringer [email protected]
Signed-off-by: Stefan Büringer [email protected]
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
) | ||
|
||
// SetupWebhooksWithManager sets up all webhooks of the current package. | ||
func SetupWebhooksWithManager(mgr ctrl.Manager) error { |
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 don't necessarily need the package level functions to avoid the circular dependencies, but they would avoid some repetition (otherwise we would have to inline those funcs, aka we would need the full list of resources in all those cases)
dd48432
to
7bec4f2
Compare
@@ -216,18 +216,10 @@ func setupWebhooks(mgr ctrl.Manager) { | |||
setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfig") | |||
os.Exit(1) | |||
} |
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 don't have to register those webhooks (we don't register any other List webhooks)
@@ -69,6 +68,9 @@ func init() { | |||
klog.SetOutput(ginkgo.GinkgoWriter) | |||
|
|||
// Calculate the scheme. | |||
// FIXME(tbd): if we want to enable envtests in those packages too we |
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.
TBD
) | ||
|
||
// AllWebhooksWithManager sets up all webhooks. | ||
func AllWebhooksWithManager(mgr ctrl.Manager) { |
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.
In theory we also don't need this helper to avoid circular dependencies, but the alternative would be to inline it and have the list of webhooks redundantly
ctx = ctrl.SetupSignalHandler() | ||
) | ||
|
||
// FIXME(sbueringer): just part of this PR to prove that it works. |
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.
Just to prove the concept works, should be removed before merge
return ctrl.NewWebhookManagedBy(mgr). | ||
For(r). | ||
Complete() | ||
// SetupWebhooksWithManager sets up all webhooks of the current package. |
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.
Note: that github diff is really weird (it's just a new file)
7bec4f2
to
8600de1
Compare
8600de1
to
3cff8d2
Compare
@sbueringer: 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. |
@killianmuldoon @fabriziopandini This PR is meant as a starting point for the discussion on how the solve the issue. tl;dr is
P.S. apidiff would be fixed via deprecation if we want |
I've discussed the issue with Fabrizio and we would simply implement the webhooks integration test in a package like The problem with this PR is that it distributes the webhook setup all over the place vs. currently webhooks will just work out of the box when using envtest. Let's continue the discussion on the issue |
/close |
@sbueringer: Closed this PR. 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. |
What this PR does / why we need it:
WIP => currently mostly a PoC to discuss if we want to address the issue this way.
DOES NOT WORK RIGHT NOW
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #5721