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
11 changes: 11 additions & 0 deletions rock-conf/rock-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ k8s:
# Global namespace for all sandboxes
namespace: "rock"

pools:
pool-waa-sample:
image: "xxx"
cpus: 4.0
memory: "8Gi"
ports:
proxy: 8000 # HTTP API port (rocklet/swerex-remote)
server: 8080 # WebSocket server port (same service)
ssh: 22 # SSH service port

# API client configuration
# Rate limiting
api_qps: 20.0
Expand Down Expand Up @@ -44,6 +54,7 @@ k8s:
pip install rl-rock[rocklet]
rocklet


# Runtime configuration
runtime:
# Operator type: 'ray' or 'k8s'
Expand Down
34 changes: 34 additions & 0 deletions rock/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ def __post_init__(self) -> None:
self.tasks = [TaskConfig(**task) for task in self.tasks]


@dataclass
class PoolConfig:
"""Pool configuration with resource and port settings."""

image: str
cpus: float
memory: str
ports: dict[str, int] = field(default_factory=dict)

def __post_init__(self):
# Ensure ports has default values
default_ports = {"proxy": 8000, "server": 8080, "ssh": 22}
for key, value in default_ports.items():
if key not in self.ports:
self.ports[key] = value


@dataclass
class K8sConfig:
"""Kubernetes configuration for K8s operator."""
Expand All @@ -114,13 +131,30 @@ class K8sConfig:
namespace: str = "rock"
templates: dict[str, dict] = field(default_factory=dict)

# Pool configurations: pool_name -> PoolConfig
pools: dict[str, PoolConfig] = field(default_factory=dict)

# Template mapping: image_os -> template_name, e.g., {"windows": "windows_template", "linux": "default"}
template_map: dict[str, str] = field(default_factory=dict)

# API client rate limiting
api_qps: float = 20.0 # Queries per second

# Watch configuration
watch_timeout_seconds: int = 60 # Watch timeout before reconnect
watch_reconnect_delay_seconds: int = 5 # Delay after watch failure

def __post_init__(self):
# Convert pools dict to PoolConfig objects if needed
if self.pools and isinstance(self.pools, dict):
converted = {}
for name, config in self.pools.items():
if isinstance(config, dict):
converted[name] = PoolConfig(**config)
else:
converted[name] = config
self.pools = converted


@dataclass
class RuntimeConfig:
Expand Down
Loading
Loading