-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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 group alias names to API resources to allow discovery #43338
Add group alias names to API resources to allow discovery #43338
Conversation
I like the concept, but "group" is a really overloaded term. Is there something else we can call this? |
What about categories? |
Aliases, categories, alias groups, alias classes, in aliases, part of? |
fcebc18
to
c8f9c40
Compare
@@ -693,6 +693,8 @@ type APIResource struct { | |||
Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"` | |||
// shortNames is a list of suggested short names of the resource. | |||
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"` | |||
// groupNames is a list of group aliases this resource belongs to (e.g. 'all') | |||
GroupNames []string `json:"groupNames,omitempty" protobuf:"bytes,6,rep,name=groupNames"` |
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.
AliasMembership? Aliases? AliasInclusion? AliasesAssociated?
Definitely this can't be called anything with the word "group", too confusing with api groups.
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.
I don't think its quite an alias. Alias implies its a one to one match. This is more like a category where the category explodes into multiple resources.
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.
Other thought: What if we extend ShortName to just include such things?
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 AssociatedCategories
, InCategories
, LinkedCategories
?
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.
Other thought: What if we extend ShortName to just include such things?
I don't think that you want to accidentally end up with a category name since that will do weird things in the CLI. all/some-name
is unlikely to play nice in kubectl.
That does raise some interesting name-squatting concerns. Perhaps a CLI user should be forced to opt-in to particular categories in some way?
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 happens if a shortname and resource name collide today?
Shortnames are resolved ahead of resource names. I found it while looking at writing a new kind of RESTMapper.
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.
hmm, that seems backwards. can we reverse that before we ship a collision?
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.
that seems backwards
Looks like the order should be resource names > shortnames > categories.
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.
hmm, that seems backwards. can we reverse that before we ship a collision?
As I said, "while looking at writing a new kind of RESTMapper". Fix for 1.7, but given layering probably not for 1.6.
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.
PR updated to call it Categories
.
@k8s-bot unit test this |
88da41c
to
0dc2082
Compare
c8367bc
to
f9a4a5c
Compare
f9a4a5c
to
6e6ab3d
Compare
@k8s-bot unit test this |
4039048
to
2132656
Compare
@@ -697,6 +697,8 @@ type APIResource struct { | |||
Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"` | |||
// shortNames is a list of suggested short names of the resource. | |||
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"` | |||
// categories is a list of the grouped resources this resource belongs to (e.g. 'all') | |||
Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"` |
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.
lgtm
bb6c9d2
to
9cd7f87
Compare
@k8s-bot pull-kubernetes-federation-e2e-gce test this |
@k8s-bot pull-kubernetes-unit test this |
/retest |
hadn't seen this before. From an integration tests /retest |
9cd7f87
to
ea63c56
Compare
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
@k8s-bot pull-kubernetes-e2e-kops-aws test this |
@fabianofranz: 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/test-infra repository. I understand the commands that are listed here. |
@k8s-bot pull-kubernetes-e2e-kops-aws test this |
ea63c56
to
39e5812
Compare
Automatic merge from submit-queue (batch tested with PRs 46967, 46992, 43338, 46717, 46672) |
What this PR does / why we need it:
Adds
GroupNames []string
to API resources, which represents the list of group aliases that every resource belongs to.Partially fixes #41353
This moves the logic of "all" (which currently translates to "pods,replicationcontrollers,services,...") to the server-side. Will allow clients like
kubectl
to discover group aliases instead of having it hardcoded and the API server to better handle consistency across multiple clients, version skew, etc; and will make "all" un-special and allow other groups to be created.As a follow-up we'll patch
kubectl
to make groups aliases discoverable and the hardcoded list a fallback while we still have to support it.Related to #42595 (comment).
Release note:
@kubernetes/sig-api-machinery-misc @deads2k @bgrant0607