mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
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.
This commit is contained in:
@@ -291,6 +291,13 @@ func (r *REST) ShortNames() []string {
|
||||
return []string{"ns"}
|
||||
}
|
||||
|
||||
var _ rest.SingularNameProvider = &REST{}
|
||||
|
||||
// SingularName implements the SingularNameProvider interfaces. This returns singular name of core resource.
|
||||
func (r *REST) SingularName() string {
|
||||
return "namespace"
|
||||
}
|
||||
|
||||
var _ rest.StorageVersionProvider = &REST{}
|
||||
|
||||
func (r *REST) StorageVersion() runtime.GroupVersioner {
|
||||
|
||||
@@ -628,3 +628,11 @@ func TestShortNames(t *testing.T) {
|
||||
expected := []string{"ns"}
|
||||
registrytest.AssertShortNames(t, storage, expected)
|
||||
}
|
||||
|
||||
func TestSingularName(t *testing.T) {
|
||||
storage, server := newStorage(t)
|
||||
defer server.Terminate(t)
|
||||
defer storage.store.DestroyFunc()
|
||||
expected := "namespace"
|
||||
registrytest.AssertSingularName(t, storage, expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user