Introduce singularNameProvider for core types
This introduces `singularNameProvider`. This provider will be used by core types to have their singular names are defined in discovery endpoint. Thanks to that, core resources singular name always have higher precedence than CRDs shortcuts or singular names. Kubernetes-commit: 0990ba1cc92449bbbd9b25a4391f1da834f8c5fd
This commit is contained in:
parent
ff6e749660
commit
da3d6b945b
|
|
@ -1080,6 +1080,9 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
if categoriesProvider, ok := storage.(rest.CategoriesProvider); ok {
|
||||
apiResource.Categories = categoriesProvider.Categories()
|
||||
}
|
||||
if singularNameProvider, ok := storage.(rest.SingularNameProvider); ok {
|
||||
apiResource.SingularName = singularNameProvider.SingularName()
|
||||
}
|
||||
if gvkProvider, ok := storage.(rest.GroupVersionKindProvider); ok {
|
||||
gvk := gvkProvider.GroupVersionKind(a.group.GroupVersion)
|
||||
apiResource.Group = gvk.Group
|
||||
|
|
|
|||
|
|
@ -89,6 +89,12 @@ type CategoriesProvider interface {
|
|||
Categories() []string
|
||||
}
|
||||
|
||||
// SingularNameProvider returns singular name of resources. This is used by kubectl discovery to have singular
|
||||
// name representation of resources. In case of shortcut conflicts(with CRD shortcuts) singular name should always map to this resource.
|
||||
type SingularNameProvider interface {
|
||||
SingularName() string
|
||||
}
|
||||
|
||||
// GroupVersionKindProvider is used to specify a particular GroupVersionKind to discovery. This is used for polymorphic endpoints
|
||||
// which generally point to foreign versions. Scale refers to Scale.v1beta1.extensions for instance.
|
||||
// This trumps KindProvider since it is capable of providing the information required.
|
||||
|
|
|
|||
Loading…
Reference in New Issue