mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
added short names for resources which are exposed during discovery
This commit is contained in:
@@ -86,6 +86,14 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST) {
|
||||
return &REST{store}, &StatusREST{store: &statusStore}
|
||||
}
|
||||
|
||||
// Implement ShortNamesProvider
|
||||
var _ rest.ShortNamesProvider = &REST{}
|
||||
|
||||
// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
|
||||
func (r *REST) ShortNames() []string {
|
||||
return []string{"rc"}
|
||||
}
|
||||
|
||||
// StatusREST implements the REST endpoint for changing the status of a replication controller
|
||||
type StatusREST struct {
|
||||
store *genericregistry.Store
|
||||
|
||||
@@ -327,3 +327,11 @@ func TestScaleUpdate(t *testing.T) {
|
||||
t.Fatalf("unexpected error, expecting an update conflict but got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShortNames(t *testing.T) {
|
||||
storage, server := newStorage(t)
|
||||
defer server.Terminate(t)
|
||||
defer storage.Controller.Store.DestroyFunc()
|
||||
expected := []string{"rc"}
|
||||
registrytest.AssertShortNames(t, storage.Controller, expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user