Add group alias names to discovery in registry
Kubernetes-commit: 058f9b4f32f085075f7c2cc6c2caabc80ef41815
This commit is contained in:
parent
fe3c2f4191
commit
e06c9d2f84
|
@ -376,6 +376,12 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
|
||||
tableProvider, _ := storage.(rest.TableConvertor)
|
||||
|
||||
var categories []string
|
||||
categoriesProvider, ok := storage.(rest.CategoriesProvider)
|
||||
if ok {
|
||||
categories = categoriesProvider.Categories()
|
||||
}
|
||||
|
||||
var apiResource metav1.APIResource
|
||||
// Get the list of actions for the given scope.
|
||||
switch scope.Name() {
|
||||
|
@ -822,6 +828,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
}
|
||||
sort.Strings(apiResource.Verbs)
|
||||
apiResource.ShortNames = shortNames
|
||||
apiResource.Categories = categories
|
||||
|
||||
return &apiResource, nil
|
||||
}
|
||||
|
|
|
@ -71,6 +71,12 @@ type ShortNamesProvider interface {
|
|||
ShortNames() []string
|
||||
}
|
||||
|
||||
// CategoriesProvider allows a resource to specify which groups of resources (categories) it's part of. Categories can
|
||||
// be used by API clients to refer to a batch of resources by using a single name (e.g. "all" could translate to "pod,rc,svc,...").
|
||||
type CategoriesProvider interface {
|
||||
Categories() []string
|
||||
}
|
||||
|
||||
// Lister is an object that can retrieve resources that match the provided field and label criteria.
|
||||
type Lister interface {
|
||||
// NewList returns an empty object that can be used with the List call.
|
||||
|
|
Loading…
Reference in New Issue