From da922f0af676cac310c661ee1efc5ecc6751c168 Mon Sep 17 00:00:00 2001 From: carlory Date: Fri, 28 Apr 2023 14:14:28 +0800 Subject: [PATCH] Remove ability to re-enable serving deprecated discoveryv1beta1 APIs --- pkg/controlplane/instance.go | 2 -- .../discovery/rest/storage_discovery.go | 21 ------------------- test/integration/etcd/data.go | 7 ------- 3 files changed, 30 deletions(-) diff --git a/pkg/controlplane/instance.go b/pkg/controlplane/instance.go index 12aa0540037..05a585fe995 100644 --- a/pkg/controlplane/instance.go +++ b/pkg/controlplane/instance.go @@ -41,7 +41,6 @@ import ( coordinationapiv1 "k8s.io/api/coordination/v1" apiv1 "k8s.io/api/core/v1" discoveryv1 "k8s.io/api/discovery/v1" - discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1 "k8s.io/api/events/v1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" networkingapiv1 "k8s.io/api/networking/v1" @@ -712,7 +711,6 @@ var ( // betaAPIGroupVersionsDisabledByDefault is for all future beta groupVersions. betaAPIGroupVersionsDisabledByDefault = []schema.GroupVersion{ authenticationv1beta1.SchemeGroupVersion, - discoveryv1beta1.SchemeGroupVersion, nodev1beta1.SchemeGroupVersion, // remove in 1.26 policyapiv1beta1.SchemeGroupVersion, storageapiv1beta1.SchemeGroupVersion, diff --git a/pkg/registry/discovery/rest/storage_discovery.go b/pkg/registry/discovery/rest/storage_discovery.go index 02f76a139a8..d2e39836cb0 100644 --- a/pkg/registry/discovery/rest/storage_discovery.go +++ b/pkg/registry/discovery/rest/storage_discovery.go @@ -18,7 +18,6 @@ package rest import ( discoveryv1 "k8s.io/api/discovery/v1" - discoveryv1beta1 "k8s.io/api/discovery/v1beta1" "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" @@ -37,12 +36,6 @@ func (p StorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.AP // If you add a version here, be sure to add an entry in `k8s.io/kubernetes/cmd/kube-apiserver/app/aggregator.go with specific priorities. // TODO refactor the plumbing to provide the information in the APIGroupInfo - if storageMap, err := p.v1beta1Storage(apiResourceConfigSource, restOptionsGetter); err != nil { - return genericapiserver.APIGroupInfo{}, err - } else if len(storageMap) > 0 { - apiGroupInfo.VersionedResourcesStorageMap[discoveryv1beta1.SchemeGroupVersion.Version] = storageMap - } - if storageMap, err := p.v1Storage(apiResourceConfigSource, restOptionsGetter); err != nil { return genericapiserver.APIGroupInfo{}, err } else if len(storageMap) > 0 { @@ -52,20 +45,6 @@ func (p StorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.AP return apiGroupInfo, nil } -func (p StorageProvider) v1beta1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) { - storage := map[string]rest.Storage{} - - if resource := "endpointslices"; apiResourceConfigSource.ResourceEnabled(discoveryv1beta1.SchemeGroupVersion.WithResource(resource)) { - endpointSliceStorage, err := endpointslicestorage.NewREST(restOptionsGetter) - if err != nil { - return storage, err - } - storage[resource] = endpointSliceStorage - } - - return storage, nil -} - func (p StorageProvider) v1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) { storage := map[string]rest.Storage{} diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index 46400989ee7..cf6962e9381 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -180,13 +180,6 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes }, // -- - // k8s.io/kubernetes/pkg/apis/discovery/v1beta1 - gvr("discovery.k8s.io", "v1beta1", "endpointslices"): { - Stub: `{"metadata": {"name": "slicev1beta1"}, "addressType": "IPv4", "protocol": "TCP", "ports": [], "endpoints": []}`, - ExpectedEtcdPath: "/registry/endpointslices/" + namespace + "/slicev1beta1", - }, - // -- - // k8s.io/kubernetes/pkg/apis/events/v1 gvr("events.k8s.io", "v1", "events"): { Stub: `{"metadata": {"name": "event3"}, "regarding": {"namespace": "` + namespace + `"}, "note": "some data here", "eventTime": "2017-08-09T15:04:05.000000Z", "reportingInstance": "node-xyz", "reportingController": "k8s.io/my-controller", "action": "DidNothing", "reason": "Laziness", "type": "Normal"}`,