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

[GarbageCollector] let dynamic client handle non-registered ListOptions #27733

Merged
merged 1 commit into from
Jun 23, 2016

Conversation

caesarxuchao
Copy link
Member

@caesarxuchao caesarxuchao commented Jun 20, 2016

And register v1.ListOptions in the policy group.

Fix #27622

@lavalamp @smarterclayton @krousey


This change is Reviewable

@caesarxuchao caesarxuchao added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 20, 2016
@@ -270,3 +270,23 @@ func (parameterCodec) DecodeParameters(parameters url.Values, from unversioned.G
}

var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{}

type versionedParameterEncoderWithV1Fallback struct{}
Copy link
Member Author

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

Copy link
Member

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"

Copy link
Member Author

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

@k8s-github-robot k8s-github-robot added kind/new-api size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 20, 2016
@@ -41,6 +42,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodDisruptionBudget{},
&PodDisruptionBudgetList{},
&v1.ListOptions{},
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

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
.

Copy link
Member Author

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.

Copy link
Contributor

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
.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracked in #27886

@caesarxuchao
Copy link
Member Author

@k8s-bot node e2e test this, issue #27779

// 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)
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@lavalamp lavalamp added this to the v1.3 milestone Jun 22, 2016
@lavalamp lavalamp added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 22, 2016
@lavalamp
Copy link
Member

LGTM-- please add the comment and apply the label yourself.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 22, 2016
@caesarxuchao
Copy link
Member Author

Comments addressed. Self applied the label. Thank you both for the review.

@goltermann
Copy link
Contributor

@caesarxuchao looks like the build failed? Can you take a look?

FAIL k8s.io/kubernetes/pkg/api 24.789s

@caesarxuchao
Copy link
Member Author

@goltermann thanks for the reminder!

register ListOptions for apis/policy
@caesarxuchao
Copy link
Member Author

Registered v1.DeleteOptions in batch/v2alpha1, that should fix the test. Reapplying the lgtm.

@caesarxuchao caesarxuchao added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 22, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 22, 2016

GCE e2e build/test passed for commit d9f0792.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jun 23, 2016

GCE e2e build/test passed for commit d9f0792.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit d363759 into kubernetes:master Jun 23, 2016
@caesarxuchao caesarxuchao changed the title let dynamic client handle non-registered ListOptions [GarbageCollector] let dynamic client handle non-registered ListOptions Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants