diff --git a/internal/daemon/controller/handlers/workers/multihop_service.go b/internal/daemon/cluster/handlers/multihop_service.go similarity index 98% rename from internal/daemon/controller/handlers/workers/multihop_service.go rename to internal/daemon/cluster/handlers/multihop_service.go index 9a84ea9f92..ca1bde7620 100644 --- a/internal/daemon/controller/handlers/workers/multihop_service.go +++ b/internal/daemon/cluster/handlers/multihop_service.go @@ -1,4 +1,4 @@ -package workers +package handlers import ( "context" diff --git a/internal/daemon/controller/handlers/workers/worker_service.go b/internal/daemon/cluster/handlers/worker_service.go similarity index 99% rename from internal/daemon/controller/handlers/workers/worker_service.go rename to internal/daemon/cluster/handlers/worker_service.go index cedc1b213e..5940f74c6f 100644 --- a/internal/daemon/controller/handlers/workers/worker_service.go +++ b/internal/daemon/cluster/handlers/worker_service.go @@ -1,4 +1,4 @@ -package workers +package handlers import ( "context" diff --git a/internal/daemon/controller/handlers/workers/worker_service_status_test.go b/internal/daemon/cluster/handlers/worker_service_status_test.go similarity index 97% rename from internal/daemon/controller/handlers/workers/worker_service_status_test.go rename to internal/daemon/cluster/handlers/worker_service_status_test.go index 8e1da49976..5d3fefb721 100644 --- a/internal/daemon/controller/handlers/workers/worker_service_status_test.go +++ b/internal/daemon/cluster/handlers/worker_service_status_test.go @@ -1,4 +1,4 @@ -package workers_test +package handlers_test import ( "context" @@ -8,7 +8,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/boundary/internal/authtoken" - "github.com/hashicorp/boundary/internal/daemon/controller/handlers/workers" + "github.com/hashicorp/boundary/internal/daemon/cluster/handlers" "github.com/hashicorp/boundary/internal/db" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/host/static" @@ -85,7 +85,7 @@ func TestStatus(t *testing.T) { require.NoError(t, err) require.NoError(t, err) - s := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) + s := handlers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) require.NotNil(t, s) connection, _, err := connRepo.AuthorizeConnection(ctx, sess.PublicId, worker1.PublicId) @@ -264,7 +264,7 @@ func TestStatusSessionClosed(t *testing.T) { sess2, _, err = repo.ActivateSession(ctx, sess2.PublicId, sess2.Version, tofu2) require.NoError(t, err) - s := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) + s := handlers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) require.NotNil(t, s) connection, _, err := connRepo.AuthorizeConnection(ctx, sess.PublicId, worker1.PublicId) @@ -445,7 +445,7 @@ func TestStatusDeadConnection(t *testing.T) { sess2, _, err = repo.ActivateSession(ctx, sess2.PublicId, sess2.Version, tofu2) require.NoError(t, err) - s := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) + s := handlers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connRepoFn, new(sync.Map), kms) require.NotNil(t, s) connection, _, err := connRepo.AuthorizeConnection(ctx, sess.PublicId, worker1.PublicId) diff --git a/internal/daemon/controller/handlers/workers/worker_service_test.go b/internal/daemon/cluster/handlers/worker_service_test.go similarity index 96% rename from internal/daemon/controller/handlers/workers/worker_service_test.go rename to internal/daemon/cluster/handlers/worker_service_test.go index 8bd637002c..c5357b7168 100644 --- a/internal/daemon/controller/handlers/workers/worker_service_test.go +++ b/internal/daemon/cluster/handlers/worker_service_test.go @@ -1,4 +1,4 @@ -package workers_test +package handlers_test import ( "context" @@ -8,7 +8,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/boundary/internal/authtoken" - "github.com/hashicorp/boundary/internal/daemon/controller/handlers/workers" + "github.com/hashicorp/boundary/internal/daemon/cluster/handlers" "github.com/hashicorp/boundary/internal/db" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/host/static" @@ -100,7 +100,7 @@ func TestLookupSession(t *testing.T) { err = repo.AddSessionCredentials(ctx, egressSess.ScopeId, egressSess.GetPublicId(), workerCreds) require.NoError(t, err) - s := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, new(sync.Map), kms) + s := handlers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, new(sync.Map), kms) require.NotNil(t, s) cases := []struct { diff --git a/internal/daemon/controller/handlers/targets/tcp/target_service_test.go b/internal/daemon/controller/handlers/targets/tcp/target_service_test.go index 1a526d1272..26120d8557 100644 --- a/internal/daemon/controller/handlers/targets/tcp/target_service_test.go +++ b/internal/daemon/controller/handlers/targets/tcp/target_service_test.go @@ -16,11 +16,11 @@ import ( "github.com/hashicorp/boundary/internal/authtoken" "github.com/hashicorp/boundary/internal/credential" "github.com/hashicorp/boundary/internal/credential/vault" + cluster "github.com/hashicorp/boundary/internal/daemon/cluster/handlers" "github.com/hashicorp/boundary/internal/daemon/controller/auth" "github.com/hashicorp/boundary/internal/daemon/controller/handlers" "github.com/hashicorp/boundary/internal/daemon/controller/handlers/credentiallibraries" "github.com/hashicorp/boundary/internal/daemon/controller/handlers/targets" - "github.com/hashicorp/boundary/internal/daemon/controller/handlers/workers" "github.com/hashicorp/boundary/internal/db" pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" authpb "github.com/hashicorp/boundary/internal/gen/controller/auth" @@ -2787,7 +2787,7 @@ func TestAuthorizeSession(t *testing.T) { require.NoError(t, err) // Tell our DB that there is a worker ready to serve the data - workerService := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) + workerService := cluster.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) _, err = workerService.Status(ctx, &spbs.StatusRequest{ Worker: &spb.Server{ PrivateId: "w_1234567890", @@ -3075,7 +3075,7 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) { require.NoError(t, err) // Tell our DB that there is a worker ready to serve the data - workerService := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) + workerService := cluster.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) _, err = workerService.Status(ctx, &spbs.StatusRequest{ Worker: &spb.Server{ PrivateId: "w_1234567890", @@ -3206,7 +3206,7 @@ func TestAuthorizeSession_Errors(t *testing.T) { store := vault.TestCredentialStore(t, conn, wrapper, proj.GetPublicId(), v.Addr, tok, sec.Auth.Accessor) workerExists := func(tar target.Target) (version uint32) { - workerService := workers.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) + workerService := cluster.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms) _, err := workerService.Status(context.Background(), &spbs.StatusRequest{ Worker: &spb.Server{ PrivateId: "w_1234567890", diff --git a/internal/daemon/controller/listeners.go b/internal/daemon/controller/listeners.go index 09365a7f7c..ddd53ed357 100644 --- a/internal/daemon/controller/listeners.go +++ b/internal/daemon/controller/listeners.go @@ -13,7 +13,7 @@ import ( grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/daemon/controller/handlers/workers" + "github.com/hashicorp/boundary/internal/daemon/cluster/handlers" "github.com/hashicorp/boundary/internal/daemon/controller/internal/metric" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/go-multierror" @@ -140,12 +140,12 @@ func (c *Controller) configureForCluster(ln *base.ServerListener) (func(), error ), ) - workerService := workers.NewWorkerServiceServer(c.ServersRepoFn, c.SessionRepoFn, c.ConnectionRepoFn, + workerService := handlers.NewWorkerServiceServer(c.ServersRepoFn, c.SessionRepoFn, c.ConnectionRepoFn, c.workerStatusUpdateTimes, c.kms) pbs.RegisterServerCoordinationServiceServer(workerServer, workerService) pbs.RegisterSessionServiceServer(workerServer, workerService) - multihopService := workers.NewMultihopServiceServer( + multihopService := handlers.NewMultihopServiceServer( nodeauth.MakeCurrentParametersFactory(c.baseContext, nodee.NopTransactionStorage(c.NodeeFileStorage)), ) multihop.RegisterMultihopServiceServer(workerServer, multihopService) diff --git a/internal/daemon/worker/listeners.go b/internal/daemon/worker/listeners.go index 3f83115b12..0da0f3a62e 100644 --- a/internal/daemon/worker/listeners.go +++ b/internal/daemon/worker/listeners.go @@ -13,7 +13,7 @@ import ( "time" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/daemon/controller/handlers/workers" + "github.com/hashicorp/boundary/internal/daemon/cluster/handlers" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/observability/event" "github.com/hashicorp/go-multierror" @@ -136,11 +136,11 @@ func (w *Worker) configureForWorker(ln *base.ServerListener, logger *log.Logger) grpc.MaxRecvMsgSize(math.MaxInt32), grpc.MaxSendMsgSize(math.MaxInt32), ) - multihopService := workers.NewMultihopServiceServer( + multihopService := handlers.NewMultihopServiceServer( nodeauth.MakeCurrentParametersFactory(w.baseContext, nodee.NopTransactionStorage(w.NodeeFileStorage)), ) multihop.RegisterMultihopServiceServer(downstreamServer, multihopService) - statusSessionService := workers.NewWorkerProxyServiceServer(w.controllerStatusConn, w.controllerSessionConn) + statusSessionService := NewWorkerProxyServiceServer(w.controllerStatusConn, w.controllerSessionConn) pbs.RegisterServerCoordinationServiceServer(downstreamServer, statusSessionService) pbs.RegisterSessionServiceServer(downstreamServer, statusSessionService) diff --git a/internal/daemon/controller/handlers/workers/worker_proxy_service.go b/internal/daemon/worker/worker_proxy_service.go similarity index 99% rename from internal/daemon/controller/handlers/workers/worker_proxy_service.go rename to internal/daemon/worker/worker_proxy_service.go index 198030dc2a..54e657ed2d 100644 --- a/internal/daemon/controller/handlers/workers/worker_proxy_service.go +++ b/internal/daemon/worker/worker_proxy_service.go @@ -1,4 +1,4 @@ -package workers +package worker import ( "context"