Skip to content

Commit

Permalink
Add proto definitions to support tunneled sandboxes
Browse files Browse the repository at this point in the history
This commit adds proto definitions that allow sandboxes to be created
with open ports specified. It also adds an RPC definition for getting
the tunnels once established.
  • Loading branch information
pawalt committed Aug 29, 2024
1 parent ff533ee commit badf79f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions modal_proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,11 @@ message S3Mount {
bool read_only = 4;
}

message PortSpec {
uint32 port = 1;
bool unencrypted = 2;
}

message Sandbox {
repeated string entrypoint_args = 1;
repeated string mount_ids = 2;
Expand Down Expand Up @@ -1750,6 +1755,7 @@ message Sandbox {
repeated Resources _experimental_resources = 18; // overrides `resources` field above

string worker_id = 19; // for internal debugging use only
repeated PortSpec open_ports = 20;
}

message SandboxCreateRequest {
Expand Down Expand Up @@ -1823,6 +1829,21 @@ message SandboxWaitResponse {
GenericResult result = 1;
}

message SandboxGetTunnelsRequest {
string sandbox_id = 1;
}

message TunnelData {
string host = 1;
uint32 port = 2;
optional string unencrypted_host = 3;
optional uint32 unencrypted_port = 4;
}

message SandboxGetTunnelsResponse {
repeated TunnelData tunnels = 1;
}

message Schedule {
message Cron {
string cron_string = 1;
Expand Down Expand Up @@ -2349,6 +2370,7 @@ service ModalClient {
rpc SandboxCreate(SandboxCreateRequest) returns (SandboxCreateResponse);
rpc SandboxGetLogs(SandboxGetLogsRequest) returns (stream TaskLogsBatch);
rpc SandboxGetTaskId(SandboxGetTaskIdRequest) returns (SandboxGetTaskIdResponse); // needed for modal container exec
rpc SandboxGetTunnels(SandboxGetTunnelsRequest) returns (SandboxGetTunnelsResponse);
rpc SandboxList(SandboxListRequest) returns (SandboxListResponse);
rpc SandboxStdinWrite(SandboxStdinWriteRequest) returns (SandboxStdinWriteResponse);
rpc SandboxTerminate(SandboxTerminateRequest) returns (SandboxTerminateResponse);
Expand Down

0 comments on commit badf79f

Please sign in to comment.