-
Notifications
You must be signed in to change notification settings - Fork 805
Add cluster service and SelectCluster method #7187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package service | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "connectrpc.com/connect" | ||
|
|
||
| "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, | ||
| } | ||
| } | ||
|
|
||
| var _ clusterconnect.ClusterServiceHandler = (*ClusterService)(nil) | ||
|
|
||
| func (s *ClusterService) SelectCluster( | ||
| ctx context.Context, | ||
| req *connect.Request[cluster.SelectClusterRequest], | ||
| ) (*connect.Response[cluster.SelectClusterResponse], error) { | ||
| return connect.NewResponse(&cluster.SelectClusterResponse{ | ||
| ClusterEndpoint: s.dataplaneDomain, | ||
| }), nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package flyteidl2.cluster; | ||
|
|
||
| import "buf/validate/validate.proto"; | ||
| import "flyteidl2/app/app_definition.proto"; | ||
| import "flyteidl2/common/identifier.proto"; | ||
| import "flyteidl2/task/task_definition.proto"; | ||
|
|
||
| option go_package = "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/cluster"; | ||
|
|
||
| message SelectClusterRequest { | ||
| oneof resource { | ||
| option (buf.validate.oneof).required = true; | ||
| flyteidl2.common.OrgIdentifier org_id = 1; | ||
| flyteidl2.common.ProjectIdentifier project_id = 2; | ||
| flyteidl2.task.TaskIdentifier task_id = 3; | ||
| flyteidl2.common.ActionIdentifier action_id = 4; | ||
| flyteidl2.common.ActionAttemptIdentifier action_attempt_id = 5; | ||
| flyteidl2.app.Identifier app_id = 6; | ||
| } | ||
|
|
||
| enum Operation { | ||
| OPERATION_UNSPECIFIED = 0; | ||
| OPERATION_CREATE_UPLOAD_LOCATION = 1; | ||
| OPERATION_UPLOAD_INPUTS = 2; | ||
| OPERATION_GET_ACTION_DATA = 3; | ||
| OPERATION_QUERY_RANGE_METRICS = 4; | ||
| OPERATION_CREATE_DOWNLOAD_LINK = 5; | ||
| OPERATION_TAIL_LOGS = 6; | ||
| OPERATION_GET_ACTION_ATTEMPT_METRICS = 7; | ||
| } | ||
|
|
||
| Operation operation = 8 [(buf.validate.field).enum = { | ||
| not_in: [0] | ||
| }]; | ||
| } | ||
|
|
||
| message SelectClusterResponse { | ||
| string cluster_endpoint = 1; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package flyteidl2.cluster; | ||
|
|
||
| import "flyteidl2/cluster/payload.proto"; | ||
| import "google/api/annotations.proto"; | ||
|
|
||
| option go_package = "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/cluster"; | ||
|
|
||
| service ClusterService { | ||
| rpc SelectCluster(SelectClusterRequest) returns (SelectClusterResponse) { | ||
| option (google.api.http) = { | ||
| post: "/cluster/api/v1/select" | ||
| body: "*" | ||
| }; | ||
|
||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have
dns:///prefix?http://? does it matter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http but i was thinking clients can normalize it as they please? can also switch to dns if you think that makes more sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We expect clients to be using connect, in which case I think http works?