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

DefaultRESTMapper does not work for custom resources CRD #49948

Closed
ash2k opened this issue Aug 1, 2017 · 3 comments
Closed

DefaultRESTMapper does not work for custom resources CRD #49948

ash2k opened this issue Aug 1, 2017 · 3 comments
Assignees
Labels
area/custom-resources kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@ash2k
Copy link
Member

ash2k commented Aug 1, 2017

What happened:
DefaultRESTMapper.Add() uses UnsafeGuessKindToResource() instead of using plural field returned by discovery.

What you expected to happen:
Rest mapper should return correct plural form in the "resource" field of RESTMapping.

How to reproduce it (as minimally and precisely as possible):
Create a CRD where plural != lowercase kind+"s" e.g. plural is "bla1" and kind is "Blax".
On a discovery rest mapper try to call RESTMapping() with the group/kind of the CR.
It will return something like "blaxs".

I wonder how GC works in #47665. Isn't it affected by this issue? @ironcladlou

Environment:
I use 1.7 branch of client-go but looks like k8s master does not have any changes to DefaultRESTMapper so the bug is there too.

/kind bug
/sig api-machinery
/area third-party-resource

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. area/custom-resources labels Aug 1, 2017
@enisoc
Copy link
Member

enisoc commented Aug 2, 2017

cc @kubernetes/sig-api-machinery-bugs @deads2k

@deads2k
Copy link
Contributor

deads2k commented Aug 2, 2017

opened #50012

@ironcladlou
Copy link
Contributor

I somehow missed this issue and independently re-discovered it while root causing #50022. Oops! Thanks!

k8s-github-robot pushed a commit that referenced this issue Sep 15, 2017
Automatic merge from submit-queue

use specified discovery information if possible

Fixes #49948

This uses the available discovery information if available, but it seems we never updated "normal" resources to show the singular name, so its often not available.  I've left this code compatible.

@enisoc @ash2k 
@kubernetes/sig-api-machinery-misc 

```release-note
custom resources that use unconventional pluralization now work properly with kubectl and garbage collection
```
sttts pushed a commit to sttts/apimachinery that referenced this issue Sep 22, 2017
Automatic merge from submit-queue

use specified discovery information if possible

Fixes kubernetes/kubernetes#49948

This uses the available discovery information if available, but it seems we never updated "normal" resources to show the singular name, so its often not available.  I've left this code compatible.

@enisoc @ash2k 
@kubernetes/sig-api-machinery-misc 

```release-note
custom resources that use unconventional pluralization now work properly with kubectl and garbage collection
```

Kubernetes-commit: e190f391129260527c119fe319216212c916ae5d
sttts pushed a commit to sttts/client-go that referenced this issue Sep 22, 2017
Automatic merge from submit-queue

use specified discovery information if possible

Fixes kubernetes/kubernetes#49948

This uses the available discovery information if available, but it seems we never updated "normal" resources to show the singular name, so its often not available.  I've left this code compatible.

@enisoc @ash2k
@kubernetes/sig-api-machinery-misc

```release-note
custom resources that use unconventional pluralization now work properly with kubectl and garbage collection
```

Kubernetes-commit: e190f391129260527c119fe319216212c916ae5d
@enisoc enisoc moved this from Backlog to Done in CustomResourceDefinition Sep 26, 2017
akhilerm pushed a commit to akhilerm/apimachinery that referenced this issue Sep 20, 2022
Automatic merge from submit-queue

use specified discovery information if possible

Fixes kubernetes/kubernetes#49948

This uses the available discovery information if available, but it seems we never updated "normal" resources to show the singular name, so its often not available.  I've left this code compatible.

@enisoc @ash2k 
@kubernetes/sig-api-machinery-misc 

```release-note
custom resources that use unconventional pluralization now work properly with kubectl and garbage collection
```

Kubernetes-commit: e190f391129260527c119fe319216212c916ae5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/custom-resources kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
No open projects
Development

No branches or pull requests

5 participants