Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dataproxy/service/cluster_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ import (
"context"

"connectrpc.com/connect"
"github.com/flyteorg/flyte/v2/flytestdlib/logger"

"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/cluster"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/cluster/clusterconnect"
)

type ClusterService struct {
clusterconnect.UnimplementedClusterServiceHandler
dataplaneDomain string
}

func NewClusterService(dataplaneDomain string) *ClusterService {
return &ClusterService{
dataplaneDomain: dataplaneDomain,
}
func NewClusterService() *ClusterService {
return &ClusterService{}
}

var _ clusterconnect.ClusterServiceHandler = (*ClusterService)(nil)
Expand All @@ -26,7 +24,9 @@ func (s *ClusterService) SelectCluster(
ctx context.Context,
req *connect.Request[cluster.SelectClusterRequest],
) (*connect.Response[cluster.SelectClusterResponse], error) {
requestHost := req.Header().Get("Host")
logger.Debugf(ctx, "Request Host: %s", requestHost)
return connect.NewResponse(&cluster.SelectClusterResponse{
ClusterEndpoint: s.dataplaneDomain,
ClusterEndpoint: requestHost,
}), nil
}
7 changes: 4 additions & 3 deletions dataproxy/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package dataproxy
import (
"context"
"fmt"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/workflow/workflowconnect"
"net/http"

"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/workflow/workflowconnect"

"github.com/flyteorg/flyte/v2/dataproxy/config"
"github.com/flyteorg/flyte/v2/dataproxy/service"
"github.com/flyteorg/flyte/v2/dataproxy/logs"
"github.com/flyteorg/flyte/v2/dataproxy/service"
"github.com/flyteorg/flyte/v2/flytestdlib/app"
"github.com/flyteorg/flyte/v2/flytestdlib/logger"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/cluster/clusterconnect"
Expand Down Expand Up @@ -42,7 +43,7 @@ func Setup(ctx context.Context, sc *app.SetupContext) error {
sc.Mux.Handle(path, handler)
logger.Infof(ctx, "Mounted DataProxyService at %s", path)

clusterSvc := service.NewClusterService(baseURL)
clusterSvc := service.NewClusterService()
clusterPath, clusterHandler := clusterconnect.NewClusterServiceHandler(clusterSvc)
sc.Mux.Handle(clusterPath, clusterHandler)
logger.Infof(ctx, "Mounted ClusterService at %s", clusterPath)
Expand Down
Loading