diff --git a/pkg/server/server.go b/pkg/server/server.go index 1720ab3e..14e41f6a 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -23,8 +23,8 @@ import ( "github.com/rancher/steve/pkg/server/handler" "github.com/rancher/steve/pkg/server/router" metricsStore "github.com/rancher/steve/pkg/stores/metrics" - "github.com/rancher/steve/pkg/stores/partition_alpha" - "github.com/rancher/steve/pkg/stores/proxy_alpha" + "github.com/rancher/steve/pkg/stores/partitionalpha" + "github.com/rancher/steve/pkg/stores/proxyalpha" "github.com/rancher/steve/pkg/summarycache" "k8s.io/client-go/rest" ) @@ -250,15 +250,15 @@ func setupAlpha(ctx context.Context, server *Server) error { return err } - s, err := proxy_alpha.NewProxyStore(cols, cf, summaryCache, nil) + s, err := proxyalpha.NewProxyStore(cols, cf, summaryCache, nil) if err != nil { panic(err) } - errStore := proxy_alpha.NewErrorStore( - proxy_alpha.NewUnformatterStore( - proxy_alpha.NewWatchRefresh( - partition_alpha.NewStore( + errStore := proxyalpha.NewErrorStore( + proxyalpha.NewUnformatterStore( + proxyalpha.NewWatchRefresh( + partitionalpha.NewStore( s, asl, ), diff --git a/pkg/stores/partition_alpha/listprocessor_alpha/processor.go b/pkg/stores/partitionalpha/listprocessor/processor.go similarity index 98% rename from pkg/stores/partition_alpha/listprocessor_alpha/processor.go rename to pkg/stores/partitionalpha/listprocessor/processor.go index 04ab5d65..16b8cd0e 100644 --- a/pkg/stores/partition_alpha/listprocessor_alpha/processor.go +++ b/pkg/stores/partitionalpha/listprocessor/processor.go @@ -1,5 +1,5 @@ -// Package listprocessor_alpha contains methods for filtering, sorting, and paginating lists of objects. -package listprocessor_alpha +// Package listprocessor contains methods for filtering, sorting, and paginating lists of objects. +package listprocessor import ( "context" diff --git a/pkg/stores/partition_alpha/listprocessor_alpha/processor_test.go b/pkg/stores/partitionalpha/listprocessor/processor_test.go similarity index 99% rename from pkg/stores/partition_alpha/listprocessor_alpha/processor_test.go rename to pkg/stores/partitionalpha/listprocessor/processor_test.go index dddd861a..d63a0e47 100644 --- a/pkg/stores/partition_alpha/listprocessor_alpha/processor_test.go +++ b/pkg/stores/partitionalpha/listprocessor/processor_test.go @@ -1,4 +1,4 @@ -package listprocessor_alpha +package listprocessor import ( "context" @@ -15,7 +15,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) -//go:generate mockgen --build_flags=--mod=mod -package listprocessor_alpha -destination ./proxy_mocks_test.go github.com/rancher/steve/pkg/stores/proxy_alpha Cache +//go:generate mockgen --build_flags=--mod=mod -package listprocessor -destination ./proxy_mocks_test.go github.com/rancher/steve/pkg/stores/proxyalpha Cache func TestParseQuery(t *testing.T) { type testCase struct { diff --git a/pkg/stores/partition_alpha/listprocessor_alpha/proxy_mocks_test.go b/pkg/stores/partitionalpha/listprocessor/proxy_mocks_test.go similarity index 90% rename from pkg/stores/partition_alpha/listprocessor_alpha/proxy_mocks_test.go rename to pkg/stores/partitionalpha/listprocessor/proxy_mocks_test.go index 68eb1eb7..eeb4e175 100644 --- a/pkg/stores/partition_alpha/listprocessor_alpha/proxy_mocks_test.go +++ b/pkg/stores/partitionalpha/listprocessor/proxy_mocks_test.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/rancher/steve/pkg/stores/proxy_alpha (interfaces: Cache) +// Source: github.com/rancher/steve/pkg/stores/proxyalpha (interfaces: Cache) -// Package listprocessor_alpha is a generated GoMock package. -package listprocessor_alpha +// Package listprocessor is a generated GoMock package. +package listprocessor import ( context "context" diff --git a/pkg/stores/partition_alpha/partition_mocks.go b/pkg/stores/partitionalpha/partition_mocks.go similarity index 96% rename from pkg/stores/partition_alpha/partition_mocks.go rename to pkg/stores/partitionalpha/partition_mocks.go index 029cdbef..c3eb3dd0 100644 --- a/pkg/stores/partition_alpha/partition_mocks.go +++ b/pkg/stores/partitionalpha/partition_mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/rancher/steve/pkg/stores/partition_alpha (interfaces: Partitioner,UnstructuredStore) +// Source: github.com/rancher/steve/pkg/stores/partitionalpha (interfaces: Partitioner,UnstructuredStore) // Package partition_alpha is a generated GoMock package. package partition_alpha @@ -10,6 +10,7 @@ import ( gomock "github.com/golang/mock/gomock" types "github.com/rancher/apiserver/pkg/types" partition "github.com/rancher/lasso/pkg/cache/sql/partition" + partitionalpha "github.com/rancher/steve/pkg/stores/partitionalpha" unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" watch "k8s.io/apimachinery/pkg/watch" ) @@ -68,10 +69,10 @@ func (mr *MockPartitionerMockRecorder) Lookup(arg0, arg1, arg2, arg3 interface{} } // Store mocks base method. -func (m *MockPartitioner) Store() UnstructuredStore { +func (m *MockPartitioner) Store() partitionalpha.UnstructuredStore { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Store") - ret0, _ := ret[0].(UnstructuredStore) + ret0, _ := ret[0].(partitionalpha.UnstructuredStore) return ret0 } diff --git a/pkg/stores/partition_alpha/partitioner.go b/pkg/stores/partitionalpha/partitioner.go similarity index 99% rename from pkg/stores/partition_alpha/partitioner.go rename to pkg/stores/partitionalpha/partitioner.go index 6941f082..cd0c6e36 100644 --- a/pkg/stores/partition_alpha/partitioner.go +++ b/pkg/stores/partitionalpha/partitioner.go @@ -1,4 +1,4 @@ -package partition_alpha +package partitionalpha import ( "fmt" diff --git a/pkg/stores/partition_alpha/partitioner_test.go b/pkg/stores/partitionalpha/partitioner_test.go similarity index 99% rename from pkg/stores/partition_alpha/partitioner_test.go rename to pkg/stores/partitionalpha/partitioner_test.go index c82aadd5..819a8253 100644 --- a/pkg/stores/partition_alpha/partitioner_test.go +++ b/pkg/stores/partitionalpha/partitioner_test.go @@ -1,9 +1,10 @@ -package partition_alpha +package partitionalpha import ( - "github.com/golang/mock/gomock" "testing" + "github.com/golang/mock/gomock" + "github.com/rancher/apiserver/pkg/types" "github.com/rancher/lasso/pkg/cache/sql/partition" "github.com/rancher/steve/pkg/accesscontrol" diff --git a/pkg/stores/partition_alpha/store.go b/pkg/stores/partitionalpha/store.go similarity index 99% rename from pkg/stores/partition_alpha/store.go rename to pkg/stores/partitionalpha/store.go index 5bfe48b7..ad39e54e 100644 --- a/pkg/stores/partition_alpha/store.go +++ b/pkg/stores/partitionalpha/store.go @@ -1,6 +1,6 @@ // Package partition_alpha implements a store with parallel partitioning of data // so that segmented data can be concurrently collected and returned as a single data set. -package partition_alpha +package partitionalpha import ( "context" diff --git a/pkg/stores/partition_alpha/store_test.go b/pkg/stores/partitionalpha/store_test.go similarity index 97% rename from pkg/stores/partition_alpha/store_test.go rename to pkg/stores/partitionalpha/store_test.go index 864cb704..442d0e48 100644 --- a/pkg/stores/partition_alpha/store_test.go +++ b/pkg/stores/partitionalpha/store_test.go @@ -1,22 +1,23 @@ -package partition_alpha +package partitionalpha import ( "context" "crypto/sha256" "encoding/base64" "fmt" - "github.com/golang/mock/gomock" - "github.com/rancher/wrangler/v2/pkg/schemas" - "github.com/stretchr/testify/assert" "net/http" "net/url" "strconv" "testing" + "github.com/golang/mock/gomock" + "github.com/rancher/wrangler/v2/pkg/schemas" + "github.com/stretchr/testify/assert" + "github.com/rancher/apiserver/pkg/types" "github.com/rancher/lasso/pkg/cache/sql/partition" "github.com/rancher/steve/pkg/accesscontrol" - "github.com/rancher/steve/pkg/stores/proxy_alpha" + "github.com/rancher/steve/pkg/stores/proxyalpha" "github.com/rancher/wrangler/v2/pkg/generic" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,7 +28,7 @@ import ( "k8s.io/apiserver/pkg/endpoints/request" ) -//go:generate mockgen --build_flags=--mod=mod -package partition_alpha -destination partition_mocks.go "github.com/rancher/steve/pkg/stores/partition_alpha" Partitioner,UnstructuredStore +//go:generate mockgen --build_flags=--mod=mod -package partition_alpha -destination partition_mocks.go "github.com/rancher/steve/pkg/stores/partitionalpha" Partitioner,UnstructuredStore func TestList(t *testing.T) { type testCase struct { @@ -136,7 +137,7 @@ func TestList(t *testing.T) { } type mockPartitioner struct { - store proxy_alpha.Store + store proxyalpha.Store partitions map[string][]partition.Partition } @@ -149,7 +150,7 @@ func (m mockPartitioner) All(apiOp *types.APIRequest, schema *types.APISchema, v return m.partitions[user.GetName()], nil } -func (m mockPartitioner) Store() proxy_alpha.Store { +func (m mockPartitioner) Store() proxyalpha.Store { return m.store } diff --git a/pkg/stores/proxy_alpha/dynamic_mocks_test.go b/pkg/stores/proxyalpha/dynamic_mocks_test.go similarity index 99% rename from pkg/stores/proxy_alpha/dynamic_mocks_test.go rename to pkg/stores/proxyalpha/dynamic_mocks_test.go index a149d72a..33bc9b4b 100644 --- a/pkg/stores/proxy_alpha/dynamic_mocks_test.go +++ b/pkg/stores/proxyalpha/dynamic_mocks_test.go @@ -2,7 +2,7 @@ // Source: k8s.io/client-go/dynamic (interfaces: ResourceInterface) // Package proxy_alpha is a generated GoMock package. -package proxy_alpha +package proxyalpha import ( context "context" diff --git a/pkg/stores/proxy_alpha/error_wrapper.go b/pkg/stores/proxyalpha/error_wrapper.go similarity index 99% rename from pkg/stores/proxy_alpha/error_wrapper.go rename to pkg/stores/proxyalpha/error_wrapper.go index 8acd24f9..d0025656 100644 --- a/pkg/stores/proxy_alpha/error_wrapper.go +++ b/pkg/stores/proxyalpha/error_wrapper.go @@ -1,4 +1,4 @@ -package proxy_alpha +package proxyalpha import ( "github.com/rancher/apiserver/pkg/apierror" diff --git a/pkg/stores/proxy_alpha/proxy_mocks_test.go b/pkg/stores/proxyalpha/proxy_mocks_test.go similarity index 99% rename from pkg/stores/proxy_alpha/proxy_mocks_test.go rename to pkg/stores/proxyalpha/proxy_mocks_test.go index 5cf3a578..fd6efd01 100644 --- a/pkg/stores/proxy_alpha/proxy_mocks_test.go +++ b/pkg/stores/proxyalpha/proxy_mocks_test.go @@ -2,7 +2,7 @@ // Source: github.com/rancher/steve/pkg/stores/proxy_alpha (interfaces: Cache,ClientGetter,CacheFactory,SchemaColumnSetter,RelationshipNotifier) // Package proxy_alpha is a generated GoMock package. -package proxy_alpha +package proxyalpha import ( context "context" diff --git a/pkg/stores/proxy_alpha/proxy_store.go b/pkg/stores/proxyalpha/proxy_store.go similarity index 98% rename from pkg/stores/proxy_alpha/proxy_store.go rename to pkg/stores/proxyalpha/proxy_store.go index 9eb4339d..5a06ef6e 100644 --- a/pkg/stores/proxy_alpha/proxy_store.go +++ b/pkg/stores/proxyalpha/proxy_store.go @@ -1,5 +1,5 @@ // Package proxy implements the proxy store, which is responsible for interfacing directly with Kubernetes. -package proxy_alpha +package proxyalpha import ( "context" @@ -22,8 +22,8 @@ import ( "github.com/rancher/steve/pkg/attributes" "github.com/rancher/steve/pkg/resources/common" metricsStore "github.com/rancher/steve/pkg/stores/metrics" - "github.com/rancher/steve/pkg/stores/partition_alpha/listprocessor_alpha" - "github.com/rancher/steve/pkg/stores/proxy_alpha/tablelistconvert" + "github.com/rancher/steve/pkg/stores/partitionalpha/listprocessor" + "github.com/rancher/steve/pkg/stores/proxyalpha/tablelistconvert" "github.com/rancher/wrangler/v2/pkg/data" "github.com/rancher/wrangler/v2/pkg/schemas" "github.com/rancher/wrangler/v2/pkg/schemas/validation" @@ -600,7 +600,7 @@ func (s *Store) Delete(apiOp *types.APIRequest, schema *types.APISchema, id stri // ListByPartitions returns an unstructured list of resources belonging to any of the specified partitions func (s *Store) ListByPartitions(apiOp *types.APIRequest, schema *types.APISchema, partitions []partition.Partition) ([]unstructured.Unstructured, string, error) { - opts, err := listprocessor_alpha.ParseQuery(apiOp, s.namespaceCache) + opts, err := listprocessor.ParseQuery(apiOp, s.namespaceCache) if err != nil { return nil, "", err } diff --git a/pkg/stores/proxy_alpha/proxy_store_test.go b/pkg/stores/proxyalpha/proxy_store_test.go similarity index 98% rename from pkg/stores/proxy_alpha/proxy_store_test.go rename to pkg/stores/proxyalpha/proxy_store_test.go index 5b9e9a5a..dbbe9a7e 100644 --- a/pkg/stores/proxy_alpha/proxy_store_test.go +++ b/pkg/stores/proxyalpha/proxy_store_test.go @@ -1,21 +1,22 @@ -package proxy_alpha +package proxyalpha import ( "context" "fmt" + "net/http" + "net/url" + "testing" + "time" + "github.com/golang/mock/gomock" "github.com/rancher/lasso/pkg/cache/sql/informer" "github.com/rancher/lasso/pkg/cache/sql/informer/factory" "github.com/rancher/lasso/pkg/cache/sql/partition" "github.com/rancher/steve/pkg/attributes" "github.com/rancher/steve/pkg/resources/common" - "github.com/rancher/steve/pkg/stores/partition_alpha/listprocessor_alpha" - "github.com/rancher/steve/pkg/stores/proxy_alpha/tablelistconvert" + "github.com/rancher/steve/pkg/stores/partitionalpha/listprocessor" + "github.com/rancher/steve/pkg/stores/proxyalpha/tablelistconvert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "net/http" - "net/url" - "testing" - "time" "github.com/pkg/errors" "github.com/rancher/apiserver/pkg/types" @@ -224,7 +225,7 @@ func TestListByPartitions(t *testing.T) { // ListByPartitions copies point so we need some original record of items to ensure as asserting listToReturn's // items is equal to the list returned by ListByParititons doesn't ensure no mutation happened copy(listToReturn.Items, expectedItems) - opts, err := listprocessor_alpha.ParseQuery(req, nil) + opts, err := listprocessor.ParseQuery(req, nil) assert.Nil(t, err) cg.EXPECT().TableAdminClient(req, schema, "", &WarningBuffer{}).Return(ri, nil) // This tests that fields are being extracted from schema columns and the type specific fields map @@ -292,7 +293,7 @@ func TestListByPartitions(t *testing.T) { copy(listToReturn.Items, expectedItems) nsi.EXPECT().ListByOptions(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, "", fmt.Errorf("error")).Times(2) - _, err := listprocessor_alpha.ParseQuery(req, nsi) + _, err := listprocessor.ParseQuery(req, nsi) assert.NotNil(t, err) _, _, err = s.ListByPartitions(req, schema, partitions) @@ -354,7 +355,7 @@ func TestListByPartitions(t *testing.T) { // ListByPartitions copies point so we need some original record of items to ensure as asserting listToReturn's // items is equal to the list returned by ListByParititons doesn't ensure no mutation happened copy(listToReturn.Items, expectedItems) - _, err := listprocessor_alpha.ParseQuery(req, nil) + _, err := listprocessor.ParseQuery(req, nil) assert.Nil(t, err) cg.EXPECT().TableAdminClient(req, schema, "", &WarningBuffer{}).Return(nil, fmt.Errorf("error")) @@ -417,7 +418,7 @@ func TestListByPartitions(t *testing.T) { // ListByPartitions copies point so we need some original record of items to ensure as asserting listToReturn's // items is equal to the list returned by ListByParititons doesn't ensure no mutation happened copy(listToReturn.Items, expectedItems) - _, err := listprocessor_alpha.ParseQuery(req, nil) + _, err := listprocessor.ParseQuery(req, nil) assert.Nil(t, err) cg.EXPECT().TableAdminClient(req, schema, "", &WarningBuffer{}).Return(ri, nil) // This tests that fields are being extracted from schema columns and the type specific fields map @@ -489,7 +490,7 @@ func TestListByPartitions(t *testing.T) { // ListByPartitions copies point so we need some original record of items to ensure as asserting listToReturn's // items is equal to the list returned by ListByParititons doesn't ensure no mutation happened copy(listToReturn.Items, expectedItems) - opts, err := listprocessor_alpha.ParseQuery(req, nil) + opts, err := listprocessor.ParseQuery(req, nil) assert.Nil(t, err) cg.EXPECT().TableAdminClient(req, schema, "", &WarningBuffer{}).Return(ri, nil) // This tests that fields are being extracted from schema columns and the type specific fields map diff --git a/pkg/stores/proxy_alpha/sql_informer_mocks_test.go b/pkg/stores/proxyalpha/sql_informer_mocks_test.go similarity index 99% rename from pkg/stores/proxy_alpha/sql_informer_mocks_test.go rename to pkg/stores/proxyalpha/sql_informer_mocks_test.go index 35785589..e0d38e7c 100644 --- a/pkg/stores/proxy_alpha/sql_informer_mocks_test.go +++ b/pkg/stores/proxyalpha/sql_informer_mocks_test.go @@ -2,7 +2,7 @@ // Source: github.com/rancher/lasso/pkg/cache/sql/informer (interfaces: ByOptionsLister) // Package proxy_alpha is a generated GoMock package. -package proxy_alpha +package proxyalpha import ( context "context" diff --git a/pkg/stores/proxy_alpha/tablelistconvert/client.go b/pkg/stores/proxyalpha/tablelistconvert/client.go similarity index 100% rename from pkg/stores/proxy_alpha/tablelistconvert/client.go rename to pkg/stores/proxyalpha/tablelistconvert/client.go diff --git a/pkg/stores/proxy_alpha/tablelistconvert/client_test.go b/pkg/stores/proxyalpha/tablelistconvert/client_test.go similarity index 100% rename from pkg/stores/proxy_alpha/tablelistconvert/client_test.go rename to pkg/stores/proxyalpha/tablelistconvert/client_test.go diff --git a/pkg/stores/proxy_alpha/tablelistconvert/dynamic_mocks_test.go b/pkg/stores/proxyalpha/tablelistconvert/dynamic_mocks_test.go similarity index 100% rename from pkg/stores/proxy_alpha/tablelistconvert/dynamic_mocks_test.go rename to pkg/stores/proxyalpha/tablelistconvert/dynamic_mocks_test.go diff --git a/pkg/stores/proxy_alpha/tablelistconvert/watch_mocks_test.go b/pkg/stores/proxyalpha/tablelistconvert/watch_mocks_test.go similarity index 100% rename from pkg/stores/proxy_alpha/tablelistconvert/watch_mocks_test.go rename to pkg/stores/proxyalpha/tablelistconvert/watch_mocks_test.go diff --git a/pkg/stores/proxy_alpha/unformatter.go b/pkg/stores/proxyalpha/unformatter.go similarity index 99% rename from pkg/stores/proxy_alpha/unformatter.go rename to pkg/stores/proxyalpha/unformatter.go index ba437a36..0e0d95ed 100644 --- a/pkg/stores/proxy_alpha/unformatter.go +++ b/pkg/stores/proxyalpha/unformatter.go @@ -1,4 +1,4 @@ -package proxy_alpha +package proxyalpha import ( "github.com/rancher/apiserver/pkg/types" diff --git a/pkg/stores/proxy_alpha/unformatter_test.go b/pkg/stores/proxyalpha/unformatter_test.go similarity index 99% rename from pkg/stores/proxy_alpha/unformatter_test.go rename to pkg/stores/proxyalpha/unformatter_test.go index d27ae26c..facdb00c 100644 --- a/pkg/stores/proxy_alpha/unformatter_test.go +++ b/pkg/stores/proxyalpha/unformatter_test.go @@ -1,4 +1,4 @@ -package proxy_alpha +package proxyalpha import ( "testing" diff --git a/pkg/stores/proxy_alpha/watch_refresh.go b/pkg/stores/proxyalpha/watch_refresh.go similarity index 98% rename from pkg/stores/proxy_alpha/watch_refresh.go rename to pkg/stores/proxyalpha/watch_refresh.go index b8ef31cc..94a26740 100644 --- a/pkg/stores/proxy_alpha/watch_refresh.go +++ b/pkg/stores/proxyalpha/watch_refresh.go @@ -1,4 +1,4 @@ -package proxy_alpha +package proxyalpha import ( "context"