-
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
✨add CodecFactoryOptionsMutators for codecfactory #3048
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Chaunceyctx 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 |
Welcome @Chaunceyctx! |
Hi @Chaunceyctx. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ping gently @vincepri @sbueringer PTAL, thanks a lot :) |
45bf101
to
4fff6e3
Compare
4fff6e3
to
6d063ae
Compare
/ping gently @troy0820 |
@@ -150,7 +153,7 @@ func newClient(config *rest.Config, options Options) (*client, error) { | |||
config: config, | |||
scheme: options.Scheme, | |||
mapper: options.Mapper, | |||
codecs: serializer.NewCodecFactory(options.Scheme), | |||
codecs: serializer.NewCodecFactory(options.Scheme, options.CodecFactoryOptionsMutators...), |
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 is the user-facing difference in impact between configuring strict here vs. using client.WithFieldValdation to set FieldValidation in the Options structs?
Is it that the latter only affects Create/Update/patch?
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 is the user-facing difference in impact between configuring strict here vs. using client.WithFieldValdation to set FieldValidation in the Options structs?
Is it that the latter only affects Create/Update/patch?
@sbueringer thanks a lot for feedback :) Yes, FieldValidation
will be used in CreateOptions/UpdateOptions/PatchOptions. And these Options will tell apiserver how to select mode of decodeSerializer(strict or not strict), like: https://github.com/kubernetes/kubernetes/blob/6746df77f2376c6bc1fd0de767d2a94e6bd6cec1/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go#L109
So client also need to know how to select mode of decodeSerializer and use strict mode of decodeSerializer to avoid the aforementioned issue.
I will address failed ci job.
/ok-to-test |
@Chaunceyctx: 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. |
@sbueringer excuse me, could you give me some hints to address this failed ci job? I am a noob for go-apidiff tool |
What does this do, and why do we need it?
we have a production scenario:
the CRD field declared in the v1 version of the controller includes
field A
. However, when we upgrade the v1 controller to v2,field A
is removed from the corresponding CRD(we make some changes to this CRD).So we want the controller to realize this error during data deserialization, so we need to switch the corresponding serializer to
strict
mode.