generated from coulomb/repo-seed
Previously build_ssh_command only generated -R (reverse) tunnels. The k3s API tunnel needs -L (local forward: workstation:16443 → CoulombCore:6443) so kubectl can reach the cluster API directly. - TunnelConfig.direction: "reverse" (default) | "local" - config.py: parse direction from YAML, validate allowed values - manager.py: choose -R or -L flag based on direction Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.0 KiB
Python
51 lines
1.0 KiB
Python
"""Domain models for OpsBridge."""
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
from typing import Optional
|
|
|
|
|
|
class BridgeState(str, Enum):
|
|
STOPPED = "stopped"
|
|
STARTING = "starting"
|
|
CONNECTED = "connected"
|
|
DEGRADED = "degraded"
|
|
RECONNECTING = "reconnecting"
|
|
FAILED = "failed"
|
|
|
|
|
|
@dataclass
|
|
class ReconnectPolicy:
|
|
max_attempts: int = 0 # 0 = infinite
|
|
backoff_initial: int = 5
|
|
backoff_max: int = 60
|
|
|
|
|
|
@dataclass
|
|
class HealthCheckConfig:
|
|
url: str
|
|
interval_seconds: int = 30
|
|
timeout_seconds: int = 5
|
|
|
|
|
|
@dataclass
|
|
class TunnelConfig:
|
|
name: str
|
|
host: str
|
|
remote_port: int
|
|
local_port: int
|
|
ssh_user: str
|
|
ssh_key: str
|
|
actor: str
|
|
reconnect: ReconnectPolicy = field(default_factory=ReconnectPolicy)
|
|
health_check: Optional[HealthCheckConfig] = None
|
|
direction: str = "reverse" # "reverse" (-R) or "local" (-L)
|
|
|
|
|
|
@dataclass
|
|
class ActorInfo:
|
|
name: str
|
|
actor_class: str # "human" or "automation"
|
|
description: str = ""
|