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

Cannot list custom objects defined by CRD with non-conventional pluralization #51639

Closed
ayj opened this issue Aug 30, 2017 · 10 comments
Closed
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

@ayj
Copy link

ayj commented Aug 30, 2017

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

kubectl get route-rules.config.istio.io fails and prints "the server doesn't have a resource type "route-rules" in group "config.istio.io" with the following CRD.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: route-rules.config.istio.io
spec:
  group: config.istio.io
  names:
    kind: RouteRule
    plural: route-rules
    singular: routerule
  version: v1alpha2

What you expected to happen:

kubectl get route-rules.config.istio.io should return the list of custom objects defined by the route-rules.config.istio.io CRD or No resources found if no objects have been created yet.

How to reproduce it (as minimally and precisely as possible):

Non-working example

$ cat bad.yaml 
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: route-rules.config.istio.io
spec:
  group: config.istio.io
  names:
    kind: RouteRule
    plural: route-rules
    singular: routerule
  version: v1alpha2

$ kubectl apply -f bad.yaml 
customresourcedefinition "route-rules.config.istio.io" created

$ kubectl get route-rules.config.istio.io
the server doesn't have a resource type "route-rules" in group "config.istio.io"

Anything else we need to know?:

The following CRD does work as expected.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: routerules.config.istio.io
spec:
  group: config.istio.io
  names:
    kind: RouteRule
    plural: routerules
    singular: routerule
  version: v1alpha2

$ kubectl get routerules.config.istio.io
No resources found

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.4", GitCommit:"793658f2d7ca7f064d2bdf606519f9fe1229c381", GitTreeState:"clean", BuildDate:"2017-08-17T08:48:23Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T06:43:48Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: GKE 1.7.3 ALPHA
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 30, 2017
@k8s-github-robot
Copy link

@ayj
There are no sig labels on this issue. Please add a sig label by:

  1. mentioning a sig: @kubernetes/sig-<group-name>-<group-suffix>
    e.g., @kubernetes/sig-contributor-experience-<group-suffix> to notify the contributor experience sig, OR

  2. specifying the label manually: /sig <label>
    e.g., /sig scalability to apply the sig/scalability label

Note: Method 1 will trigger an email to the group. You can find the group list here and label list here.
The <group-suffix> in the method 1 has to be replaced with one of these: bugs, feature-requests, pr-reviews, test-failures, proposals

@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Aug 30, 2017
@ayj
Copy link
Author

ayj commented Aug 30, 2017

@nikhita
Copy link
Member

nikhita commented Aug 30, 2017

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

/cc @sttts @deads2k @enisoc

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. area/custom-resources labels Aug 30, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Aug 30, 2017
@lavalamp
Copy link
Member

@mbohlool @pwittrock

@alindeman
Copy link
Contributor

I poked at this a bit, and I think it may be more of a CLI UI/UX issue.

While the CLI reports "customresourcedefinition "routerules.config.istio.io" created", kubectl get looks up based on kind (not singular or plural name).

Specifically, if we change kind to something completely arbitrary like Noodle:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: routerules.config.istio.io
spec:
  group: config.istio.io
  names:
    kind: Noodle
    plural: routerules
    singular: routerule
  version: v1alpha2

And apply it:

$ kubectl apply -f noodle.yml
customresourcedefinition "routerules.config.istio.io" created

We get the expected NotFound when listing noodle.config.istio.io or noodles.config.istio.io:

$ kubectl get noodle.config.istio.io
Error from server (NotFound): Unable to list "noodles" ...
$ kubectl get noodles.config.istio.io
Error from server (NotFound): Unable to list "noodles" ...
$ kubectl get routerules.config.istio.io
the server doesn't have a resource type "routerules" in group "config.istio.io"

@sttts
Copy link
Contributor

sttts commented Sep 1, 2017

If anybody wants to work on this, here are some pointers:

The problem with the second expansion (of e.g. noodles.config.istio.io) seems to be that it maps noodles.config.istio.io as a GroupKind to the resource name noodles, but /apis/<group>/namespace/default/noodles does not exist.

Maybe @deads2k or @liggitt can confirm or correct my quick observations above.

@deads2k
Copy link
Contributor

deads2k commented Sep 1, 2017

Maybe @deads2k or @liggitt can confirm or correct my quick observations above.

It sounds plausible. I'd be happy to see the "let's guess at a plural" code gone.

@ash2k
Copy link
Member

ash2k commented Sep 13, 2017

Probably caused by #49948.

@mbohlool mbohlool removed their assignment Sep 18, 2017
@mbohlool mbohlool added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Sep 18, 2017
@mbohlool
Copy link
Contributor

mbohlool commented Sep 18, 2017

This does not seem to be an api-machinery issue. I will remove sig-api-machinery label and add sig cli.

@mbohlool mbohlool removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Sep 18, 2017
@liggitt
Copy link
Member

liggitt commented Sep 18, 2017

it was api-machinery, fixed in #50012

@liggitt liggitt added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Sep 18, 2017
@liggitt liggitt closed this as completed Sep 18, 2017
@enisoc enisoc moved this from Backlog to Done in CustomResourceDefinition Sep 26, 2017
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