-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠ Remove deprecated Defaulter and Validator interfaces #2877
⚠ Remove deprecated Defaulter and Validator interfaces #2877
Conversation
1c3cb32
to
ebdc829
Compare
@troy0820 can you remind me where we said we're going to remove them with 0.19? IIRC it was on some issue, can you please link it in the PR description? That being said, not sure when we should do it. I think this will require a lot of folks to make changes, maybe we should give them more time. I don't think we have anything pressing that requires us to drop them very soon. @vincepri @alvaroaleman wdyt? |
Updated the PR description with the issue.
I’m not in any rush to remove them but it was put against the v0.19 milestone. We can wait if the changes need to be made other places as well as give people more time. |
@grzesuav: changing LGTM is restricted to collaborators 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-sigs/prow repository. |
Signed-off-by: Troy Connor <[email protected]>
ebdc829
to
e5a4a04
Compare
@troy0820 Thx for working on this! I talked to @alvaroaleman @vincepri and we would merge it right after the 0.19.0 release so it would be part of 0.20.0. I'll review the PR soon |
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.
Looks good overall. Mostly just wanting to make sure that for whatever coverage we drop we'll have the corresponding coverage with the new types
|
||
var _ = Describe("Defaulter Handler", func() { | ||
|
||
It("should return ok if received delete verb in defaulter handler", 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.
Please check if we have coverage like this for the customdefaulter (somewhere, e.g. might better fit in webhook_test.go, or we already have it there)
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.
(same for validator_test.go)
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.
Do you want this to run through the webhook_test.go
in the admissions package or create this in the pkg/builder/webhook_test.go
which can test the whole flow? @sbueringer
edited:
We currently do do not have any coverage for custom validator/defaulter in this 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.
We currently do have any coverage for custom validator/defaulter in this package.
We currently do not have any coverage for custom validator/defaulter in this package.
Right?
The more I'm thinking about it the more I think we should have these tests in defaulter_custom_test.go to actually unit test this code (same for validator).
(to be clear I would just move the existing tests in defaulter_test.go / validator_test.go over to the corresponding defaulter_custom_test.go / .. files. Let's keep webhook_test.go tests where they are)
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.
@troy0820 same for the tests from validator_test.go (sorry not sure if that's WIP right now :))
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.
Indeed, a little more work for the validator_test.go one. Should be coming soon.
Hi folks, Could we please not merge this one for the next release? /hold |
We are not going to merge it for 0.19 (August), but we are going to merge it for 0.20 (December/January). We had this deprecated since 0.17, I don't think we should delay it further than December |
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.
Thx, last one from my side
Signed-off-by: Troy Connor <[email protected]>
ec45cd7
to
b265d8d
Compare
@troy0820: 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-sigs/prow repository. I understand the commands that are listed here. |
/lgtm /assign @alvaroaleman @vincepri |
LGTM label has been added. Git tree hash: 768a8843959209c67747ee81ea6178d221db3198
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grzesuav, sbueringer, troy0820 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 |
…ok.Defaulter interfaces (#4060) Remove the usage of deprecated functions for webhooks Controller-Runtime change the interfaces and will remove the Default and Validation ones, so this PR ensure that kubebuilder scaffold will still working and addressing the deprecations. kubernetes-sigs/controller-runtime#2877
@@ -77,7 +77,7 @@ func runTests(admissionReviewVersion string) { | |||
close(stop) | |||
}) | |||
|
|||
It("should scaffold a defaulting webhook if the type implements the Defaulter interface", func() { | |||
It("should scaffold a custom defaulting webhook if the type implements the CustomDefaulter interface", 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.
why didn't you remove this test?
There is already should scaffold a defaulting webhook with a custom defaulter
below.
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.
I think this was an oversight, we can delete this one
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.
I think same for should scaffold a custom validating webhook if the type implements the CustomValidator interface
operator-sdk generates the webhook code that targets sigs.k8s.io/controller-runtime v0.19 or older. As such, it contains webhook.Validator and webhook.Defaulter. This API was removed in v0.20, see [1]. To make this work, we patched the code out while generating it. But now we have to fix it. Fix it now for the new API. [1] kubernetes-sigs/controller-runtime#2877
operator-sdk generates the webhook code that targets sigs.k8s.io/controller-runtime v0.19 or older. As such, it contains webhook.Validator and webhook.Defaulter. This API was removed in v0.20, see [1]. To make this work, we patched the code out while generating it. But now we have to fix it. Fix it now for the new API. [1] kubernetes-sigs/controller-runtime#2877
operator-sdk generates the webhook code that targets sigs.k8s.io/controller-runtime v0.19 or older. As such, it contains webhook.Validator and webhook.Defaulter. This API was removed in v0.20, see [1]. To make this work, we patched the code out while generating it. But now we have to fix it. Fix it now for the new API. [1] kubernetes-sigs/controller-runtime#2877
We deprecated the
admission.Validator
and theadmission.Defaulter
interfaces and these are said to be removed inrelease-0.19.release-0.20Closes #2641
Remove tests for those typesChange tests for the deprecated types to the CustomDefaulter/CustomValidatorChangeRemove log message that point to the now removed interfaces for the builder.Warnings
tovalidator_custom.go