-
Notifications
You must be signed in to change notification settings - Fork 40.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
[GarbageCollector] let dynamic client handle non-registered ListOptions #27733
[GarbageCollector] let dynamic client handle non-registered ListOptions #27733
Conversation
@@ -270,3 +270,23 @@ func (parameterCodec) DecodeParameters(parameters url.Values, from unversioned.G | |||
} | |||
|
|||
var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{} | |||
|
|||
type versionedParameterEncoderWithV1Fallback struct{} |
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.
Registering v1.ListOptions in the Policy group will fix #27622. But for thirdparty resources, we still need this versionedParameterEncoderWithV1Fallback codec.
For the record, API server always treats query parameters sent to a thirdparty resource endpoint as v1: https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/thirdpartyresourcedata/codec.go#L557
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.
Add as comment: "But for thirdparty resources, we still need this versionedParameterEncoderWithV1Fallback codec. For the record, currently API server always treats query parameters sent to a thirdparty resource endpoint as v1"
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.
Added to the comment on VersionedParameterEncoderWithV1Fallback
@@ -41,6 +42,7 @@ func addKnownTypes(scheme *runtime.Scheme) { | |||
scheme.AddKnownTypes(SchemeGroupVersion, | |||
&PodDisruptionBudget{}, | |||
&PodDisruptionBudgetList{}, | |||
&v1.ListOptions{}, |
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 about DeleteOptions? And ExportOptions?
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.
DeleteOptions makes sense. I'm not sure about ExportOptions. It's always treated as "v1": https://github.com/kubernetes/kubernetes/blob/master/pkg/apiserver/resthandler.go#L135, though that code might be wrong.
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.
Added DeleteOptions but not the ExportOptions.
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.
Wow, that code is wrong.
On Tue, Jun 21, 2016 at 12:18 AM, Chao Xu notifications@github.com wrote:
In pkg/apis/policy/v1alpha1/register.go
#27733 (comment)
:@@ -41,6 +42,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodDisruptionBudget{},
&PodDisruptionBudgetList{},
&v1.ListOptions{},
DeleteOptions makes sense. I'm not sure about ExportOptions. It's always
treated as "v1":
https://github.com/kubernetes/kubernetes/blob/master/pkg/apiserver/resthandler.go#L135,
though that code might be wrong.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/27733/files/1c74f17935c2b2cd29db72eda4f7a271b9d3bf24#r67805956,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_p3syUQTAoe1yPQ_6qu4t5C1959qIks5qN2YNgaJpZM4I6N5r
.
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.
ExportOptions is registered as unversioned type: https://github.com/kubernetes/kubernetes/blob/master/pkg/api/register.go#L108.
We should register it as an ordinary type. @smarterclayton Are you fine if I do that in another PR? Moving ExportOptions from unversioned/ to a api/ is an API change.
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 can do it in another issue - it's no less broken then (everything in an
API is versioned, even if we haven't explicitly created a second versioned
yet). Said another way, unversioned is something we haven't correctly
versioned yet (a bug).
It's not really an API change - the schema accepted is a version, so it's
really just an internal error that each group version doesn't explicitly
say what schema of export options they support.
On Tue, Jun 21, 2016 at 4:16 PM, Chao Xu notifications@github.com wrote:
In pkg/apis/policy/v1alpha1/register.go
#27733 (comment)
:@@ -41,6 +42,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodDisruptionBudget{},
&PodDisruptionBudgetList{},
&v1.ListOptions{},
ExportOptions is registered as unversioned type:
https://github.com/kubernetes/kubernetes/blob/master/pkg/api/register.go#L108
.We should register it as an ordinary type. @smarterclayton
https://github.com/smarterclayton Are you fine if I do that in another
PR? Moving ExportOptions from unversioned/ to a api/ is an API change.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/27733/files/1c74f17935c2b2cd29db72eda4f7a271b9d3bf24#r67943081,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_p_9PwWxieo6bTCjo3x8TS_UAqHvEks5qOEaCgaJpZM4I6N5r
.
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.
Tracked in #27886
1c74f17
to
7fe88cf
Compare
// TODO: api.ParameterCodec doesn't support thirdparty objects. | ||
// We need a generic parameter codec. | ||
return client.ParameterCodec(api.ParameterCodec).Resource(&apiResource, api.NamespaceAll).List(&options) | ||
return client.ParameterCodec(dynamic.VersionedParameterEncoderWithV1Fallback).Resource(&apiResource, api.NamespaceAll).List(&options) |
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.
nit: line breaks make stuff like this easier to read.
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.
Done.
LGTM-- please add the comment and apply the label yourself. |
7fe88cf
to
94dfd07
Compare
Comments addressed. Self applied the label. Thank you both for the review. |
@caesarxuchao looks like the build failed? Can you take a look? FAIL k8s.io/kubernetes/pkg/api 24.789s |
@goltermann thanks for the reminder! |
register ListOptions for apis/policy
94dfd07
to
d9f0792
Compare
Registered v1.DeleteOptions in batch/v2alpha1, that should fix the test. Reapplying the lgtm. |
GCE e2e build/test passed for commit d9f0792. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit d9f0792. |
Automatic merge from submit-queue |
And register v1.ListOptions in the policy group.
Fix #27622
@lavalamp @smarterclayton @krousey
This change is