From 5bf4f58ab884d575b9c7c7b67098b9a6c40d56e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Fri, 20 Oct 2023 15:35:58 +0200 Subject: [PATCH] Remove storageConfig.Paging parameter Kubernetes-commit: b386120da239bf9652fc02b2d2cbbd0fcc3cd121 --- pkg/server/options/etcd.go | 2 -- pkg/server/storage/storage_factory.go | 1 - pkg/server/storage/storage_factory_test.go | 12 ++++++------ pkg/storage/etcd3/testing/test_server.go | 1 - pkg/storage/storagebackend/config.go | 6 ------ pkg/storage/storagebackend/factory/etcd3.go | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/pkg/server/options/etcd.go b/pkg/server/options/etcd.go index 14a96f0ca..a1fc3168c 100644 --- a/pkg/server/options/etcd.go +++ b/pkg/server/options/etcd.go @@ -45,8 +45,6 @@ import ( ) type EtcdOptions struct { - // The value of Paging on StorageConfig will be overridden by the - // calculated feature gate value. StorageConfig storagebackend.Config EncryptionProviderConfigFilepath string EncryptionProviderConfigAutomaticReload bool diff --git a/pkg/server/storage/storage_factory.go b/pkg/server/storage/storage_factory.go index 748435555..0dc50cea6 100644 --- a/pkg/server/storage/storage_factory.go +++ b/pkg/server/storage/storage_factory.go @@ -149,7 +149,6 @@ func NewDefaultStorageFactory( resourceConfig APIResourceConfigSource, specialDefaultResourcePrefixes map[schema.GroupResource]string, ) *DefaultStorageFactory { - config.Paging = true if len(defaultMediaType) == 0 { defaultMediaType = runtime.ContentTypeJSON } diff --git a/pkg/server/storage/storage_factory_test.go b/pkg/server/storage/storage_factory_test.go index 2e15ba171..c52049ca0 100644 --- a/pkg/server/storage/storage_factory_test.go +++ b/pkg/server/storage/storage_factory_test.go @@ -197,30 +197,30 @@ func TestConfigs(t *testing.T) { }{ { wantConfigs: []storagebackend.Config{ - {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry", Paging: true}, + {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry"}, }, }, { resource: &schema.GroupResource{Group: example.GroupName, Resource: "resource"}, servers: []string{}, wantConfigs: []storagebackend.Config{ - {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry", Paging: true}, + {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry"}, }, }, { resource: &schema.GroupResource{Group: example.GroupName, Resource: "resource"}, servers: []string{"http://127.0.0.1:10000"}, wantConfigs: []storagebackend.Config{ - {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry", Paging: true}, - {Transport: storagebackend.TransportConfig{ServerList: []string{"http://127.0.0.1:10000"}}, Prefix: "/registry", Paging: true}, + {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry"}, + {Transport: storagebackend.TransportConfig{ServerList: []string{"http://127.0.0.1:10000"}}, Prefix: "/registry"}, }, }, { resource: &schema.GroupResource{Group: example.GroupName, Resource: "resource"}, servers: []string{"http://127.0.0.1:10000", "https://127.0.0.1", "http://127.0.0.2"}, wantConfigs: []storagebackend.Config{ - {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry", Paging: true}, - {Transport: storagebackend.TransportConfig{ServerList: []string{"http://127.0.0.1:10000", "https://127.0.0.1", "http://127.0.0.2"}}, Prefix: "/registry", Paging: true}, + {Transport: storagebackend.TransportConfig{ServerList: defaultEtcdLocations}, Prefix: "/registry"}, + {Transport: storagebackend.TransportConfig{ServerList: []string{"http://127.0.0.1:10000", "https://127.0.0.1", "http://127.0.0.2"}}, Prefix: "/registry"}, }, }, } diff --git a/pkg/storage/etcd3/testing/test_server.go b/pkg/storage/etcd3/testing/test_server.go index f696192b6..235cb78ca 100644 --- a/pkg/storage/etcd3/testing/test_server.go +++ b/pkg/storage/etcd3/testing/test_server.go @@ -44,7 +44,6 @@ func NewUnsecuredEtcd3TestClientServer(t *testing.T) (*EtcdTestServer, *storageb Transport: storagebackend.TransportConfig{ ServerList: server.V3Client.Endpoints(), }, - Paging: true, } return server, config } diff --git a/pkg/storage/storagebackend/config.go b/pkg/storage/storagebackend/config.go index 47534c978..93b1e707f 100644 --- a/pkg/storage/storagebackend/config.go +++ b/pkg/storage/storagebackend/config.go @@ -62,11 +62,6 @@ type Config struct { Prefix string // Transport holds all connection related info, i.e. equal TransportConfig means equal servers we talk to. Transport TransportConfig - // Paging indicates whether the server implementation should allow paging (if it is - // supported). This is generally configured by feature gating, or by a specific - // resource type not wishing to allow paging, and is not intended for end users to - // set. - Paging bool Codec runtime.Codec // EncodeVersioner is the same groupVersioner used to build the @@ -115,7 +110,6 @@ func (config *Config) ForResource(resource schema.GroupResource) *ConfigForResou func NewDefaultConfig(prefix string, codec runtime.Codec) *Config { return &Config{ - Paging: true, Prefix: prefix, Codec: codec, CompactionInterval: DefaultCompactInterval, diff --git a/pkg/storage/storagebackend/factory/etcd3.go b/pkg/storage/storagebackend/factory/etcd3.go index f52bba84c..ed9640bb9 100644 --- a/pkg/storage/storagebackend/factory/etcd3.go +++ b/pkg/storage/storagebackend/factory/etcd3.go @@ -454,7 +454,7 @@ func newETCD3Storage(c storagebackend.ConfigForResource, newFunc, newListFunc fu if transformer == nil { transformer = identity.NewEncryptCheckTransformer() } - return etcd3.New(client, c.Codec, newFunc, newListFunc, c.Prefix, resourcePrefix, c.GroupResource, transformer, c.Paging, c.LeaseManagerConfig), destroyFunc, nil + return etcd3.New(client, c.Codec, newFunc, newListFunc, c.Prefix, resourcePrefix, c.GroupResource, transformer, true, c.LeaseManagerConfig), destroyFunc, nil } // startDBSizeMonitorPerEndpoint starts a loop to monitor etcd database size and update the