From e5659510632f4fb9c84e38a1ea767afc24759d95 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 5 Mar 2021 19:44:23 +0100 Subject: [PATCH] CSIStorageCapacity: register types unconditionally That the object was registered depending on the feature gate was called out as unusual during the 1.21 review. Previously, all beta storage APIs were unders such feature gate checks, but its better to drop that to be consistent with the rest of Kubernetes. --- pkg/registry/storage/rest/storage_storage.go | 26 ++++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/pkg/registry/storage/rest/storage_storage.go b/pkg/registry/storage/rest/storage_storage.go index 199967f0d5c..bafb1ce2c36 100644 --- a/pkg/registry/storage/rest/storage_storage.go +++ b/pkg/registry/storage/rest/storage_storage.go @@ -24,10 +24,8 @@ import ( "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" serverstorage "k8s.io/apiserver/pkg/server/storage" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/kubernetes/pkg/api/legacyscheme" storageapi "k8s.io/kubernetes/pkg/apis/storage" - "k8s.io/kubernetes/pkg/features" csidriverstore "k8s.io/kubernetes/pkg/registry/storage/csidriver/storage" csinodestore "k8s.io/kubernetes/pkg/registry/storage/csinode/storage" csistoragecapacitystore "k8s.io/kubernetes/pkg/registry/storage/csistoragecapacity/storage" @@ -77,14 +75,12 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstora } storage["volumeattachments"] = volumeAttachmentStorage.VolumeAttachment - // register csistoragecapacity if CSIStorageCapacity feature gate is enabled - if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) { - csiStorageStorage, err := csistoragecapacitystore.NewStorage(restOptionsGetter) - if err != nil { - return storage, err - } - storage["csistoragecapacities"] = csiStorageStorage.CSIStorageCapacity + // register csistoragecapacities + csiStorageStorage, err := csistoragecapacitystore.NewStorage(restOptionsGetter) + if err != nil { + return storage, err } + storage["csistoragecapacities"] = csiStorageStorage.CSIStorageCapacity return storage, nil } @@ -119,14 +115,12 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorag } storage["csidrivers"] = csiDriverStorage.CSIDriver - // register csistoragecapacity if CSIStorageCapacity feature gate is enabled - if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) { - csiStorageStorage, err := csistoragecapacitystore.NewStorage(restOptionsGetter) - if err != nil { - return storage, err - } - storage["csistoragecapacities"] = csiStorageStorage.CSIStorageCapacity + // register csistoragecapacities + csiStorageStorage, err := csistoragecapacitystore.NewStorage(restOptionsGetter) + if err != nil { + return storage, err } + storage["csistoragecapacities"] = csiStorageStorage.CSIStorageCapacity return storage, nil }