Skip to content

Commit

Permalink
Adds Proxy support to Sandboxes
Browse files Browse the repository at this point in the history
Allows for Sandboxes to use Proxies.
  • Loading branch information
luiscape committed Nov 21, 2024
1 parent b7c46ce commit b861a9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modal/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .mount import _Mount
from .network_file_system import _NetworkFileSystem, network_file_system_mount_protos
from .object import _get_environment_name, _Object
from .proxy import _Proxy
from .scheduler_placement import SchedulerPlacement
from .secret import _Secret
from .stream_type import StreamType
Expand Down Expand Up @@ -72,6 +73,7 @@ def _new(
pty_info: Optional[api_pb2.PTYInfo] = None,
encrypted_ports: Sequence[int] = [],
unencrypted_ports: Sequence[int] = [],
proxy: Optional[_Proxy] = None,
_experimental_scheduler_placement: Optional[SchedulerPlacement] = None,
) -> "_Sandbox":
"""mdmd:hidden"""
Expand Down Expand Up @@ -165,6 +167,7 @@ async def _load(self: _Sandbox, resolver: Resolver, _existing_object_id: Optiona
worker_id=config.get("worker_id"),
open_ports=api_pb2.PortSpecs(ports=open_ports),
network_access=network_access,
proxy_id=(proxy.object_id if proxy else None),
)

# Note - `resolver.app_id` will be `None` for app-less sandboxes
Expand Down
2 changes: 2 additions & 0 deletions modal_proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,8 @@ message Sandbox {

// Network access configuration beyond simple allow/block.
NetworkAccess network_access = 22;

optional string proxy_id = 23;
}

message SandboxCreateRequest {
Expand Down

0 comments on commit b861a9e

Please sign in to comment.