From 72202f9a007be06ca0fb9af1b30b76ab072b8c15 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Sat, 13 May 2023 11:10:55 -0400 Subject: [PATCH 1/2] Revert "add shortnames for mutatingwebhookconfigurations and validatingwebhookconfigurations" This reverts commit 7514d8b333913809e659112375e4447bce5af32e. --- .../storage/storage.go | 5 -- .../storage/storage_test.go | 51 ------------------- .../storage/storage.go | 5 -- .../storage/storage_test.go | 8 --- 4 files changed, 69 deletions(-) delete mode 100644 pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage_test.go diff --git a/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage.go b/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage.go index 71b5270c9b6..75c92690f1f 100644 --- a/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage.go +++ b/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage.go @@ -64,8 +64,3 @@ var _ rest.CategoriesProvider = &REST{} func (r *REST) Categories() []string { return []string{"api-extensions"} } - -// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource. -func (r *REST) ShortNames() []string { - return []string{"mwc"} -} diff --git a/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage_test.go b/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage_test.go deleted file mode 100644 index 9b47ce8b097..00000000000 --- a/pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage/storage_test.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package storage - -import ( - "testing" - - "k8s.io/apiserver/pkg/registry/generic" - etcd3testing "k8s.io/apiserver/pkg/storage/etcd3/testing" - "k8s.io/kubernetes/pkg/apis/admissionregistration" - "k8s.io/kubernetes/pkg/registry/registrytest" - - // Ensure that admissionregistration package is initialized. - _ "k8s.io/kubernetes/pkg/apis/admissionregistration/install" -) - -func newStorage(t *testing.T) (*REST, *etcd3testing.EtcdTestServer) { - etcdStorage, server := registrytest.NewEtcdStorage(t, admissionregistration.GroupName) - restOptions := generic.RESTOptions{ - StorageConfig: etcdStorage, - Decorator: generic.UndecoratedStorage, - DeleteCollectionWorkers: 1, - ResourcePrefix: "mutatingwebhookconfigurations"} - storage, err := NewREST(restOptions) - if err != nil { - t.Fatalf("unexpected error from REST storage: %v", err) - } - return storage, server -} - -func TestShortNames(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - expected := []string{"mwc"} - registrytest.AssertShortNames(t, storage, expected) -} diff --git a/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage.go b/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage.go index 8f05ec514f3..6312f6a0cd0 100644 --- a/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage.go +++ b/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage.go @@ -64,8 +64,3 @@ var _ rest.CategoriesProvider = &REST{} func (r *REST) Categories() []string { return []string{"api-extensions"} } - -// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource. -func (r *REST) ShortNames() []string { - return []string{"vwc"} -} diff --git a/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage_test.go b/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage_test.go index 53ed68fbffc..cc16752bf3f 100644 --- a/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage_test.go +++ b/pkg/registry/admissionregistration/validatingwebhookconfiguration/storage/storage_test.go @@ -199,11 +199,3 @@ func TestCategories(t *testing.T) { expected := []string{"api-extensions"} registrytest.AssertCategories(t, storage, expected) } - -func TestShortNames(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - expected := []string{"vwc"} - registrytest.AssertShortNames(t, storage, expected) -} From 815578295aee3417eb231701cc1e7e6294577021 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Sat, 13 May 2023 11:11:04 -0400 Subject: [PATCH 2/2] Revert "support short name for flowschema and prioritylevelconfiguration" This reverts commit 3dd0c4166399ea7374076cf02ff36fe2b75bd265. --- pkg/registry/flowcontrol/flowschema/storage/storage.go | 8 -------- .../prioritylevelconfiguration/storage/storage.go | 8 -------- 2 files changed, 16 deletions(-) diff --git a/pkg/registry/flowcontrol/flowschema/storage/storage.go b/pkg/registry/flowcontrol/flowschema/storage/storage.go index de29f55499d..5a1146201a6 100644 --- a/pkg/registry/flowcontrol/flowschema/storage/storage.go +++ b/pkg/registry/flowcontrol/flowschema/storage/storage.go @@ -72,14 +72,6 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, error) { return &REST{store}, &StatusREST{store: &statusStore}, nil } -// 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{"fs"} -} - // StatusREST implements the REST endpoint for changing the status of a flow schema. type StatusREST struct { store *genericregistry.Store diff --git a/pkg/registry/flowcontrol/prioritylevelconfiguration/storage/storage.go b/pkg/registry/flowcontrol/prioritylevelconfiguration/storage/storage.go index b5f90bbf514..2149b5906f4 100644 --- a/pkg/registry/flowcontrol/prioritylevelconfiguration/storage/storage.go +++ b/pkg/registry/flowcontrol/prioritylevelconfiguration/storage/storage.go @@ -72,14 +72,6 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, error) { return &REST{store}, &StatusREST{store: &statusStore}, nil } -// 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{"plc"} -} - // StatusREST implements the REST endpoint for changing the status of a priority level configuration. type StatusREST struct { store *genericregistry.Store