diff --git a/build/generate.mk b/build/generate.mk index 13c4fc0a53..0685a0ed59 100644 --- a/build/generate.mk +++ b/build/generate.mk @@ -62,8 +62,8 @@ generate-controller-gen-installed: .PHONY: generate-ucp-crd generate-ucp-crd: generate-controller-gen-installed ## Generates the CRDs for UCP APIServer store. @echo "$(ARROW) Generating CRDs for ucp.dev..." - controller-gen object:headerFile=./boilerplate.go.txt paths=./pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/... - controller-gen crd paths=./pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/... output:crd:dir=./deploy/Chart/crds/ucpd + controller-gen object:headerFile=./boilerplate.go.txt paths=./pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/... + controller-gen crd paths=./pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/... output:crd:dir=./deploy/Chart/crds/ucpd .PHONY: generate-controller generate-controller: generate-controller-gen-installed ## Generates the CRDs for the Radius controller. diff --git a/cmd/applications-rp/cmd/root.go b/cmd/applications-rp/cmd/root.go index 75241ea968..8656dae6bc 100644 --- a/cmd/applications-rp/cmd/root.go +++ b/cmd/applications-rp/cmd/root.go @@ -33,8 +33,8 @@ import ( "github.com/radius-project/radius/pkg/server" "github.com/radius-project/radius/pkg/trace" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" "github.com/radius-project/radius/pkg/ucp/data" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/hosting" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/cmd/ucpd/cmd/root.go b/cmd/ucpd/cmd/root.go index c11ec85178..4c012bd07e 100644 --- a/cmd/ucpd/cmd/root.go +++ b/cmd/ucpd/cmd/root.go @@ -26,7 +26,7 @@ import ( runtimelog "sigs.k8s.io/controller-runtime/pkg/log" "github.com/radius-project/radius/pkg/armrpc/hostoptions" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" "github.com/radius-project/radius/pkg/ucp/hosting" "github.com/radius-project/radius/pkg/ucp/server" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/armrpc/asyncoperation/controller/controller.go b/pkg/armrpc/asyncoperation/controller/controller.go index a0a89b0720..0c76737b42 100644 --- a/pkg/armrpc/asyncoperation/controller/controller.go +++ b/pkg/armrpc/asyncoperation/controller/controller.go @@ -20,8 +20,8 @@ import ( "context" "errors" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/backend/deployment" - "github.com/radius-project/radius/pkg/ucp/database" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/armrpc/asyncoperation/statusmanager/statusmanager.go b/pkg/armrpc/asyncoperation/statusmanager/statusmanager.go index bc9b2acc1a..091b80e1a2 100644 --- a/pkg/armrpc/asyncoperation/statusmanager/statusmanager.go +++ b/pkg/armrpc/asyncoperation/statusmanager/statusmanager.go @@ -25,10 +25,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/queue" "github.com/radius-project/radius/pkg/metrics" "github.com/radius-project/radius/pkg/trace" - "github.com/radius-project/radius/pkg/ucp/database" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/google/uuid" diff --git a/pkg/armrpc/asyncoperation/statusmanager/statusmanager_test.go b/pkg/armrpc/asyncoperation/statusmanager/statusmanager_test.go index c1de8a5bd6..6cce71bc6d 100644 --- a/pkg/armrpc/asyncoperation/statusmanager/statusmanager_test.go +++ b/pkg/armrpc/asyncoperation/statusmanager/statusmanager_test.go @@ -26,8 +26,8 @@ import ( "github.com/google/uuid" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/queue" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/asyncoperation/worker/registry_test.go b/pkg/armrpc/asyncoperation/worker/registry_test.go index 3df0c2ac5e..dc765925d3 100644 --- a/pkg/armrpc/asyncoperation/worker/registry_test.go +++ b/pkg/armrpc/asyncoperation/worker/registry_test.go @@ -22,8 +22,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database/inmemory" "github.com/radius-project/radius/pkg/corerp/backend/deployment" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/armrpc/asyncoperation/worker/service.go b/pkg/armrpc/asyncoperation/worker/service.go index 7a2440266c..305a362060 100644 --- a/pkg/armrpc/asyncoperation/worker/service.go +++ b/pkg/armrpc/asyncoperation/worker/service.go @@ -21,9 +21,9 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/hostoptions" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/armrpc/asyncoperation/worker/worker.go b/pkg/armrpc/asyncoperation/worker/worker.go index d10d862a8a..587068a3bc 100644 --- a/pkg/armrpc/asyncoperation/worker/worker.go +++ b/pkg/armrpc/asyncoperation/worker/worker.go @@ -28,11 +28,11 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/queue" "github.com/radius-project/radius/pkg/logging" "github.com/radius-project/radius/pkg/metrics" "github.com/radius-project/radius/pkg/trace" - "github.com/radius-project/radius/pkg/ucp/database" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/armrpc/asyncoperation/worker/worker_runoperation_test.go b/pkg/armrpc/asyncoperation/worker/worker_runoperation_test.go index 9359186c6d..8cce24600b 100644 --- a/pkg/armrpc/asyncoperation/worker/worker_runoperation_test.go +++ b/pkg/armrpc/asyncoperation/worker/worker_runoperation_test.go @@ -28,11 +28,11 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" + "github.com/radius-project/radius/pkg/components/database" + inmemorystore "github.com/radius-project/radius/pkg/components/database/inmemory" + "github.com/radius-project/radius/pkg/components/queue" + "github.com/radius-project/radius/pkg/components/queue/inmemory" "github.com/radius-project/radius/pkg/corerp/backend/deployment" - "github.com/radius-project/radius/pkg/ucp/database" - inmemorystore "github.com/radius-project/radius/pkg/ucp/database/inmemory" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" - "github.com/radius-project/radius/pkg/ucp/queue/inmemory" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/stretchr/testify/require" "go.uber.org/atomic" diff --git a/pkg/armrpc/asyncoperation/worker/worker_test.go b/pkg/armrpc/asyncoperation/worker/worker_test.go index 390e0b7598..1f5a792137 100644 --- a/pkg/armrpc/asyncoperation/worker/worker_test.go +++ b/pkg/armrpc/asyncoperation/worker/worker_test.go @@ -23,7 +23,7 @@ import ( "time" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/armrpc/builder/builder_test.go b/pkg/armrpc/builder/builder_test.go index b25ad4b72b..ac076810c7 100644 --- a/pkg/armrpc/builder/builder_test.go +++ b/pkg/armrpc/builder/builder_test.go @@ -28,7 +28,7 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/worker" apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" + "github.com/radius-project/radius/pkg/components/database/inmemory" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/builder/namespace_test.go b/pkg/armrpc/builder/namespace_test.go index 60e9890416..bdcc368151 100644 --- a/pkg/armrpc/builder/namespace_test.go +++ b/pkg/armrpc/builder/namespace_test.go @@ -26,7 +26,7 @@ import ( apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" ) diff --git a/pkg/armrpc/frontend/controller/controller.go b/pkg/armrpc/frontend/controller/controller.go index 8acd02118a..d06764be65 100644 --- a/pkg/armrpc/frontend/controller/controller.go +++ b/pkg/armrpc/frontend/controller/controller.go @@ -26,7 +26,7 @@ import ( sm "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/hostoptions" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/armrpc/frontend/controller/controller_test.go b/pkg/armrpc/frontend/controller/controller_test.go index 5e28bd77c8..3952d3da6a 100644 --- a/pkg/armrpc/frontend/controller/controller_test.go +++ b/pkg/armrpc/frontend/controller/controller_test.go @@ -21,7 +21,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" ) diff --git a/pkg/armrpc/frontend/controller/operation.go b/pkg/armrpc/frontend/controller/operation.go index d8ecbf11bb..2877b507ae 100644 --- a/pkg/armrpc/frontend/controller/operation.go +++ b/pkg/armrpc/frontend/controller/operation.go @@ -26,7 +26,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" sm "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/armrpc/frontend/defaultoperation/defaultasyncdelete_test.go b/pkg/armrpc/frontend/defaultoperation/defaultasyncdelete_test.go index e28a7b6f66..64db0a26b3 100644 --- a/pkg/armrpc/frontend/defaultoperation/defaultasyncdelete_test.go +++ b/pkg/armrpc/frontend/defaultoperation/defaultasyncdelete_test.go @@ -29,7 +29,7 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/frontend/defaultoperation/defaultasyncput_test.go b/pkg/armrpc/frontend/defaultoperation/defaultasyncput_test.go index a66a120c6f..3c76945cca 100644 --- a/pkg/armrpc/frontend/defaultoperation/defaultasyncput_test.go +++ b/pkg/armrpc/frontend/defaultoperation/defaultasyncput_test.go @@ -29,7 +29,7 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" diff --git a/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete.go b/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete.go index 62ff4e67dd..3b070afbe3 100644 --- a/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete.go +++ b/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete.go @@ -24,7 +24,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" ) // DefaultSyncDelete is the controller implementation to delete resource synchronously. diff --git a/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete_test.go b/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete_test.go index 361d1bef18..27ec3b887c 100644 --- a/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete_test.go +++ b/pkg/armrpc/frontend/defaultoperation/defaultsyncdelete_test.go @@ -26,7 +26,7 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/frontend/defaultoperation/defaultsyncput_test.go b/pkg/armrpc/frontend/defaultoperation/defaultsyncput_test.go index a5dd737b26..570564ef35 100644 --- a/pkg/armrpc/frontend/defaultoperation/defaultsyncput_test.go +++ b/pkg/armrpc/frontend/defaultoperation/defaultsyncput_test.go @@ -27,7 +27,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" diff --git a/pkg/armrpc/frontend/defaultoperation/getoperationresult.go b/pkg/armrpc/frontend/defaultoperation/getoperationresult.go index a9b452892f..fe78aa33a5 100644 --- a/pkg/armrpc/frontend/defaultoperation/getoperationresult.go +++ b/pkg/armrpc/frontend/defaultoperation/getoperationresult.go @@ -27,7 +27,7 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/armrpc/frontend/defaultoperation/getoperationresult_test.go b/pkg/armrpc/frontend/defaultoperation/getoperationresult_test.go index b6fee80ac4..933a88c0a4 100644 --- a/pkg/armrpc/frontend/defaultoperation/getoperationresult_test.go +++ b/pkg/armrpc/frontend/defaultoperation/getoperationresult_test.go @@ -28,7 +28,7 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/test/testcontext" "github.com/radius-project/radius/test/testutil" diff --git a/pkg/armrpc/frontend/defaultoperation/getoperationstatus.go b/pkg/armrpc/frontend/defaultoperation/getoperationstatus.go index 558822c8aa..e8635bb01a 100644 --- a/pkg/armrpc/frontend/defaultoperation/getoperationstatus.go +++ b/pkg/armrpc/frontend/defaultoperation/getoperationstatus.go @@ -25,7 +25,7 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" ) var _ ctrl.Controller = (*GetOperationStatus)(nil) diff --git a/pkg/armrpc/frontend/defaultoperation/getoperationstatus_test.go b/pkg/armrpc/frontend/defaultoperation/getoperationstatus_test.go index 1ab1f52225..7367d9acaa 100644 --- a/pkg/armrpc/frontend/defaultoperation/getoperationstatus_test.go +++ b/pkg/armrpc/frontend/defaultoperation/getoperationstatus_test.go @@ -27,7 +27,7 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" diff --git a/pkg/armrpc/frontend/defaultoperation/getresource_test.go b/pkg/armrpc/frontend/defaultoperation/getresource_test.go index 3c48a8f977..2ce5fa6a98 100644 --- a/pkg/armrpc/frontend/defaultoperation/getresource_test.go +++ b/pkg/armrpc/frontend/defaultoperation/getresource_test.go @@ -26,7 +26,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/frontend/defaultoperation/listresources.go b/pkg/armrpc/frontend/defaultoperation/listresources.go index 4aee3fe37d..f59fecfa94 100644 --- a/pkg/armrpc/frontend/defaultoperation/listresources.go +++ b/pkg/armrpc/frontend/defaultoperation/listresources.go @@ -23,7 +23,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" ) // ListResources is the controller implementation to get the list of resources in resource group. diff --git a/pkg/armrpc/frontend/defaultoperation/listresources_test.go b/pkg/armrpc/frontend/defaultoperation/listresources_test.go index c000973cb9..d00b29bc53 100644 --- a/pkg/armrpc/frontend/defaultoperation/listresources_test.go +++ b/pkg/armrpc/frontend/defaultoperation/listresources_test.go @@ -27,7 +27,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/google/uuid" "github.com/stretchr/testify/require" diff --git a/pkg/armrpc/frontend/defaultoperation/resource_test.go b/pkg/armrpc/frontend/defaultoperation/resource_test.go index ad17c88548..64e9e6e1aa 100644 --- a/pkg/armrpc/frontend/defaultoperation/resource_test.go +++ b/pkg/armrpc/frontend/defaultoperation/resource_test.go @@ -28,8 +28,8 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/test/testutil" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/frontend/server/handler_test.go b/pkg/armrpc/frontend/server/handler_test.go index bd323a06a9..7c3791e7fd 100644 --- a/pkg/armrpc/frontend/server/handler_test.go +++ b/pkg/armrpc/frontend/server/handler_test.go @@ -32,8 +32,8 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/inmemory" "github.com/radius-project/radius/pkg/middleware" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/armrpc/frontend/server/service.go b/pkg/armrpc/frontend/server/service.go index 265ec4e17d..5854fcf506 100644 --- a/pkg/armrpc/frontend/server/service.go +++ b/pkg/armrpc/frontend/server/service.go @@ -24,9 +24,9 @@ import ( manager "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/authentication" "github.com/radius-project/radius/pkg/armrpc/hostoptions" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" "github.com/radius-project/radius/pkg/kubeutil" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" controller_runtime "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/armrpc/hostoptions/hostoptions.go b/pkg/armrpc/hostoptions/hostoptions.go index 37750cf659..8f5eb4c310 100644 --- a/pkg/armrpc/hostoptions/hostoptions.go +++ b/pkg/armrpc/hostoptions/hostoptions.go @@ -28,11 +28,11 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/azure/armauth" aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" + sprovider "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/kubeutil" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/ucp/config" sdk_cred "github.com/radius-project/radius/pkg/ucp/credentials" - sprovider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "gopkg.in/yaml.v3" corev1 "k8s.io/api/core/v1" diff --git a/pkg/armrpc/hostoptions/providerconfig.go b/pkg/armrpc/hostoptions/providerconfig.go index f2acbf3d28..59fd7a7589 100644 --- a/pkg/armrpc/hostoptions/providerconfig.go +++ b/pkg/armrpc/hostoptions/providerconfig.go @@ -17,13 +17,13 @@ limitations under the License. package hostoptions import ( + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" metricsprovider "github.com/radius-project/radius/pkg/metrics/provider" profilerprovider "github.com/radius-project/radius/pkg/profiler/provider" "github.com/radius-project/radius/pkg/trace" "github.com/radius-project/radius/pkg/ucp/config" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/armrpc/rpctest/controllers.go b/pkg/armrpc/rpctest/controllers.go index 819da12b6f..08b53e83ba 100644 --- a/pkg/armrpc/rpctest/controllers.go +++ b/pkg/armrpc/rpctest/controllers.go @@ -22,7 +22,7 @@ import ( "testing" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "go.uber.org/mock/gomock" ) diff --git a/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/groupversion_info.go b/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/groupversion_info.go similarity index 100% rename from pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/groupversion_info.go rename to pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/groupversion_info.go diff --git a/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/queuemessage_types.go b/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/queuemessage_types.go similarity index 100% rename from pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/queuemessage_types.go rename to pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/queuemessage_types.go diff --git a/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/resource_types.go b/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/resource_types.go similarity index 100% rename from pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/resource_types.go rename to pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/resource_types.go diff --git a/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/zz_generated.deepcopy.go b/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1/zz_generated.deepcopy.go rename to pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1/zz_generated.deepcopy.go diff --git a/pkg/ucp/database/apiserverstore/apiserverclient.go b/pkg/components/database/apiserverstore/apiserverclient.go similarity index 98% rename from pkg/ucp/database/apiserverstore/apiserverclient.go rename to pkg/components/database/apiserverstore/apiserverclient.go index 6976bcfb71..271f848078 100644 --- a/pkg/ucp/database/apiserverstore/apiserverclient.go +++ b/pkg/components/database/apiserverstore/apiserverclient.go @@ -48,9 +48,9 @@ import ( "strings" "unicode" - "github.com/radius-project/radius/pkg/ucp/database" - ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" - "github.com/radius-project/radius/pkg/ucp/database/databaseutil" + "github.com/radius-project/radius/pkg/components/database" + ucpv1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/database/databaseutil" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" "github.com/radius-project/radius/pkg/ucp/util/etag" diff --git a/pkg/ucp/database/apiserverstore/apiserverclient_test.go b/pkg/components/database/apiserverstore/apiserverclient_test.go similarity index 99% rename from pkg/ucp/database/apiserverstore/apiserverclient_test.go rename to pkg/components/database/apiserverstore/apiserverclient_test.go index cdc28fbda1..4a964e6281 100644 --- a/pkg/ucp/database/apiserverstore/apiserverclient_test.go +++ b/pkg/components/database/apiserverstore/apiserverclient_test.go @@ -28,8 +28,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/radius-project/radius/pkg/ucp/database" - ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/database" + ucpv1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" "github.com/radius-project/radius/test/testcontext" diff --git a/pkg/ucp/database/client.go b/pkg/components/database/client.go similarity index 98% rename from pkg/ucp/database/client.go rename to pkg/components/database/client.go index 32c1a7b76b..c17d419a32 100644 --- a/pkg/ucp/database/client.go +++ b/pkg/components/database/client.go @@ -31,7 +31,7 @@ var jsonPropertyPattern = "[a-zA-Z$_][a-zA-Z0-9$_]*" // - Multople properties separated by a '.' var fieldRegex = regexp.MustCompile(fmt.Sprintf(`^(%s)(\.%s)*$`, jsonPropertyPattern, jsonPropertyPattern)) -//go:generate mockgen -typed -destination=./mock_client.go -package=database -self_package github.com/radius-project/radius/pkg/ucp/database github.com/radius-project/radius/pkg/ucp/database Client +//go:generate mockgen -typed -destination=./mock_client.go -package=database -self_package github.com/radius-project/radius/pkg/components/database github.com/radius-project/radius/pkg/components/database Client // Client is the interface for persisting and querying resource data. // diff --git a/pkg/ucp/database/client_test.go b/pkg/components/database/client_test.go similarity index 100% rename from pkg/ucp/database/client_test.go rename to pkg/components/database/client_test.go diff --git a/pkg/ucp/databaseprovider/factory.go b/pkg/components/database/databaseprovider/factory.go similarity index 89% rename from pkg/ucp/databaseprovider/factory.go rename to pkg/components/database/databaseprovider/factory.go index 4f02132430..50c9bae764 100644 --- a/pkg/ucp/databaseprovider/factory.go +++ b/pkg/components/database/databaseprovider/factory.go @@ -23,13 +23,13 @@ import ( "regexp" "github.com/jackc/pgx/v5/pgxpool" + store "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/database/apiserverstore" + ucpv1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/database/etcdstore" + "github.com/radius-project/radius/pkg/components/database/inmemory" + "github.com/radius-project/radius/pkg/components/database/postgres" "github.com/radius-project/radius/pkg/kubeutil" - store "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/database/apiserverstore" - ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" - "github.com/radius-project/radius/pkg/ucp/database/etcdstore" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" - "github.com/radius-project/radius/pkg/ucp/database/postgres" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" diff --git a/pkg/ucp/databaseprovider/options.go b/pkg/components/database/databaseprovider/options.go similarity index 100% rename from pkg/ucp/databaseprovider/options.go rename to pkg/components/database/databaseprovider/options.go diff --git a/pkg/ucp/databaseprovider/storageprovider.go b/pkg/components/database/databaseprovider/storageprovider.go similarity index 98% rename from pkg/ucp/databaseprovider/storageprovider.go rename to pkg/components/database/databaseprovider/storageprovider.go index 2891515aaa..02a331211e 100644 --- a/pkg/ucp/databaseprovider/storageprovider.go +++ b/pkg/components/database/databaseprovider/storageprovider.go @@ -21,7 +21,7 @@ import ( "fmt" "sync" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" ) // DatabaseProvider acts as a factory for database clients. diff --git a/pkg/ucp/databaseprovider/storageprovider_test.go b/pkg/components/database/databaseprovider/storageprovider_test.go similarity index 98% rename from pkg/ucp/databaseprovider/storageprovider_test.go rename to pkg/components/database/databaseprovider/storageprovider_test.go index f6a0eb9285..ef038e57dd 100644 --- a/pkg/ucp/databaseprovider/storageprovider_test.go +++ b/pkg/components/database/databaseprovider/storageprovider_test.go @@ -21,7 +21,7 @@ import ( "errors" "testing" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" ) diff --git a/pkg/ucp/databaseprovider/types.go b/pkg/components/database/databaseprovider/types.go similarity index 100% rename from pkg/ucp/databaseprovider/types.go rename to pkg/components/database/databaseprovider/types.go diff --git a/pkg/ucp/database/databaseutil/doc.go b/pkg/components/database/databaseutil/doc.go similarity index 100% rename from pkg/ucp/database/databaseutil/doc.go rename to pkg/components/database/databaseutil/doc.go diff --git a/pkg/ucp/database/databaseutil/id.go b/pkg/components/database/databaseutil/id.go similarity index 99% rename from pkg/ucp/database/databaseutil/id.go rename to pkg/components/database/databaseutil/id.go index a2f953abcb..7eb5ecd476 100644 --- a/pkg/ucp/database/databaseutil/id.go +++ b/pkg/components/database/databaseutil/id.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/ucp/database/databaseutil/id_test.go b/pkg/components/database/databaseutil/id_test.go similarity index 99% rename from pkg/ucp/database/databaseutil/id_test.go rename to pkg/components/database/databaseutil/id_test.go index 4b2a13d3b1..ed1361f2c6 100644 --- a/pkg/ucp/database/databaseutil/id_test.go +++ b/pkg/components/database/databaseutil/id_test.go @@ -19,7 +19,7 @@ package databaseutil import ( "testing" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/stretchr/testify/require" ) diff --git a/pkg/ucp/database/err.go b/pkg/components/database/err.go similarity index 100% rename from pkg/ucp/database/err.go rename to pkg/components/database/err.go diff --git a/pkg/ucp/database/etcdstore/etcdclient.go b/pkg/components/database/etcdstore/etcdclient.go similarity index 98% rename from pkg/ucp/database/etcdstore/etcdclient.go rename to pkg/components/database/etcdstore/etcdclient.go index ed3c7a1a76..96a7e1d281 100644 --- a/pkg/ucp/database/etcdstore/etcdclient.go +++ b/pkg/components/database/etcdstore/etcdclient.go @@ -52,8 +52,8 @@ import ( "fmt" "strings" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/database/databaseutil" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/database/databaseutil" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" etcdclient "go.etcd.io/etcd/client/v3" diff --git a/pkg/ucp/database/etcdstore/etcdclient_test.go b/pkg/components/database/etcdstore/etcdclient_test.go similarity index 100% rename from pkg/ucp/database/etcdstore/etcdclient_test.go rename to pkg/components/database/etcdstore/etcdclient_test.go diff --git a/pkg/ucp/database/filter.go b/pkg/components/database/filter.go similarity index 100% rename from pkg/ucp/database/filter.go rename to pkg/components/database/filter.go diff --git a/pkg/ucp/database/filter_test.go b/pkg/components/database/filter_test.go similarity index 100% rename from pkg/ucp/database/filter_test.go rename to pkg/components/database/filter_test.go diff --git a/pkg/ucp/database/inmemory/client.go b/pkg/components/database/inmemory/client.go similarity index 98% rename from pkg/ucp/database/inmemory/client.go rename to pkg/components/database/inmemory/client.go index 9b9ac141e9..1d74d4aa6a 100644 --- a/pkg/ucp/database/inmemory/client.go +++ b/pkg/components/database/inmemory/client.go @@ -23,8 +23,8 @@ import ( "strings" "sync" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/database/databaseutil" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/database/databaseutil" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" "golang.org/x/exp/maps" diff --git a/pkg/ucp/database/inmemory/client_test.go b/pkg/components/database/inmemory/client_test.go similarity index 100% rename from pkg/ucp/database/inmemory/client_test.go rename to pkg/components/database/inmemory/client_test.go diff --git a/pkg/ucp/database/inmemory/doc.go b/pkg/components/database/inmemory/doc.go similarity index 100% rename from pkg/ucp/database/inmemory/doc.go rename to pkg/components/database/inmemory/doc.go diff --git a/pkg/ucp/database/map.go b/pkg/components/database/map.go similarity index 100% rename from pkg/ucp/database/map.go rename to pkg/components/database/map.go diff --git a/pkg/ucp/database/map_test.go b/pkg/components/database/map_test.go similarity index 100% rename from pkg/ucp/database/map_test.go rename to pkg/components/database/map_test.go diff --git a/pkg/ucp/database/mock_client.go b/pkg/components/database/mock_client.go similarity index 96% rename from pkg/ucp/database/mock_client.go rename to pkg/components/database/mock_client.go index 5a3a7b3939..1e758da1fc 100644 --- a/pkg/ucp/database/mock_client.go +++ b/pkg/components/database/mock_client.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/radius-project/radius/pkg/ucp/database (interfaces: Client) +// Source: github.com/radius-project/radius/pkg/components/database (interfaces: Client) // // Generated by this command: // -// mockgen -typed -destination=./mock_client.go -package=database -self_package github.com/radius-project/radius/pkg/ucp/database github.com/radius-project/radius/pkg/ucp/database Client +// mockgen -typed -destination=./mock_client.go -package=database -self_package github.com/radius-project/radius/pkg/components/database github.com/radius-project/radius/pkg/components/database Client // // Package database is a generated GoMock package. diff --git a/pkg/ucp/database/object.go b/pkg/components/database/object.go similarity index 100% rename from pkg/ucp/database/object.go rename to pkg/components/database/object.go diff --git a/pkg/ucp/database/options.go b/pkg/components/database/options.go similarity index 100% rename from pkg/ucp/database/options.go rename to pkg/components/database/options.go diff --git a/pkg/ucp/database/postgres/postgresclient.go b/pkg/components/database/postgres/postgresclient.go similarity index 98% rename from pkg/ucp/database/postgres/postgresclient.go rename to pkg/components/database/postgres/postgresclient.go index d5dbb681db..3c38628c09 100644 --- a/pkg/ucp/database/postgres/postgresclient.go +++ b/pkg/components/database/postgres/postgresclient.go @@ -27,8 +27,8 @@ import ( "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/database/databaseutil" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/database/databaseutil" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" ) diff --git a/pkg/ucp/database/postgres/postgresclient_test.go b/pkg/components/database/postgres/postgresclient_test.go similarity index 100% rename from pkg/ucp/database/postgres/postgresclient_test.go rename to pkg/components/database/postgres/postgresclient_test.go diff --git a/pkg/ucp/database/resources.go b/pkg/components/database/resources.go similarity index 100% rename from pkg/ucp/database/resources.go rename to pkg/components/database/resources.go diff --git a/pkg/components/doc.go b/pkg/components/doc.go new file mode 100644 index 0000000000..49d7adc4ba --- /dev/null +++ b/pkg/components/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2023 The Radius 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. +*/ + +// components and its subpackages hold the implementations of shared components used by the Radius control-plane services. +package components diff --git a/pkg/ucp/queue/apiserver/client.go b/pkg/components/queue/apiserver/client.go similarity index 90% rename from pkg/ucp/queue/apiserver/client.go rename to pkg/components/queue/apiserver/client.go index c133d874e4..a8a1dd6e95 100644 --- a/pkg/ucp/queue/apiserver/client.go +++ b/pkg/components/queue/apiserver/client.go @@ -60,9 +60,8 @@ import ( "strconv" "time" - "github.com/radius-project/radius/pkg/ucp/queue/client" - - v1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" + v1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/queue" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" @@ -81,7 +80,7 @@ const ( defaultExpiryDuration = time.Duration(10) * time.Hour ) -var _ client.Client = (*Client)(nil) +var _ queue.Client = (*Client)(nil) // Client is the queue client used for dev and test purpose. type Client struct { @@ -117,15 +116,15 @@ func getTimeFromString(s string) time.Time { return time.Unix(0, nsec) } -func copyMessage(msg *client.Message, queueMessage *v1alpha1.QueueMessage) { - msg.Metadata = client.Metadata{ +func copyMessage(msg *queue.Message, queueMessage *v1alpha1.QueueMessage) { + msg.Metadata = queue.Metadata{ ID: queueMessage.Name, DequeueCount: queueMessage.Spec.DequeueCount, EnqueueAt: queueMessage.Spec.EnqueueAt.Time, ExpireAt: queueMessage.Spec.ExpireAt.Time, NextVisibleAt: getTimeFromString(queueMessage.Labels[LabelNextVisibleAt]), } - msg.ContentType = client.JSONContentType + msg.ContentType = queue.JSONContentType msg.Data = make([]byte, len(queueMessage.Spec.Data.Raw)) copy(msg.Data, queueMessage.Spec.Data.Raw) } @@ -155,13 +154,13 @@ func (c *Client) generateID() (string, error) { return fmt.Sprintf("%s.%10d.%32x", c.opts.Name, time.Now().Unix(), b), nil } -func (c *Client) Enqueue(ctx context.Context, msg *client.Message, options ...client.EnqueueOptions) error { +func (c *Client) Enqueue(ctx context.Context, msg *queue.Message, options ...queue.EnqueueOptions) error { if msg == nil || msg.Data == nil || len(msg.Data) == 0 { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } - if msg.ContentType != client.JSONContentType { - return client.ErrUnsupportedContentType + if msg.ContentType != queue.JSONContentType { + return queue.ErrUnsupportedContentType } now := time.Now() @@ -183,7 +182,7 @@ func (c *Client) Enqueue(ctx context.Context, msg *client.Message, options ...cl DequeueCount: 0, EnqueueAt: metav1.Time{Time: now.UTC()}, ExpireAt: metav1.Time{Time: now.Add(c.opts.ExpiryDuration).UTC()}, - ContentType: client.JSONContentType, // RawExtension supports only JSON seralized data + ContentType: queue.JSONContentType, // RawExtension supports only JSON seralized data Data: &runtime.RawExtension{Raw: msg.Data}, }, } @@ -236,7 +235,7 @@ func (c *Client) getQueueMessage(ctx context.Context, now time.Time) (*v1alpha1. return &ql.Items[0], nil } - return nil, client.ErrMessageNotFound + return nil, queue.ErrMessageNotFound } // extendItem udpates LabelNextVisibleAt to extend the lease time of message. Dequeue and ExtendMessage @@ -257,14 +256,14 @@ func (c *Client) extendItem(ctx context.Context, id string, expectedDequeueCount // mismatched if another client leased this message. This can happen by clock skew Because // Dequeue() operation relies on system clock. if result.Spec.DequeueCount != expectedDequeueCount { - return client.ErrDequeuedMessage + return queue.ErrDequeuedMessage } nsec := mustParseInt64(result.Labels[LabelNextVisibleAt]) // Check if the message is already requeued. This condition is required for ExtendMessage because we cannot extend the message which was requeued. if !isDequeue && nsec < afterTime.UnixNano() { - return client.ErrInvalidMessage + return queue.ErrInvalidMessage } result.Labels[LabelNextVisibleAt] = int64toa(nextVisibleAt) @@ -284,11 +283,11 @@ func (c *Client) extendItem(ctx context.Context, id string, expectedDequeueCount return result, nil } -func (c *Client) Dequeue(ctx context.Context, opts client.QueueClientConfig) (*client.Message, error) { +func (c *Client) Dequeue(ctx context.Context, opts queue.QueueClientConfig) (*queue.Message, error) { var result *v1alpha1.QueueMessage DequeuedMessageError := func(err error) bool { - return errors.Is(err, client.ErrDequeuedMessage) + return errors.Is(err, queue.ErrDequeuedMessage) } now := time.Now() @@ -312,15 +311,15 @@ func (c *Client) Dequeue(ctx context.Context, opts client.QueueClientConfig) (*c return nil, retryErr } - msg := &client.Message{} + msg := &queue.Message{} copyMessage(msg, result) return msg, nil } -func (c *Client) FinishMessage(ctx context.Context, msg *client.Message) error { +func (c *Client) FinishMessage(ctx context.Context, msg *queue.Message) error { if msg == nil { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } result := &v1alpha1.QueueMessage{} @@ -342,9 +341,9 @@ func (c *Client) FinishMessage(ctx context.Context, msg *client.Message) error { return retryErr } -func (c *Client) ExtendMessage(ctx context.Context, msg *client.Message) error { +func (c *Client) ExtendMessage(ctx context.Context, msg *queue.Message) error { if msg == nil { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } now := time.Now() diff --git a/pkg/ucp/queue/apiserver/client_test.go b/pkg/components/queue/apiserver/client_test.go similarity index 88% rename from pkg/ucp/queue/apiserver/client_test.go rename to pkg/components/queue/apiserver/client_test.go index 77c608199f..7cc808b51a 100644 --- a/pkg/ucp/queue/apiserver/client_test.go +++ b/pkg/components/queue/apiserver/client_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - v1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" - "github.com/radius-project/radius/pkg/ucp/queue/client" + v1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/queue" "github.com/radius-project/radius/test/testcontext" "github.com/radius-project/radius/test/ucp/kubeenv" sharedtest "github.com/radius-project/radius/test/ucp/queuetest" @@ -54,8 +54,8 @@ func TestGetTimeFromString(t *testing.T) { } func TestCopyMessage(t *testing.T) { - msg := &client.Message{ - Metadata: client.Metadata{ID: "testid"}, + msg := &queue.Message{ + Metadata: queue.Metadata{ID: "testid"}, } now := time.Now() queueM := &v1alpha1.QueueMessage{ @@ -71,7 +71,7 @@ func TestCopyMessage(t *testing.T) { DequeueCount: 2, EnqueueAt: metav1.Time{Time: now.UTC()}, ExpireAt: metav1.Time{Time: now.Add(10 * time.Second).UTC()}, - ContentType: client.JSONContentType, // RawExtension supports only JSON seralized data + ContentType: queue.JSONContentType, // RawExtension supports only JSON seralized data Data: &runtime.RawExtension{Raw: []byte("hello world")}, }, } @@ -79,7 +79,7 @@ func TestCopyMessage(t *testing.T) { copyMessage(msg, queueM) require.Equal(t, queueM.ObjectMeta.Name, msg.ID) - require.Equal(t, client.JSONContentType, msg.ContentType) + require.Equal(t, queue.JSONContentType, msg.ContentType) require.Equal(t, queueM.Spec.DequeueCount, msg.DequeueCount) require.Equal(t, queueM.Spec.Data.Raw, msg.Data) require.Equal(t, queueM.Spec.ExpireAt.Time, msg.ExpireAt) @@ -131,9 +131,9 @@ func TestClient(t *testing.T) { client2, err := New(rc, Options{Name: "applications.core", Namespace: ns, MessageLockDuration: time.Duration(1) * time.Minute}) require.NoError(t, err) - err = client1.Enqueue(ctx, client.NewMessage("{}")) + err = client1.Enqueue(ctx, queue.NewMessage("{}")) require.NoError(t, err) - msg, err := client2.Dequeue(ctx, client.QueueClientConfig{}) + msg, err := client2.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) // Increase DequeueCount to mimic the situation when client1 updates message by the clock skew. @@ -141,6 +141,6 @@ func TestClient(t *testing.T) { require.NoError(t, err) err = client2.ExtendMessage(ctx, msg) - require.ErrorIs(t, err, client.ErrDequeuedMessage) + require.ErrorIs(t, err, queue.ErrDequeuedMessage) }) } diff --git a/pkg/ucp/queue/client/client.go b/pkg/components/queue/client.go similarity index 94% rename from pkg/ucp/queue/client/client.go rename to pkg/components/queue/client.go index 7a4471bd6c..c998c5aa19 100644 --- a/pkg/ucp/queue/client/client.go +++ b/pkg/components/queue/client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package queue import ( "context" @@ -41,7 +41,7 @@ var ( ErrEmptyMessage = errors.New("message must not be nil or message is empty") ) -//go:generate mockgen -typed -destination=./mock_client.go -package=client -self_package github.com/radius-project/radius/pkg/ucp/queue/client github.com/radius-project/radius/pkg/ucp/queue/client Client +//go:generate mockgen -typed -destination=./mock_client.go -package=queue -self_package github.com/radius-project/radius/pkg/components/queue github.com/radius-project/radius/pkg/components/queue Client // Client is an interface to implement queue operations. type Client interface { diff --git a/pkg/ucp/queue/client/client_test.go b/pkg/components/queue/client_test.go similarity index 99% rename from pkg/ucp/queue/client/client_test.go rename to pkg/components/queue/client_test.go index f6c4a6ad1b..d9fe6b91da 100644 --- a/pkg/ucp/queue/client/client_test.go +++ b/pkg/components/queue/client_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package queue import ( "context" diff --git a/pkg/ucp/queue/inmemory/client.go b/pkg/components/queue/inmemory/client.go similarity index 74% rename from pkg/ucp/queue/inmemory/client.go rename to pkg/components/queue/inmemory/client.go index 70347ca322..86978bb204 100644 --- a/pkg/ucp/queue/inmemory/client.go +++ b/pkg/components/queue/inmemory/client.go @@ -20,11 +20,11 @@ import ( "context" "sync" - "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/queue" ) var namedQueue = &sync.Map{} -var _ client.Client = (*Client)(nil) +var _ queue.Client = (*Client)(nil) // Client is the queue client used for dev and test purpose. type Client struct { @@ -51,36 +51,36 @@ func NewNamedQueue(name string) *Client { } // Enqueue enqueues message to the in-memory queue. -func (c *Client) Enqueue(ctx context.Context, msg *client.Message, options ...client.EnqueueOptions) error { +func (c *Client) Enqueue(ctx context.Context, msg *queue.Message, options ...queue.EnqueueOptions) error { if msg == nil || msg.Data == nil || len(msg.Data) == 0 { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } c.queue.Enqueue(msg) return nil } // Dequeue dequeues message from the in-memory queue. -func (c *Client) Dequeue(ctx context.Context, opts client.QueueClientConfig) (*client.Message, error) { +func (c *Client) Dequeue(ctx context.Context, opts queue.QueueClientConfig) (*queue.Message, error) { msg := c.queue.Dequeue() if msg == nil { - return nil, client.ErrMessageNotFound + return nil, queue.ErrMessageNotFound } return msg, nil } // FinishMessage finishes or deletes the message in the queue. -func (c *Client) FinishMessage(ctx context.Context, msg *client.Message) error { +func (c *Client) FinishMessage(ctx context.Context, msg *queue.Message) error { if msg == nil { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } return c.queue.Complete(msg) } // ExtendMessage extends the message lock. -func (c *Client) ExtendMessage(ctx context.Context, msg *client.Message) error { +func (c *Client) ExtendMessage(ctx context.Context, msg *queue.Message) error { if msg == nil { - return client.ErrEmptyMessage + return queue.ErrEmptyMessage } err := c.queue.Extend(msg) diff --git a/pkg/ucp/queue/inmemory/client_test.go b/pkg/components/queue/inmemory/client_test.go similarity index 85% rename from pkg/ucp/queue/inmemory/client_test.go rename to pkg/components/queue/inmemory/client_test.go index e3b35b9281..d175adfc2f 100644 --- a/pkg/ucp/queue/inmemory/client_test.go +++ b/pkg/components/queue/inmemory/client_test.go @@ -20,9 +20,9 @@ import ( "context" "testing" - "github.com/radius-project/radius/pkg/ucp/queue/client" "github.com/stretchr/testify/require" + "github.com/radius-project/radius/pkg/components/queue" sharedtest "github.com/radius-project/radius/test/ucp/queuetest" ) @@ -30,9 +30,9 @@ func TestNamedQueue(t *testing.T) { cli1 := NewNamedQueue("queue1") cli2 := NewNamedQueue("queue2") - err := cli1.Enqueue(context.Background(), &client.Message{Data: []byte("test1")}) + err := cli1.Enqueue(context.Background(), &queue.Message{Data: []byte("test1")}) require.NoError(t, err) - err = cli2.Enqueue(context.Background(), &client.Message{Data: []byte("test2")}) + err = cli2.Enqueue(context.Background(), &queue.Message{Data: []byte("test2")}) require.NoError(t, err) require.Equal(t, 1, cli1.queue.Len()) diff --git a/pkg/ucp/queue/inmemory/queue.go b/pkg/components/queue/inmemory/queue.go similarity index 88% rename from pkg/ucp/queue/inmemory/queue.go rename to pkg/components/queue/inmemory/queue.go index 5a428db340..5aa8df15a8 100644 --- a/pkg/ucp/queue/inmemory/queue.go +++ b/pkg/components/queue/inmemory/queue.go @@ -22,7 +22,7 @@ import ( "time" "github.com/google/uuid" - "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/queue" ) var ( @@ -33,7 +33,7 @@ var ( ) type element struct { - val *client.Message + val *queue.Message visible bool } @@ -65,7 +65,7 @@ func (q *InmemQueue) DeleteAll() { _ = q.v.Init() } -func (q *InmemQueue) Enqueue(msg *client.Message) { +func (q *InmemQueue) Enqueue(msg *queue.Message) { q.updateQueue() q.vMu.Lock() @@ -79,10 +79,10 @@ func (q *InmemQueue) Enqueue(msg *client.Message) { q.v.PushBack(&element{val: msg, visible: true}) } -func (q *InmemQueue) Dequeue() *client.Message { +func (q *InmemQueue) Dequeue() *queue.Message { q.updateQueue() - var found *client.Message + var found *queue.Message q.elementRange(func(e *list.Element, elem *element) bool { if elem.visible { @@ -98,7 +98,7 @@ func (q *InmemQueue) Dequeue() *client.Message { return found } -func (q *InmemQueue) Complete(msg *client.Message) error { +func (q *InmemQueue) Complete(msg *queue.Message) error { found := false q.elementRange(func(e *list.Element, elem *element) bool { if elem.val.ID == msg.ID { @@ -110,13 +110,13 @@ func (q *InmemQueue) Complete(msg *client.Message) error { }) if !found { - return client.ErrInvalidMessage + return queue.ErrInvalidMessage } return nil } -func (q *InmemQueue) Extend(msg *client.Message) error { +func (q *InmemQueue) Extend(msg *queue.Message) error { found := false now := time.Now() q.elementRange(func(e *list.Element, elem *element) bool { @@ -135,7 +135,7 @@ func (q *InmemQueue) Extend(msg *client.Message) error { }) if !found { - return client.ErrInvalidMessage + return queue.ErrInvalidMessage } return nil diff --git a/pkg/ucp/queue/inmemory/queue_test.go b/pkg/components/queue/inmemory/queue_test.go similarity index 90% rename from pkg/ucp/queue/inmemory/queue_test.go rename to pkg/components/queue/inmemory/queue_test.go index 1a13e8d769..ec9b34810a 100644 --- a/pkg/ucp/queue/inmemory/queue_test.go +++ b/pkg/components/queue/inmemory/queue_test.go @@ -22,14 +22,14 @@ import ( "time" - "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/queue" "github.com/stretchr/testify/require" ) func TestEnqueueDequeueMulti(t *testing.T) { q := NewInMemQueue(messageLockDuration) for i := 0; i < 10; i++ { - q.Enqueue(&client.Message{ + q.Enqueue(&queue.Message{ Data: []byte(fmt.Sprintf("test%d", i)), }) } @@ -48,7 +48,7 @@ func TestEnqueueDequeueMulti(t *testing.T) { func TestMessageLock(t *testing.T) { q := NewInMemQueue(2 * time.Millisecond) - q.Enqueue(&client.Message{ + q.Enqueue(&queue.Message{ Data: []byte("test"), }) @@ -67,7 +67,7 @@ func TestMessageLock(t *testing.T) { func TestExpiry(t *testing.T) { q := NewInMemQueue(messageLockDuration) - q.Enqueue(&client.Message{ + q.Enqueue(&queue.Message{ Data: []byte("test"), }) @@ -86,7 +86,7 @@ func TestExpiry(t *testing.T) { func TestComplete(t *testing.T) { q := NewInMemQueue(messageLockDuration) - q.Enqueue(&client.Message{ + q.Enqueue(&queue.Message{ Data: []byte("test"), }) @@ -96,7 +96,7 @@ func TestComplete(t *testing.T) { // Try to complete the message again. err = q.Complete(msg) - require.ErrorIs(t, client.ErrInvalidMessage, err) + require.ErrorIs(t, queue.ErrInvalidMessage, err) msg2 := q.Dequeue() require.Nil(t, msg2) diff --git a/pkg/ucp/queue/client/message.go b/pkg/components/queue/message.go similarity index 99% rename from pkg/ucp/queue/client/message.go rename to pkg/components/queue/message.go index 16237ef727..a76beb0294 100644 --- a/pkg/ucp/queue/client/message.go +++ b/pkg/components/queue/message.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package queue import ( "encoding/json" diff --git a/pkg/ucp/queue/client/mock_client.go b/pkg/components/queue/mock_client.go similarity index 94% rename from pkg/ucp/queue/client/mock_client.go rename to pkg/components/queue/mock_client.go index fe0165e80e..aaf644513d 100644 --- a/pkg/ucp/queue/client/mock_client.go +++ b/pkg/components/queue/mock_client.go @@ -1,13 +1,13 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/radius-project/radius/pkg/ucp/queue/client (interfaces: Client) +// Source: github.com/radius-project/radius/pkg/components/queue (interfaces: Client) // // Generated by this command: // -// mockgen -typed -destination=./mock_client.go -package=client -self_package github.com/radius-project/radius/pkg/ucp/queue/client github.com/radius-project/radius/pkg/ucp/queue/client Client +// mockgen -typed -destination=./mock_client.go -package=queue -self_package github.com/radius-project/radius/pkg/components/queue github.com/radius-project/radius/pkg/components/queue Client // -// Package client is a generated GoMock package. -package client +// Package queue is a generated GoMock package. +package queue import ( context "context" diff --git a/pkg/ucp/queue/client/options.go b/pkg/components/queue/options.go similarity index 99% rename from pkg/ucp/queue/client/options.go rename to pkg/components/queue/options.go index d3d49a9c71..7ae1f50c87 100644 --- a/pkg/ucp/queue/client/options.go +++ b/pkg/components/queue/options.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package queue import "time" diff --git a/pkg/ucp/queue/queueprovider/factory.go b/pkg/components/queue/queueprovider/factory.go similarity index 87% rename from pkg/ucp/queue/queueprovider/factory.go rename to pkg/components/queue/queueprovider/factory.go index c206cb7942..af43746283 100644 --- a/pkg/ucp/queue/queueprovider/factory.go +++ b/pkg/components/queue/queueprovider/factory.go @@ -21,11 +21,11 @@ import ( "errors" "fmt" + ucpv1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" + "github.com/radius-project/radius/pkg/components/queue" + "github.com/radius-project/radius/pkg/components/queue/apiserver" + qinmem "github.com/radius-project/radius/pkg/components/queue/inmemory" "github.com/radius-project/radius/pkg/kubeutil" - ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" - "github.com/radius-project/radius/pkg/ucp/queue/apiserver" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" - qinmem "github.com/radius-project/radius/pkg/ucp/queue/inmemory" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/ucp/queue/queueprovider/options.go b/pkg/components/queue/queueprovider/options.go similarity index 100% rename from pkg/ucp/queue/queueprovider/options.go rename to pkg/components/queue/queueprovider/options.go diff --git a/pkg/ucp/queue/queueprovider/provider.go b/pkg/components/queue/queueprovider/provider.go similarity index 96% rename from pkg/ucp/queue/queueprovider/provider.go rename to pkg/components/queue/queueprovider/provider.go index 6b25ea1e4f..2350089fc0 100644 --- a/pkg/ucp/queue/queueprovider/provider.go +++ b/pkg/components/queue/queueprovider/provider.go @@ -21,7 +21,7 @@ import ( "errors" "sync" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/queue" ) var ( diff --git a/pkg/ucp/queue/queueprovider/provider_test.go b/pkg/components/queue/queueprovider/provider_test.go similarity index 100% rename from pkg/ucp/queue/queueprovider/provider_test.go rename to pkg/components/queue/queueprovider/provider_test.go diff --git a/pkg/ucp/queue/queueprovider/types.go b/pkg/components/queue/queueprovider/types.go similarity index 100% rename from pkg/ucp/queue/queueprovider/types.go rename to pkg/components/queue/queueprovider/types.go diff --git a/pkg/ucp/secret/client.go b/pkg/components/secret/client.go similarity index 95% rename from pkg/ucp/secret/client.go rename to pkg/components/secret/client.go index a4ae6a3d0f..737bb18d39 100644 --- a/pkg/ucp/secret/client.go +++ b/pkg/components/secret/client.go @@ -21,7 +21,7 @@ import ( "encoding/json" ) -//go:generate mockgen -typed -destination=./mock_client.go -package=secret -self_package github.com/radius-project/radius/pkg/ucp/secret github.com/radius-project/radius/pkg/ucp/secret Client +//go:generate mockgen -typed -destination=./mock_client.go -package=secret -self_package github.com/radius-project/radius/pkg/components/secret github.com/radius-project/radius/pkg/components/secret Client // Client is an interface to implement secret operations. type Client interface { diff --git a/pkg/ucp/secret/client_test.go b/pkg/components/secret/client_test.go similarity index 100% rename from pkg/ucp/secret/client_test.go rename to pkg/components/secret/client_test.go diff --git a/pkg/ucp/secret/etcd/client.go b/pkg/components/secret/etcd/client.go similarity index 97% rename from pkg/ucp/secret/etcd/client.go rename to pkg/components/secret/etcd/client.go index 05a26276d6..344cb0a4c4 100644 --- a/pkg/ucp/secret/etcd/client.go +++ b/pkg/components/secret/etcd/client.go @@ -19,7 +19,7 @@ package etcd import ( "context" - "github.com/radius-project/radius/pkg/ucp/secret" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/util" etcdclient "go.etcd.io/etcd/client/v3" ) diff --git a/pkg/ucp/secret/etcd/client_test.go b/pkg/components/secret/etcd/client_test.go similarity index 98% rename from pkg/ucp/secret/etcd/client_test.go rename to pkg/components/secret/etcd/client_test.go index f7f033a11d..29219e2f16 100644 --- a/pkg/ucp/secret/etcd/client_test.go +++ b/pkg/components/secret/etcd/client_test.go @@ -22,9 +22,9 @@ import ( "strconv" "testing" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/data" "github.com/radius-project/radius/pkg/ucp/hosting" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" etcdclient "go.etcd.io/etcd/client/v3" diff --git a/pkg/ucp/secret/inmemory/client.go b/pkg/components/secret/inmemory/client.go similarity index 97% rename from pkg/ucp/secret/inmemory/client.go rename to pkg/components/secret/inmemory/client.go index 8c9c7d3c35..c22ea350fd 100644 --- a/pkg/ucp/secret/inmemory/client.go +++ b/pkg/components/secret/inmemory/client.go @@ -20,8 +20,8 @@ import ( "context" "sync" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/kubernetes" - "github.com/radius-project/radius/pkg/ucp/secret" ) var _ secret.Client = (*Client)(nil) diff --git a/pkg/ucp/secret/inmemory/client_test.go b/pkg/components/secret/inmemory/client_test.go similarity index 98% rename from pkg/ucp/secret/inmemory/client_test.go rename to pkg/components/secret/inmemory/client_test.go index b24e5ffd43..eaeed5ddf9 100644 --- a/pkg/ucp/secret/inmemory/client_test.go +++ b/pkg/components/secret/inmemory/client_test.go @@ -21,7 +21,7 @@ import ( "encoding/json" "testing" - "github.com/radius-project/radius/pkg/ucp/secret" + "github.com/radius-project/radius/pkg/components/secret" "github.com/stretchr/testify/require" ) diff --git a/pkg/ucp/secret/kubernetes/client.go b/pkg/components/secret/kubernetes/client.go similarity index 98% rename from pkg/ucp/secret/kubernetes/client.go rename to pkg/components/secret/kubernetes/client.go index 6a1c7dfc89..5018dcee3e 100644 --- a/pkg/ucp/secret/kubernetes/client.go +++ b/pkg/components/secret/kubernetes/client.go @@ -19,8 +19,8 @@ package kubernetes import ( "context" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/kubernetes" - "github.com/radius-project/radius/pkg/ucp/secret" corev1 "k8s.io/api/core/v1" k8s_error "k8s.io/apimachinery/pkg/api/errors" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/ucp/secret/kubernetes/client_test.go b/pkg/components/secret/kubernetes/client_test.go similarity index 98% rename from pkg/ucp/secret/kubernetes/client_test.go rename to pkg/components/secret/kubernetes/client_test.go index b6b1905e65..f4acd9c972 100644 --- a/pkg/ucp/secret/kubernetes/client_test.go +++ b/pkg/components/secret/kubernetes/client_test.go @@ -21,7 +21,7 @@ import ( "encoding/json" "testing" - "github.com/radius-project/radius/pkg/ucp/secret" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/test/k8sutil" "github.com/stretchr/testify/require" diff --git a/pkg/ucp/secret/mock_client.go b/pkg/components/secret/mock_client.go similarity index 95% rename from pkg/ucp/secret/mock_client.go rename to pkg/components/secret/mock_client.go index 492431c027..0999d8f8e8 100644 --- a/pkg/ucp/secret/mock_client.go +++ b/pkg/components/secret/mock_client.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/radius-project/radius/pkg/ucp/secret (interfaces: Client) +// Source: github.com/radius-project/radius/pkg/components/secret (interfaces: Client) // // Generated by this command: // -// mockgen -typed -destination=./mock_client.go -package=secret -self_package github.com/radius-project/radius/pkg/ucp/secret github.com/radius-project/radius/pkg/ucp/secret Client +// mockgen -typed -destination=./mock_client.go -package=secret -self_package github.com/radius-project/radius/pkg/components/secret github.com/radius-project/radius/pkg/components/secret Client // // Package secret is a generated GoMock package. diff --git a/pkg/ucp/secret/secretprovider/factory.go b/pkg/components/secret/secretprovider/factory.go similarity index 85% rename from pkg/ucp/secret/secretprovider/factory.go rename to pkg/components/secret/secretprovider/factory.go index 219b355827..f9ca30572e 100644 --- a/pkg/ucp/secret/secretprovider/factory.go +++ b/pkg/components/secret/secretprovider/factory.go @@ -20,13 +20,13 @@ import ( "context" "errors" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/database/etcdstore" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/etcd" + "github.com/radius-project/radius/pkg/components/secret/inmemory" + kubernetes_client "github.com/radius-project/radius/pkg/components/secret/kubernetes" "github.com/radius-project/radius/pkg/kubeutil" - "github.com/radius-project/radius/pkg/ucp/database/etcdstore" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/secret" - "github.com/radius-project/radius/pkg/ucp/secret/etcd" - "github.com/radius-project/radius/pkg/ucp/secret/inmemory" - kubernetes_client "github.com/radius-project/radius/pkg/ucp/secret/kubernetes" "k8s.io/kubectl/pkg/scheme" controller_runtime "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/ucp/secret/secretprovider/options.go b/pkg/components/secret/secretprovider/options.go similarity index 92% rename from pkg/ucp/secret/secretprovider/options.go rename to pkg/components/secret/secretprovider/options.go index b10fe006b8..9820a91f8a 100644 --- a/pkg/ucp/secret/secretprovider/options.go +++ b/pkg/components/secret/secretprovider/options.go @@ -16,7 +16,7 @@ limitations under the License. package secretprovider -import "github.com/radius-project/radius/pkg/ucp/databaseprovider" +import "github.com/radius-project/radius/pkg/components/database/databaseprovider" // SecretProviderOptions contains provider information of the secret. type SecretProviderOptions struct { diff --git a/pkg/ucp/secret/secretprovider/provider.go b/pkg/components/secret/secretprovider/provider.go similarity index 96% rename from pkg/ucp/secret/secretprovider/provider.go rename to pkg/components/secret/secretprovider/provider.go index feef4f47a3..46ebd57bcd 100644 --- a/pkg/ucp/secret/secretprovider/provider.go +++ b/pkg/components/secret/secretprovider/provider.go @@ -21,7 +21,7 @@ import ( "errors" "sync" - "github.com/radius-project/radius/pkg/ucp/secret" + "github.com/radius-project/radius/pkg/components/secret" ) var ( diff --git a/pkg/ucp/secret/secretprovider/provider_test.go b/pkg/components/secret/secretprovider/provider_test.go similarity index 100% rename from pkg/ucp/secret/secretprovider/provider_test.go rename to pkg/components/secret/secretprovider/provider_test.go diff --git a/pkg/ucp/secret/secretprovider/types.go b/pkg/components/secret/secretprovider/types.go similarity index 100% rename from pkg/ucp/secret/secretprovider/types.go rename to pkg/components/secret/secretprovider/types.go diff --git a/pkg/corerp/backend/controller/createorupdateresource.go b/pkg/corerp/backend/controller/createorupdateresource.go index 65a86ff108..69fe39329a 100644 --- a/pkg/corerp/backend/controller/createorupdateresource.go +++ b/pkg/corerp/backend/controller/createorupdateresource.go @@ -25,12 +25,12 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/corerp/renderers/container" "github.com/radius-project/radius/pkg/corerp/renderers/gateway" "github.com/radius-project/radius/pkg/corerp/renderers/volume" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/corerp/backend/controller/createorupdateresource_test.go b/pkg/corerp/backend/controller/createorupdateresource_test.go index 8c5a0cc787..21f6d9c0e6 100644 --- a/pkg/corerp/backend/controller/createorupdateresource_test.go +++ b/pkg/corerp/backend/controller/createorupdateresource_test.go @@ -28,13 +28,13 @@ import ( "go.uber.org/mock/gomock" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" deployment "github.com/radius-project/radius/pkg/corerp/backend/deployment" "github.com/radius-project/radius/pkg/corerp/renderers" "github.com/radius-project/radius/pkg/corerp/renderers/container" "github.com/radius-project/radius/pkg/corerp/renderers/gateway" ds_ctrl "github.com/radius-project/radius/pkg/datastoresrp/frontend/controller" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/corerp/backend/controller/deleteresource_test.go b/pkg/corerp/backend/controller/deleteresource_test.go index b1cff8cf7c..e5d9ffe2f2 100644 --- a/pkg/corerp/backend/controller/deleteresource_test.go +++ b/pkg/corerp/backend/controller/deleteresource_test.go @@ -24,8 +24,8 @@ import ( "github.com/google/uuid" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" deployment "github.com/radius-project/radius/pkg/corerp/backend/deployment" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/corerp/backend/deployment/deploymentprocessor.go b/pkg/corerp/backend/deployment/deploymentprocessor.go index a7803ae8bc..1e4de863c2 100644 --- a/pkg/corerp/backend/deployment/deploymentprocessor.go +++ b/pkg/corerp/backend/deployment/deploymentprocessor.go @@ -29,6 +29,7 @@ import ( rp_util "github.com/radius-project/radius/pkg/rp/util" rpv1 "github.com/radius-project/radius/pkg/rp/v1" + "github.com/radius-project/radius/pkg/components/database" corerp_dm "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/corerp/handlers" "github.com/radius-project/radius/pkg/corerp/model" @@ -40,7 +41,6 @@ import ( msg_dm "github.com/radius-project/radius/pkg/messagingrp/datamodel" msg_ctrl "github.com/radius-project/radius/pkg/messagingrp/frontend/controller" "github.com/radius-project/radius/pkg/portableresources" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/corerp/backend/deployment/deploymentprocessor_test.go b/pkg/corerp/backend/deployment/deploymentprocessor_test.go index 0cb4aaa29d..a0d64f52bf 100644 --- a/pkg/corerp/backend/deployment/deploymentprocessor_test.go +++ b/pkg/corerp/backend/deployment/deploymentprocessor_test.go @@ -25,6 +25,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/azure/clientv2" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/corerp/handlers" "github.com/radius-project/radius/pkg/corerp/model" @@ -37,7 +38,6 @@ import ( "github.com/radius-project/radius/pkg/resourcemodel" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" resources_azure "github.com/radius-project/radius/pkg/ucp/resources/azure" resources_kubernetes "github.com/radius-project/radius/pkg/ucp/resources/kubernetes" diff --git a/pkg/corerp/frontend/controller/applications/getgraph_test.go b/pkg/corerp/frontend/controller/applications/getgraph_test.go index d859cf5d31..4191d1dfe5 100644 --- a/pkg/corerp/frontend/controller/applications/getgraph_test.go +++ b/pkg/corerp/frontend/controller/applications/getgraph_test.go @@ -24,8 +24,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/corerp/frontend/controller/applications/updatefilter_test.go b/pkg/corerp/frontend/controller/applications/updatefilter_test.go index 7145de92f7..96e94304e0 100644 --- a/pkg/corerp/frontend/controller/applications/updatefilter_test.go +++ b/pkg/corerp/frontend/controller/applications/updatefilter_test.go @@ -24,9 +24,9 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/datamodel" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/test/k8sutil" diff --git a/pkg/corerp/frontend/controller/environments/createorupdateenvironment_test.go b/pkg/corerp/frontend/controller/environments/createorupdateenvironment_test.go index 13e12d07ce..aa3420cf7e 100644 --- a/pkg/corerp/frontend/controller/environments/createorupdateenvironment_test.go +++ b/pkg/corerp/frontend/controller/environments/createorupdateenvironment_test.go @@ -26,8 +26,8 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/google/uuid" "github.com/stretchr/testify/require" diff --git a/pkg/corerp/frontend/controller/environments/getrecipemetadata_test.go b/pkg/corerp/frontend/controller/environments/getrecipemetadata_test.go index 4d33f65af7..1d44ec10ba 100644 --- a/pkg/corerp/frontend/controller/environments/getrecipemetadata_test.go +++ b/pkg/corerp/frontend/controller/environments/getrecipemetadata_test.go @@ -27,10 +27,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/engine" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/corerp/frontend/controller/extenders/listsecretsextender_test.go b/pkg/corerp/frontend/controller/extenders/listsecretsextender_test.go index 8dfd721f9a..8b98752c82 100644 --- a/pkg/corerp/frontend/controller/extenders/listsecretsextender_test.go +++ b/pkg/corerp/frontend/controller/extenders/listsecretsextender_test.go @@ -27,7 +27,7 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/corerp/frontend/controller/secretstores/kubernetes.go b/pkg/corerp/frontend/controller/secretstores/kubernetes.go index a5b8448e46..0468b8246a 100644 --- a/pkg/corerp/frontend/controller/secretstores/kubernetes.go +++ b/pkg/corerp/frontend/controller/secretstores/kubernetes.go @@ -25,12 +25,12 @@ import ( "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/kubernetes" "github.com/radius-project/radius/pkg/kubeutil" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" resources_kubernetes "github.com/radius-project/radius/pkg/ucp/resources/kubernetes" corev1 "k8s.io/api/core/v1" diff --git a/pkg/corerp/frontend/controller/secretstores/kubernetes_test.go b/pkg/corerp/frontend/controller/secretstores/kubernetes_test.go index 6ead89f9fc..8305f2c06d 100644 --- a/pkg/corerp/frontend/controller/secretstores/kubernetes_test.go +++ b/pkg/corerp/frontend/controller/secretstores/kubernetes_test.go @@ -24,10 +24,10 @@ import ( "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/kubernetes" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" resources_kubernetes "github.com/radius-project/radius/pkg/ucp/resources/kubernetes" "github.com/radius-project/radius/test/k8sutil" "github.com/radius-project/radius/test/testutil" diff --git a/pkg/corerp/frontend/controller/secretstores/listsecrets_test.go b/pkg/corerp/frontend/controller/secretstores/listsecrets_test.go index df1551d4d4..e868cc11e4 100644 --- a/pkg/corerp/frontend/controller/secretstores/listsecrets_test.go +++ b/pkg/corerp/frontend/controller/secretstores/listsecrets_test.go @@ -26,9 +26,9 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/corerp/datamodel" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/test/k8sutil" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" diff --git a/pkg/corerp/frontend/controller/util/query.go b/pkg/corerp/frontend/controller/util/query.go index 1ed1209bab..07df01005c 100644 --- a/pkg/corerp/frontend/controller/util/query.go +++ b/pkg/corerp/frontend/controller/util/query.go @@ -19,7 +19,7 @@ package util import ( "context" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" ) // FindResources searches for resources of a given type with a given filter key and value, and returns the query result. diff --git a/pkg/corerp/setup/setup_test.go b/pkg/corerp/setup/setup_test.go index fa970df43f..1e719c127e 100644 --- a/pkg/corerp/setup/setup_test.go +++ b/pkg/corerp/setup/setup_test.go @@ -30,9 +30,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/builder" apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/inmemory" "github.com/radius-project/radius/pkg/recipes/controllerconfig" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" app_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/applications" ctr_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/containers" diff --git a/pkg/daprrp/setup/setup_test.go b/pkg/daprrp/setup/setup_test.go index d12e79dee4..8e3d0097e7 100644 --- a/pkg/daprrp/setup/setup_test.go +++ b/pkg/daprrp/setup/setup_test.go @@ -30,9 +30,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/builder" apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/inmemory" dapr_ctrl "github.com/radius-project/radius/pkg/daprrp/frontend/controller" "github.com/radius-project/radius/pkg/recipes/controllerconfig" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" ) var handlerTests = []rpctest.HandlerTestSpec{ diff --git a/pkg/datastoresrp/frontend/controller/mongodatabases/listsecretsmongodatabase_test.go b/pkg/datastoresrp/frontend/controller/mongodatabases/listsecretsmongodatabase_test.go index 938b08d255..f1e0240728 100644 --- a/pkg/datastoresrp/frontend/controller/mongodatabases/listsecretsmongodatabase_test.go +++ b/pkg/datastoresrp/frontend/controller/mongodatabases/listsecretsmongodatabase_test.go @@ -27,9 +27,9 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/datastoresrp/api/v20231001preview" "github.com/radius-project/radius/pkg/portableresources/renderers" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache.go b/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache.go index 89cd7a91ec..fe83298a49 100644 --- a/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache.go +++ b/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache.go @@ -24,10 +24,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/datastoresrp/datamodel" "github.com/radius-project/radius/pkg/datastoresrp/datamodel/converter" "github.com/radius-project/radius/pkg/portableresources/renderers" - "github.com/radius-project/radius/pkg/ucp/database" ) var _ ctrl.Controller = (*ListSecretsRedisCache)(nil) diff --git a/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache_test.go b/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache_test.go index 903baac905..e11e4d141e 100644 --- a/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache_test.go +++ b/pkg/datastoresrp/frontend/controller/rediscaches/listsecretsrediscache_test.go @@ -27,9 +27,9 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/datastoresrp/api/v20231001preview" "github.com/radius-project/radius/pkg/portableresources/renderers" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/datastoresrp/frontend/controller/sqldatabases/listsecretssqldatabase_test.go b/pkg/datastoresrp/frontend/controller/sqldatabases/listsecretssqldatabase_test.go index cdd3e8bfeb..925f5b24b4 100644 --- a/pkg/datastoresrp/frontend/controller/sqldatabases/listsecretssqldatabase_test.go +++ b/pkg/datastoresrp/frontend/controller/sqldatabases/listsecretssqldatabase_test.go @@ -27,8 +27,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/datastoresrp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/datastoresrp/setup/setup_test.go b/pkg/datastoresrp/setup/setup_test.go index 918e98e79e..97c31480cb 100644 --- a/pkg/datastoresrp/setup/setup_test.go +++ b/pkg/datastoresrp/setup/setup_test.go @@ -30,9 +30,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/builder" apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/inmemory" ds_ctrl "github.com/radius-project/radius/pkg/datastoresrp/frontend/controller" "github.com/radius-project/radius/pkg/recipes/controllerconfig" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" ) var handlerTests = []rpctest.HandlerTestSpec{ diff --git a/pkg/dynamicrp/config.go b/pkg/dynamicrp/config.go index 41ffacdbe8..7cda77cf6e 100644 --- a/pkg/dynamicrp/config.go +++ b/pkg/dynamicrp/config.go @@ -20,13 +20,13 @@ import ( "bytes" "github.com/radius-project/radius/pkg/armrpc/hostoptions" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" metricsprovider "github.com/radius-project/radius/pkg/metrics/provider" profilerprovider "github.com/radius-project/radius/pkg/profiler/provider" "github.com/radius-project/radius/pkg/trace" ucpconfig "github.com/radius-project/radius/pkg/ucp/config" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" "gopkg.in/yaml.v3" ) diff --git a/pkg/dynamicrp/options.go b/pkg/dynamicrp/options.go index 8d046c9132..4ebaf80a1a 100644 --- a/pkg/dynamicrp/options.go +++ b/pkg/dynamicrp/options.go @@ -22,13 +22,13 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/hostoptions" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/kubeutil" "github.com/radius-project/radius/pkg/recipes/controllerconfig" "github.com/radius-project/radius/pkg/sdk" ucpconfig "github.com/radius-project/radius/pkg/ucp/config" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" kube_rest "k8s.io/client-go/rest" ) diff --git a/pkg/dynamicrp/server/server.go b/pkg/dynamicrp/server/server.go index 288737c780..ff3fc804b5 100644 --- a/pkg/dynamicrp/server/server.go +++ b/pkg/dynamicrp/server/server.go @@ -19,6 +19,7 @@ package server import ( "time" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" "github.com/radius-project/radius/pkg/dynamicrp" "github.com/radius-project/radius/pkg/dynamicrp/backend" "github.com/radius-project/radius/pkg/dynamicrp/frontend" @@ -26,7 +27,6 @@ import ( profilerservice "github.com/radius-project/radius/pkg/profiler/service" "github.com/radius-project/radius/pkg/trace" "github.com/radius-project/radius/pkg/ucp/data" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/hosting" ) diff --git a/pkg/messagingrp/frontend/controller/rabbitmqqueues/listsecretsrabbitmq_test.go b/pkg/messagingrp/frontend/controller/rabbitmqqueues/listsecretsrabbitmq_test.go index de0bf25c2d..a0aa3d890e 100644 --- a/pkg/messagingrp/frontend/controller/rabbitmqqueues/listsecretsrabbitmq_test.go +++ b/pkg/messagingrp/frontend/controller/rabbitmqqueues/listsecretsrabbitmq_test.go @@ -26,9 +26,9 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/messagingrp/api/v20231001preview" "github.com/radius-project/radius/pkg/portableresources/renderers" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/messagingrp/setup/setup_test.go b/pkg/messagingrp/setup/setup_test.go index 48573e2e62..93f5ad0f2b 100644 --- a/pkg/messagingrp/setup/setup_test.go +++ b/pkg/messagingrp/setup/setup_test.go @@ -27,9 +27,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/builder" apictrl "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/inmemory" msg_ctrl "github.com/radius-project/radius/pkg/messagingrp/frontend/controller" "github.com/radius-project/radius/pkg/recipes/controllerconfig" - "github.com/radius-project/radius/pkg/ucp/database/inmemory" ) var handlerTests = []rpctest.HandlerTestSpec{ diff --git a/pkg/portableresources/backend/controller/createorupdateresource.go b/pkg/portableresources/backend/controller/createorupdateresource.go index 028933421a..4cb1c162c6 100644 --- a/pkg/portableresources/backend/controller/createorupdateresource.go +++ b/pkg/portableresources/backend/controller/createorupdateresource.go @@ -22,6 +22,7 @@ import ( "fmt" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/portableresources/datamodel" "github.com/radius-project/radius/pkg/portableresources/processors" "github.com/radius-project/radius/pkg/recipes" @@ -29,7 +30,6 @@ import ( "github.com/radius-project/radius/pkg/recipes/engine" "github.com/radius-project/radius/pkg/recipes/util" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/portableresources/backend/controller/createorupdateresource_test.go b/pkg/portableresources/backend/controller/createorupdateresource_test.go index 584ddd3632..cc1ab85aba 100644 --- a/pkg/portableresources/backend/controller/createorupdateresource_test.go +++ b/pkg/portableresources/backend/controller/createorupdateresource_test.go @@ -29,6 +29,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/portableresources/datamodel" "github.com/radius-project/radius/pkg/portableresources/processors" @@ -37,7 +38,6 @@ import ( "github.com/radius-project/radius/pkg/recipes/controllerconfig" "github.com/radius-project/radius/pkg/recipes/engine" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/portableresources/backend/controller/deleteresource_test.go b/pkg/portableresources/backend/controller/deleteresource_test.go index ec1c021918..89fd05c376 100644 --- a/pkg/portableresources/backend/controller/deleteresource_test.go +++ b/pkg/portableresources/backend/controller/deleteresource_test.go @@ -25,12 +25,12 @@ import ( "github.com/google/uuid" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/configloader" "github.com/radius-project/radius/pkg/recipes/engine" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/recipes/controllerconfig/config.go b/pkg/recipes/controllerconfig/config.go index a6ca537506..e2f60fc312 100644 --- a/pkg/recipes/controllerconfig/config.go +++ b/pkg/recipes/controllerconfig/config.go @@ -21,6 +21,7 @@ import ( "github.com/radius-project/radius/pkg/armrpc/hostoptions" aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/kubeutil" "github.com/radius-project/radius/pkg/portableresources/processors" "github.com/radius-project/radius/pkg/recipes" @@ -29,7 +30,6 @@ import ( "github.com/radius-project/radius/pkg/recipes/engine" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/sdk/clients" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) // RecipeControllerConfig is the configuration for the controllers which uses recipe. diff --git a/pkg/recipes/driver/terraform.go b/pkg/recipes/driver/terraform.go index 109af10211..72387a4b8f 100644 --- a/pkg/recipes/driver/terraform.go +++ b/pkg/recipes/driver/terraform.go @@ -27,6 +27,7 @@ import ( "github.com/google/uuid" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "golang.org/x/exp/slices" "k8s.io/client-go/kubernetes" @@ -38,7 +39,6 @@ import ( resources "github.com/radius-project/radius/pkg/ucp/resources" awsresources "github.com/radius-project/radius/pkg/ucp/resources/aws" kubernetesresources "github.com/radius-project/radius/pkg/ucp/resources/kubernetes" - ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" "github.com/radius-project/radius/pkg/ucp/util" @@ -48,7 +48,7 @@ import ( var _ Driver = (*terraformDriver)(nil) // NewTerraformDriver creates a new instance of driver to execute a Terraform recipe. -func NewTerraformDriver(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider, options TerraformOptions, k8sClientSet kubernetes.Interface) Driver { +func NewTerraformDriver(ucpConn sdk.Connection, secretProvider *secretprovider.SecretProvider, options TerraformOptions, k8sClientSet kubernetes.Interface) Driver { return &terraformDriver{ terraformExecutor: terraform.NewExecutor(ucpConn, secretProvider, k8sClientSet), options: options, diff --git a/pkg/recipes/terraform/config/providers/aws.go b/pkg/recipes/terraform/config/providers/aws.go index 228ee7263c..c9500b2d44 100644 --- a/pkg/recipes/terraform/config/providers/aws.go +++ b/pkg/recipes/terraform/config/providers/aws.go @@ -25,14 +25,14 @@ import ( ucp_datamodel "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/azure/tokencredentials" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/ucp/credentials" "github.com/radius-project/radius/pkg/ucp/resources" resources_aws "github.com/radius-project/radius/pkg/ucp/resources/aws" - "github.com/radius-project/radius/pkg/ucp/secret" - ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" ) @@ -61,11 +61,11 @@ var _ Provider = (*awsProvider)(nil) type awsProvider struct { ucpConn sdk.Connection - secretProvider *ucp_provider.SecretProvider + secretProvider *secretprovider.SecretProvider } // NewAWSProvider creates a new AWSProvider instance. -func NewAWSProvider(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider) Provider { +func NewAWSProvider(ucpConn sdk.Connection, secretProvider *secretprovider.SecretProvider) Provider { return &awsProvider{ucpConn: ucpConn, secretProvider: secretProvider} } diff --git a/pkg/recipes/terraform/config/providers/aws_test.go b/pkg/recipes/terraform/config/providers/aws_test.go index 79ecfd44c6..1d11865a8a 100644 --- a/pkg/recipes/terraform/config/providers/aws_test.go +++ b/pkg/recipes/terraform/config/providers/aws_test.go @@ -25,9 +25,9 @@ import ( "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/sdk" + "github.com/radius-project/radius/pkg/components/secret" ucp_credentials "github.com/radius-project/radius/pkg/ucp/credentials" ucp_datamodel "github.com/radius-project/radius/pkg/ucp/datamodel" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" ) diff --git a/pkg/recipes/terraform/config/providers/azure.go b/pkg/recipes/terraform/config/providers/azure.go index 5ac32cef3d..2a97b8f0e3 100644 --- a/pkg/recipes/terraform/config/providers/azure.go +++ b/pkg/recipes/terraform/config/providers/azure.go @@ -22,6 +22,8 @@ import ( "fmt" "github.com/radius-project/radius/pkg/azure/tokencredentials" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/sdk" @@ -29,8 +31,6 @@ import ( ucp_datamodel "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" resources_azure "github.com/radius-project/radius/pkg/ucp/resources/azure" - "github.com/radius-project/radius/pkg/ucp/secret" - ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" ) @@ -59,11 +59,11 @@ var _ Provider = (*azureProvider)(nil) type azureProvider struct { ucpConn sdk.Connection - secretProvider *ucp_provider.SecretProvider + secretProvider *secretprovider.SecretProvider } // NewAzureProvider creates a new AzureProvider instance. -func NewAzureProvider(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider) Provider { +func NewAzureProvider(ucpConn sdk.Connection, secretProvider *secretprovider.SecretProvider) Provider { return &azureProvider{ucpConn: ucpConn, secretProvider: secretProvider} } diff --git a/pkg/recipes/terraform/config/providers/azure_test.go b/pkg/recipes/terraform/config/providers/azure_test.go index f930866a7e..ebb9e01fc6 100644 --- a/pkg/recipes/terraform/config/providers/azure_test.go +++ b/pkg/recipes/terraform/config/providers/azure_test.go @@ -21,11 +21,11 @@ import ( "errors" "testing" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/sdk" ucp_credentials "github.com/radius-project/radius/pkg/ucp/credentials" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" ) diff --git a/pkg/recipes/terraform/config/providers/types.go b/pkg/recipes/terraform/config/providers/types.go index 349d93839c..f48950cb17 100644 --- a/pkg/recipes/terraform/config/providers/types.go +++ b/pkg/recipes/terraform/config/providers/types.go @@ -20,10 +20,10 @@ import ( "context" "fmt" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/sdk" - ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) //go:generate mockgen -typed -destination=./mock_provider.go -package=providers -self_package github.com/radius-project/radius/pkg/recipes/terraform/config/providers github.com/radius-project/radius/pkg/recipes/terraform/config/providers Provider @@ -39,7 +39,7 @@ type Provider interface { // GetUCPConfiguredTerraformProviders returns a map of Terraform provider names to provider config builder. // These providers represent Terraform providers for which Radius generates custom provider configurations based on credentials stored with UCP // and providers configured on the Radius environment. For example, the Azure subscription id is added to Azure provider config using Radius Environment's Azure provider scope. -func GetUCPConfiguredTerraformProviders(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider) map[string]Provider { +func GetUCPConfiguredTerraformProviders(ucpConn sdk.Connection, secretProvider *secretprovider.SecretProvider) map[string]Provider { return map[string]Provider{ AWSProviderName: NewAWSProvider(ucpConn, secretProvider), AzureProviderName: NewAzureProvider(ucpConn, secretProvider), diff --git a/pkg/recipes/terraform/execute.go b/pkg/recipes/terraform/execute.go index 9e0c88d7e2..464e9b512d 100644 --- a/pkg/recipes/terraform/execute.go +++ b/pkg/recipes/terraform/execute.go @@ -27,13 +27,13 @@ import ( install "github.com/hashicorp/hc-install" "github.com/hashicorp/terraform-exec/tfexec" tfjson "github.com/hashicorp/terraform-json" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/metrics" "github.com/radius-project/radius/pkg/recipes/recipecontext" "github.com/radius-project/radius/pkg/recipes/terraform/config" "github.com/radius-project/radius/pkg/recipes/terraform/config/backends" "github.com/radius-project/radius/pkg/recipes/terraform/config/providers" "github.com/radius-project/radius/pkg/sdk" - ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" "go.opentelemetry.io/otel/attribute" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -48,7 +48,7 @@ var ( var _ TerraformExecutor = (*executor)(nil) // NewExecutor creates a new Executor with the given UCP connection and secret provider, to execute a Terraform recipe. -func NewExecutor(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider, k8sClientSet kubernetes.Interface) *executor { +func NewExecutor(ucpConn sdk.Connection, secretProvider *secretprovider.SecretProvider, k8sClientSet kubernetes.Interface) *executor { return &executor{ucpConn: ucpConn, secretProvider: secretProvider, k8sClientSet: k8sClientSet} } @@ -57,7 +57,7 @@ type executor struct { ucpConn sdk.Connection // secretProvider is the secret store provider used for managing credentials in UCP. - secretProvider *ucp_provider.SecretProvider + secretProvider *secretprovider.SecretProvider // k8sClientSet is the Kubernetes client. k8sClientSet kubernetes.Interface diff --git a/pkg/rp/kube/resources.go b/pkg/rp/kube/resources.go index 85c7e94ce7..d88574fbd0 100644 --- a/pkg/rp/kube/resources.go +++ b/pkg/rp/kube/resources.go @@ -22,10 +22,10 @@ import ( "strings" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" cdm "github.com/radius-project/radius/pkg/corerp/datamodel" rpv1 "github.com/radius-project/radius/pkg/rp/v1" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/rp/kube/resources_test.go b/pkg/rp/kube/resources_test.go index 2c69d6d9a1..d2ba20aca9 100644 --- a/pkg/rp/kube/resources_test.go +++ b/pkg/rp/kube/resources_test.go @@ -22,11 +22,11 @@ import ( "testing" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + "github.com/radius-project/radius/pkg/components/database" model "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/corerp/datamodel" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/rp/util/datastore.go b/pkg/rp/util/datastore.go index 82ce79afd2..fa1ccbc47d 100644 --- a/pkg/rp/util/datastore.go +++ b/pkg/rp/util/datastore.go @@ -23,7 +23,7 @@ import ( "strings" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" resources "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess.go b/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess.go index 3f7ba1c87b..060e28e663 100644 --- a/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess.go +++ b/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess.go @@ -25,7 +25,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/frontend/controller/resourcegroups" "github.com/radius-project/radius/pkg/ucp/resources" diff --git a/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess_test.go b/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess_test.go index aaee56c4ca..9ee2929d5f 100644 --- a/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess_test.go +++ b/pkg/ucp/backend/controller/resourcegroups/trackedresourceprocess_test.go @@ -23,7 +23,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/trackedresource" diff --git a/pkg/ucp/backend/controller/resourceproviders/resourceprovider_delete.go b/pkg/ucp/backend/controller/resourceproviders/resourceprovider_delete.go index 450aa29261..66a030540d 100644 --- a/pkg/ucp/backend/controller/resourceproviders/resourceprovider_delete.go +++ b/pkg/ucp/backend/controller/resourceproviders/resourceprovider_delete.go @@ -23,9 +23,9 @@ import ( ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/resources" resources_radius "github.com/radius-project/radius/pkg/ucp/resources/radius" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/ucp/backend/controller/resourceproviders/util.go b/pkg/ucp/backend/controller/resourceproviders/util.go index 4e1ea46ccd..25149ef19f 100644 --- a/pkg/ucp/backend/controller/resourceproviders/util.go +++ b/pkg/ucp/backend/controller/resourceproviders/util.go @@ -23,7 +23,7 @@ import ( "strings" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/ucp/backend/controller/resourceproviders/util_test.go b/pkg/ucp/backend/controller/resourceproviders/util_test.go index 656be012f4..b5c508c0b7 100644 --- a/pkg/ucp/backend/controller/resourceproviders/util_test.go +++ b/pkg/ucp/backend/controller/resourceproviders/util_test.go @@ -21,7 +21,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" diff --git a/pkg/ucp/credentials/aws.go b/pkg/ucp/credentials/aws.go index 1fa8e52e95..629fb00b0b 100644 --- a/pkg/ucp/credentials/aws.go +++ b/pkg/ucp/credentials/aws.go @@ -22,11 +22,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/to" ucpapi "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/secret" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) var _ CredentialProvider[AWSCredential] = (*AWSCredentialProvider)(nil) diff --git a/pkg/ucp/credentials/azure.go b/pkg/ucp/credentials/azure.go index 4d9e773564..8358e1fbba 100644 --- a/pkg/ucp/credentials/azure.go +++ b/pkg/ucp/credentials/azure.go @@ -22,11 +22,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/to" ucpapi "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/secret" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) var _ CredentialProvider[AzureCredential] = (*AzureCredentialProvider)(nil) diff --git a/pkg/ucp/frontend/api/routes_test.go b/pkg/ucp/frontend/api/routes_test.go index 9833f0733e..46ee16b30c 100644 --- a/pkg/ucp/frontend/api/routes_test.go +++ b/pkg/ucp/frontend/api/routes_test.go @@ -25,7 +25,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" diff --git a/pkg/ucp/frontend/api/server.go b/pkg/ucp/frontend/api/server.go index 99e31911ed..bd851d967a 100644 --- a/pkg/ucp/frontend/api/server.go +++ b/pkg/ucp/frontend/api/server.go @@ -30,9 +30,11 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/frontend/defaultoperation" "github.com/radius-project/radius/pkg/armrpc/servicecontext" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/middleware" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" aws_frontend "github.com/radius-project/radius/pkg/ucp/frontend/aws" @@ -42,10 +44,8 @@ import ( "github.com/radius-project/radius/pkg/ucp/frontend/versions" "github.com/radius-project/radius/pkg/ucp/hosting" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/rest" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" "github.com/radius-project/radius/pkg/validator" "github.com/radius-project/radius/swagger" diff --git a/pkg/ucp/frontend/aws/routes_test.go b/pkg/ucp/frontend/aws/routes_test.go index 634b2fd23f..8d65dfa39a 100644 --- a/pkg/ucp/frontend/aws/routes_test.go +++ b/pkg/ucp/frontend/aws/routes_test.go @@ -27,13 +27,13 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/secret" - secretprovider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) const pathBase = "/some-path-base" diff --git a/pkg/ucp/frontend/azure/routes_test.go b/pkg/ucp/frontend/azure/routes_test.go index 57109e5e08..818031e22c 100644 --- a/pkg/ucp/frontend/azure/routes_test.go +++ b/pkg/ucp/frontend/azure/routes_test.go @@ -27,13 +27,13 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/secret" - secretprovider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" ) const pathBase = "/some-path-base" diff --git a/pkg/ucp/frontend/controller/awsproxy/awsproxytest.go b/pkg/ucp/frontend/controller/awsproxy/awsproxytest.go index c5f05ead31..51761904a4 100644 --- a/pkg/ucp/frontend/controller/awsproxy/awsproxytest.go +++ b/pkg/ucp/frontend/controller/awsproxy/awsproxytest.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "go.uber.org/mock/gomock" awsclient "github.com/radius-project/radius/pkg/ucp/aws" diff --git a/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential.go b/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential.go index 9fd2ea5433..ecf12bf725 100644 --- a/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential.go +++ b/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential.go @@ -22,10 +22,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/frontend/controller/credentials" - "github.com/radius-project/radius/pkg/ucp/secret" ) var _ armrpc_controller.Controller = (*CreateOrUpdateAWSCredential)(nil) diff --git a/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential_test.go b/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential_test.go index 0e590c45cf..cab95b7ebb 100644 --- a/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential_test.go +++ b/pkg/ucp/frontend/controller/credentials/aws/createorupdateawscredential_test.go @@ -25,10 +25,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/test/testutil" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" diff --git a/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential.go b/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential.go index eaa9d9c7f7..ea5608c5c8 100644 --- a/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential.go +++ b/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential.go @@ -24,11 +24,11 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpcrest "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/frontend/controller/credentials" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential_test.go b/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential_test.go index 223ff65c2a..760c6094b0 100644 --- a/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential_test.go +++ b/pkg/ucp/frontend/controller/credentials/aws/deleteawscredential_test.go @@ -25,9 +25,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpcrest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential.go b/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential.go index 40dd59fe36..32ebdc4e47 100644 --- a/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential.go +++ b/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential.go @@ -22,10 +22,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/frontend/controller/credentials" - "github.com/radius-project/radius/pkg/ucp/secret" ) var _ armrpc_controller.Controller = (*CreateOrUpdateAzureCredential)(nil) diff --git a/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential_test.go b/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential_test.go index 1889ede636..4cbeb86292 100644 --- a/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential_test.go +++ b/pkg/ucp/frontend/controller/credentials/azure/createorupdateazurecredential_test.go @@ -25,10 +25,10 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/test/testutil" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" diff --git a/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential.go b/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential.go index 09f1b3025f..89c49fad9a 100644 --- a/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential.go +++ b/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential.go @@ -24,11 +24,11 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/frontend/controller/credentials" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential_test.go b/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential_test.go index 046c54d985..9bcc09634d 100644 --- a/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential_test.go +++ b/pkg/ucp/frontend/controller/credentials/azure/deleteazurecredential_test.go @@ -25,9 +25,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" "github.com/radius-project/radius/pkg/ucp/datamodel" - "github.com/radius-project/radius/pkg/ucp/secret" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/pkg/ucp/frontend/controller/planes/listplanes.go b/pkg/ucp/frontend/controller/planes/listplanes.go index a90a1c9e5f..b09dcd7590 100644 --- a/pkg/ucp/frontend/controller/planes/listplanes.go +++ b/pkg/ucp/frontend/controller/planes/listplanes.go @@ -23,7 +23,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/ucp/frontend/controller/planes/listplanes_test.go b/pkg/ucp/frontend/controller/planes/listplanes_test.go index aac6c6d086..a6590359e4 100644 --- a/pkg/ucp/frontend/controller/planes/listplanes_test.go +++ b/pkg/ucp/frontend/controller/planes/listplanes_test.go @@ -23,9 +23,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/pkg/ucp/frontend/controller/planes/listplanesbytype.go b/pkg/ucp/frontend/controller/planes/listplanesbytype.go index c5dda15396..ff4c764a20 100644 --- a/pkg/ucp/frontend/controller/planes/listplanesbytype.go +++ b/pkg/ucp/frontend/controller/planes/listplanesbytype.go @@ -25,8 +25,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/middleware" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/ucp/frontend/controller/planes/listplanesbytype_test.go b/pkg/ucp/frontend/controller/planes/listplanesbytype_test.go index e426a6255b..0b4a5c3acd 100644 --- a/pkg/ucp/frontend/controller/planes/listplanesbytype_test.go +++ b/pkg/ucp/frontend/controller/planes/listplanesbytype_test.go @@ -23,9 +23,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/stretchr/testify/require" diff --git a/pkg/ucp/frontend/controller/radius/proxy.go b/pkg/ucp/frontend/controller/radius/proxy.go index 25fff5ea23..43c157a21b 100644 --- a/pkg/ucp/frontend/controller/radius/proxy.go +++ b/pkg/ucp/frontend/controller/radius/proxy.go @@ -30,8 +30,8 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/middleware" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/frontend/controller/resourcegroups" "github.com/radius-project/radius/pkg/ucp/proxy" diff --git a/pkg/ucp/frontend/controller/radius/proxy_test.go b/pkg/ucp/frontend/controller/radius/proxy_test.go index aeb5d4d4d5..063105e599 100644 --- a/pkg/ucp/frontend/controller/radius/proxy_test.go +++ b/pkg/ucp/frontend/controller/radius/proxy_test.go @@ -28,7 +28,7 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" "github.com/radius-project/radius/pkg/armrpc/frontend/controller" "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/trackedresource" diff --git a/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups.go b/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups.go index 58cf0dd321..0e9efd33ba 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups.go +++ b/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups.go @@ -23,7 +23,7 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/resources" diff --git a/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups_test.go b/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups_test.go index ce7b87ce8b..716317ba8e 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups_test.go +++ b/pkg/ucp/frontend/controller/resourcegroups/listresourcegroups_test.go @@ -27,9 +27,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" ) diff --git a/pkg/ucp/frontend/controller/resourcegroups/listresources.go b/pkg/ucp/frontend/controller/resourcegroups/listresources.go index 66a3cb6b66..be04b63073 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/listresources.go +++ b/pkg/ucp/frontend/controller/resourcegroups/listresources.go @@ -23,9 +23,9 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/middleware" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/resources" diff --git a/pkg/ucp/frontend/controller/resourcegroups/listresources_test.go b/pkg/ucp/frontend/controller/resourcegroups/listresources_test.go index 35e58eb8d8..9b2a5178aa 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/listresources_test.go +++ b/pkg/ucp/frontend/controller/resourcegroups/listresources_test.go @@ -27,9 +27,9 @@ import ( armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" ) diff --git a/pkg/ucp/frontend/controller/resourcegroups/util.go b/pkg/ucp/frontend/controller/resourcegroups/util.go index 4edbef9f96..a1e012208f 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/util.go +++ b/pkg/ucp/frontend/controller/resourcegroups/util.go @@ -23,7 +23,7 @@ import ( "net/url" "strings" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" resources_radius "github.com/radius-project/radius/pkg/ucp/resources/radius" diff --git a/pkg/ucp/frontend/controller/resourcegroups/util_test.go b/pkg/ucp/frontend/controller/resourcegroups/util_test.go index 7def6c8b60..3512294633 100644 --- a/pkg/ucp/frontend/controller/resourcegroups/util_test.go +++ b/pkg/ucp/frontend/controller/resourcegroups/util_test.go @@ -22,8 +22,8 @@ import ( "testing" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/test/testcontext" diff --git a/pkg/ucp/frontend/controller/resourceproviders/getresourceprovidersummary.go b/pkg/ucp/frontend/controller/resourceproviders/getresourceprovidersummary.go index a1b5b638a4..21ec860164 100644 --- a/pkg/ucp/frontend/controller/resourceproviders/getresourceprovidersummary.go +++ b/pkg/ucp/frontend/controller/resourceproviders/getresourceprovidersummary.go @@ -25,8 +25,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/middleware" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/resources" diff --git a/pkg/ucp/frontend/controller/resourceproviders/listresourceprovidersummaries.go b/pkg/ucp/frontend/controller/resourceproviders/listresourceprovidersummaries.go index f50570b755..0be6d7a366 100644 --- a/pkg/ucp/frontend/controller/resourceproviders/listresourceprovidersummaries.go +++ b/pkg/ucp/frontend/controller/resourceproviders/listresourceprovidersummaries.go @@ -24,8 +24,8 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" armrpc_controller "github.com/radius-project/radius/pkg/armrpc/frontend/controller" armrpc_rest "github.com/radius-project/radius/pkg/armrpc/rest" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/middleware" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/datamodel/converter" "github.com/radius-project/radius/pkg/ucp/resources" diff --git a/pkg/ucp/frontend/modules/types.go b/pkg/ucp/frontend/modules/types.go index 2c959df585..3e1638302f 100644 --- a/pkg/ucp/frontend/modules/types.go +++ b/pkg/ucp/frontend/modules/types.go @@ -21,11 +21,11 @@ import ( "net/http" "github.com/radius-project/radius/pkg/armrpc/asyncoperation/statusmanager" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/validator" ) diff --git a/pkg/ucp/frontend/radius/routes_test.go b/pkg/ucp/frontend/radius/routes_test.go index ac6f6e8be5..8bca6bf56f 100644 --- a/pkg/ucp/frontend/radius/routes_test.go +++ b/pkg/ucp/frontend/radius/routes_test.go @@ -24,13 +24,13 @@ import ( "github.com/go-chi/chi/v5" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/armrpc/rpctest" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/secret" - secretprovider "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "go.uber.org/mock/gomock" ) diff --git a/pkg/ucp/hostoptions/providerconfig.go b/pkg/ucp/hostoptions/providerconfig.go index 3f615a0c98..30729336f0 100644 --- a/pkg/ucp/hostoptions/providerconfig.go +++ b/pkg/ucp/hostoptions/providerconfig.go @@ -17,14 +17,14 @@ limitations under the License. package hostoptions import ( + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" metricsprovider "github.com/radius-project/radius/pkg/metrics/provider" profilerprovider "github.com/radius-project/radius/pkg/profiler/provider" "github.com/radius-project/radius/pkg/trace" "github.com/radius-project/radius/pkg/ucp/config" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/pkg/ucp/rest" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" ) diff --git a/pkg/ucp/integrationtests/aws/awstest.go b/pkg/ucp/integrationtests/aws/awstest.go index 6be034b1c5..bca5b13119 100644 --- a/pkg/ucp/integrationtests/aws/awstest.go +++ b/pkg/ucp/integrationtests/aws/awstest.go @@ -21,12 +21,12 @@ package aws import ( "testing" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/secret" ucp_aws "github.com/radius-project/radius/pkg/ucp/aws" - "github.com/radius-project/radius/pkg/ucp/database" ucp_aws_frontend "github.com/radius-project/radius/pkg/ucp/frontend/aws" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/pkg/ucp/integrationtests/testserver" - "github.com/radius-project/radius/pkg/ucp/secret" "go.uber.org/mock/gomock" ) diff --git a/pkg/ucp/integrationtests/testrp/async.go b/pkg/ucp/integrationtests/testrp/async.go index 1af3838fb5..1fbcac1098 100644 --- a/pkg/ucp/integrationtests/testrp/async.go +++ b/pkg/ucp/integrationtests/testrp/async.go @@ -31,9 +31,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/frontend/defaultoperation" "github.com/radius-project/radius/pkg/armrpc/frontend/server" "github.com/radius-project/radius/pkg/armrpc/servicecontext" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" "github.com/radius-project/radius/pkg/middleware" "github.com/radius-project/radius/pkg/ucp/integrationtests/testserver" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" ) diff --git a/pkg/ucp/integrationtests/testrp/sync.go b/pkg/ucp/integrationtests/testrp/sync.go index 94b4d9af7b..8adcf7e1cd 100644 --- a/pkg/ucp/integrationtests/testrp/sync.go +++ b/pkg/ucp/integrationtests/testrp/sync.go @@ -28,9 +28,9 @@ import ( "github.com/radius-project/radius/pkg/armrpc/frontend/defaultoperation" "github.com/radius-project/radius/pkg/armrpc/frontend/server" "github.com/radius-project/radius/pkg/armrpc/servicecontext" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" "github.com/radius-project/radius/pkg/middleware" "github.com/radius-project/radius/pkg/ucp/integrationtests/testserver" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" ) diff --git a/pkg/ucp/integrationtests/testserver/testserver.go b/pkg/ucp/integrationtests/testserver/testserver.go index 8643c3f839..9c59873171 100644 --- a/pkg/ucp/integrationtests/testserver/testserver.go +++ b/pkg/ucp/integrationtests/testserver/testserver.go @@ -44,20 +44,20 @@ import ( "github.com/radius-project/radius/pkg/armrpc/asyncoperation/worker" "github.com/radius-project/radius/pkg/armrpc/rpctest" "github.com/radius-project/radius/pkg/armrpc/servicecontext" + "github.com/radius-project/radius/pkg/components/database" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/middleware" "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/ucp/backend" "github.com/radius-project/radius/pkg/ucp/data" - "github.com/radius-project/radius/pkg/ucp/database" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/frontend/api" "github.com/radius-project/radius/pkg/ucp/frontend/modules" "github.com/radius-project/radius/pkg/ucp/hosting" "github.com/radius-project/radius/pkg/ucp/hostoptions" - queue "github.com/radius-project/radius/pkg/ucp/queue/client" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" - "github.com/radius-project/radius/pkg/ucp/secret" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/server" "github.com/radius-project/radius/pkg/validator" "github.com/radius-project/radius/swagger" diff --git a/pkg/ucp/server/server.go b/pkg/ucp/server/server.go index 5759bc2959..375497a1cb 100644 --- a/pkg/ucp/server/server.go +++ b/pkg/ucp/server/server.go @@ -24,6 +24,9 @@ import ( "time" hostopts "github.com/radius-project/radius/pkg/armrpc/hostoptions" + "github.com/radius-project/radius/pkg/components/database/databaseprovider" + "github.com/radius-project/radius/pkg/components/queue/queueprovider" + "github.com/radius-project/radius/pkg/components/secret/secretprovider" "github.com/radius-project/radius/pkg/kubeutil" metricsprovider "github.com/radius-project/radius/pkg/metrics/provider" metricsservice "github.com/radius-project/radius/pkg/metrics/service" @@ -34,13 +37,10 @@ import ( "github.com/radius-project/radius/pkg/ucp/backend" "github.com/radius-project/radius/pkg/ucp/config" "github.com/radius-project/radius/pkg/ucp/data" - "github.com/radius-project/radius/pkg/ucp/databaseprovider" "github.com/radius-project/radius/pkg/ucp/frontend/api" "github.com/radius-project/radius/pkg/ucp/hosting" "github.com/radius-project/radius/pkg/ucp/hostoptions" - "github.com/radius-project/radius/pkg/ucp/queue/queueprovider" "github.com/radius-project/radius/pkg/ucp/rest" - "github.com/radius-project/radius/pkg/ucp/secret/secretprovider" "github.com/radius-project/radius/pkg/ucp/ucplog" kube_rest "k8s.io/client-go/rest" diff --git a/pkg/ucp/trackedresource/update.go b/pkg/ucp/trackedresource/update.go index 813d4273ed..cfa567888d 100644 --- a/pkg/ucp/trackedresource/update.go +++ b/pkg/ucp/trackedresource/update.go @@ -29,7 +29,7 @@ import ( "github.com/go-logr/logr" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/ucplog" diff --git a/pkg/ucp/trackedresource/update_test.go b/pkg/ucp/trackedresource/update_test.go index 2a2c475cc9..5e3ebe9213 100644 --- a/pkg/ucp/trackedresource/update_test.go +++ b/pkg/ucp/trackedresource/update_test.go @@ -27,8 +27,8 @@ import ( "time" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/database" "github.com/radius-project/radius/pkg/ucp/datamodel" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" diff --git a/test/ucp/kubeenv/testenv.go b/test/ucp/kubeenv/testenv.go index 2c78248704..04ad83c807 100644 --- a/test/ucp/kubeenv/testenv.go +++ b/test/ucp/kubeenv/testenv.go @@ -23,7 +23,7 @@ import ( "os" "os/exec" - ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/database/apiserverstore/api/ucp.dev/v1alpha1" + ucpv1alpha1 "github.com/radius-project/radius/pkg/components/database/apiserverstore/api/ucp.dev/v1alpha1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/test/ucp/queuetest/shared.go b/test/ucp/queuetest/shared.go index dbe640e06f..2bd0214871 100644 --- a/test/ucp/queuetest/shared.go +++ b/test/ucp/queuetest/shared.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/radius-project/radius/pkg/ucp/queue/client" + "github.com/radius-project/radius/pkg/components/queue" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" ) @@ -42,12 +42,12 @@ type testQueueMessage struct { Message string `json:"msg"` } -func queueTestMessage(cli client.Client, num int) error { +func queueTestMessage(cli queue.Client, num int) error { // Enqueue multiple message and dequeue them for i := 0; i < num; i++ { msg := &testQueueMessage{ID: fmt.Sprintf("%d", i), Message: fmt.Sprintf("hello world %d", i)} - err := cli.Enqueue(context.Background(), client.NewMessage(msg)) + err := cli.Enqueue(context.Background(), queue.NewMessage(msg)) if err != nil { return err } @@ -60,21 +60,21 @@ func queueTestMessage(cli client.Client, num int) error { // and checking for errors when nil messages are passed. It also tests the StartDequeuer method by dequeuing messages via a // // channel. -func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { +func RunTest(t *testing.T, cli queue.Client, clear func(t *testing.T)) { ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) t.Run("nil message", func(t *testing.T) { - err := cli.Enqueue(ctx, &client.Message{Data: []byte("")}) - require.ErrorIs(t, err, client.ErrEmptyMessage) - err = cli.Enqueue(ctx, &client.Message{Data: nil}) - require.ErrorIs(t, err, client.ErrEmptyMessage) + err := cli.Enqueue(ctx, &queue.Message{Data: []byte("")}) + require.ErrorIs(t, err, queue.ErrEmptyMessage) + err = cli.Enqueue(ctx, &queue.Message{Data: nil}) + require.ErrorIs(t, err, queue.ErrEmptyMessage) err = cli.Enqueue(ctx, nil) - require.ErrorIs(t, err, client.ErrEmptyMessage) + require.ErrorIs(t, err, queue.ErrEmptyMessage) err = cli.FinishMessage(ctx, nil) - require.ErrorIs(t, err, client.ErrEmptyMessage) + require.ErrorIs(t, err, queue.ErrEmptyMessage) err = cli.ExtendMessage(ctx, nil) - require.ErrorIs(t, err, client.ErrEmptyMessage) + require.ErrorIs(t, err, queue.ErrEmptyMessage) }) t.Run("enqueue and dequeue messages", func(t *testing.T) { @@ -85,9 +85,9 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { err := queueTestMessage(cli, num) require.NoError(t, err) - checked := map[string]*client.Message{} + checked := map[string]*queue.Message{} for i := 0; i < num; i++ { - msg, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) result := &testQueueMessage{} err = json.Unmarshal(msg.Data, result) @@ -110,24 +110,24 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { err := queueTestMessage(cli, 2) require.NoError(t, err) - msg1, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg1, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) require.NotNil(t, msg1) time.Sleep(10 * time.Millisecond) - msg2, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg2, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) require.NotNil(t, msg2) // Ensure that queue doesn't have any valid messages - _, err = cli.Dequeue(ctx, client.QueueClientConfig{}) - require.ErrorIs(t, err, client.ErrMessageNotFound) + _, err = cli.Dequeue(ctx, queue.QueueClientConfig{}) + require.ErrorIs(t, err, queue.ErrMessageNotFound) // Dequeue until message is requeued. - var msg3 *client.Message + var msg3 *queue.Message for { - msg3, err = cli.Dequeue(ctx, client.QueueClientConfig{}) + msg3, err = cli.Dequeue(ctx, queue.QueueClientConfig{}) if err == nil { break } @@ -143,17 +143,17 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { err := queueTestMessage(cli, 2) require.NoError(t, err) - msg1, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg1, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) t.Logf("%s %v", msg1.ID, msg1.NextVisibleAt) - msg2, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg2, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) t.Logf("%s %v", msg2.ID, msg2.NextVisibleAt) // Ensure that queue doesn't have any valid messages - _, err = cli.Dequeue(ctx, client.QueueClientConfig{}) - require.ErrorIs(t, err, client.ErrMessageNotFound) + _, err = cli.Dequeue(ctx, queue.QueueClientConfig{}) + require.ErrorIs(t, err, queue.ErrMessageNotFound) // Extend msg1 after sometime time.Sleep(TestMessageLockTime / 2) err = cli.ExtendMessage(ctx, msg1) @@ -163,7 +163,7 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { for { // msg2 is requeued. msg3 must be msg2 - msg3, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg3, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) if err == nil { t.Logf("%s %v", msg3.ID, msg3.NextVisibleAt) require.Equal(t, msg2.ID, msg3.ID) @@ -179,18 +179,18 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { err := queueTestMessage(cli, 2) require.NoError(t, err) - msg1, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg1, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) t.Logf("%s %v", msg1.ID, msg1.NextVisibleAt) time.Sleep(TestMessageLockTime / 2) - msg2, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg2, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) require.NoError(t, err) t.Logf("%s %v", msg2.ID, msg2.NextVisibleAt) for { - msg3, err := cli.Dequeue(ctx, client.QueueClientConfig{}) + msg3, err := cli.Dequeue(ctx, queue.QueueClientConfig{}) if err == nil { t.Logf("%s %v", msg3.ID, msg3.NextVisibleAt) break @@ -201,12 +201,12 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { // Wait until message lock is released. time.Sleep(TestMessageLockTime * 2) err = cli.ExtendMessage(ctx, msg2) - require.ErrorIs(t, err, client.ErrInvalidMessage) + require.ErrorIs(t, err, queue.ErrInvalidMessage) }) t.Run("StartDequeuer dequeues message via channel", func(t *testing.T) { clear(t) - msgCh, err := client.StartDequeuer(ctx, cli, client.WithDequeueInterval(defaultTestDequeueInterval)) + msgCh, err := queue.StartDequeuer(ctx, cli, queue.WithDequeueInterval(defaultTestDequeueInterval)) require.NoError(t, err) recvCnt := 0 @@ -215,7 +215,7 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { msgCount := 10 // Consumer - go func(msgCh <-chan *client.Message) { + go func(msgCh <-chan *queue.Message) { for msg := range msgCh { require.Equal(t, 1, msg.DequeueCount) t.Logf("Dequeued Message ID: %s", msg.ID) @@ -230,7 +230,7 @@ func RunTest(t *testing.T, cli client.Client, clear func(t *testing.T)) { // Producer for i := 0; i < msgCount; i++ { msg := &testQueueMessage{ID: fmt.Sprintf("%d", i), Message: fmt.Sprintf("hello world %d", i)} - err = cli.Enqueue(ctx, client.NewMessage(msg)) + err = cli.Enqueue(ctx, queue.NewMessage(msg)) require.NoError(t, err) } diff --git a/test/ucp/storetest/shared.go b/test/ucp/storetest/shared.go index 0ab6e761bb..8b7f11be35 100644 --- a/test/ucp/storetest/shared.go +++ b/test/ucp/storetest/shared.go @@ -21,7 +21,7 @@ import ( "encoding/json" "testing" - "github.com/radius-project/radius/pkg/ucp/database" + "github.com/radius-project/radius/pkg/components/database" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/ucp/util/etag" "github.com/radius-project/radius/test/testcontext"