Documentation
¶
Overview ¶
Package orchestrator — bridge_node.go implements the DAG executor's handler for RuntimeBridge services. This is the integration glue between the DAG and the internal/bridge/ package. (Idea 46.3)
Package orchestrator implements a DAG-based service dependency graph for ordered startup of databases, mock servers, and developer applications.
Index ¶
- type BridgeMode
- type BridgeNodeConfig
- type BridgeNodeState
- type DAG
- func (d *DAG) AddNode(n *Node) error
- func (d *DAG) BridgeServicesJSON() ([]byte, error)
- func (d *DAG) Execute(ctx context.Context) (cleanup func(), err error)
- func (d *DAG) GenerateBridgeEnvVars() map[string]string
- func (d *DAG) TopologicalSort() ([][]string, error)
- func (d *DAG) Validate() error
- func (d *DAG) WriteBridgeEnvFile() error
- type DependsOnEntry
- type HealthcheckConfig
- type Node
- type NodeType
- type Runtime
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeMode ¶ added in v0.32.0
type BridgeMode string
BridgeMode distinguishes between outbound and inbound bridge operations.
const ( BridgeModeConnect BridgeMode = "connect" // Outbound: kubectl port-forward BridgeModeIntercept BridgeMode = "intercept" // Inbound: agent + yamux tunnel )
type BridgeNodeConfig ¶ added in v0.32.0
type BridgeNodeConfig struct {
Kubeconfig string
Context string
Namespace string
TargetService string
RemotePort int
LocalPort int
AgentImage string
Mode BridgeMode
InterceptMode string // "steal" or "mirror"
}
BridgeNodeConfig holds bridge-specific configuration for a DAG node.
type BridgeNodeState ¶ added in v0.32.0
type BridgeNodeState struct {
PortForward *bridge.PortForward // non-nil for connect mode
Tunnel *bridge.Tunnel // non-nil for intercept mode
AgentInfo *bridge.AgentInfo // non-nil for intercept mode
SvcState *bridge.ServiceState // non-nil for intercept mode
SessionID string // set for intercept mode
Kubeconfig string // for cleanup kubectl calls
Context string // for cleanup kubectl calls
Namespace string // for cleanup kubectl calls
}
BridgeNodeState holds the runtime state of a running bridge node, used for teardown.
func (*BridgeNodeState) Cleanup ¶ added in v0.32.0
func (s *BridgeNodeState) Cleanup()
Cleanup tears down bridge state in the correct order: 1. Stop tunnel (disconnect Yamux session) 2. Restore service selector (un-redirect traffic) 3. Remove agent pod 4. Stop port-forward subprocess 5. Remove session entry
type DAG ¶
DAG is a directed acyclic graph of nodes.
func (*DAG) BridgeServicesJSON ¶ added in v0.32.0
BridgeServicesJSON returns a JSON-serializable summary of bridge services for --dry-run.
func (*DAG) Execute ¶
Execute starts all nodes in topological order, waiting for health checks between tiers. It returns a cleanup function to stop all started processes.
func (*DAG) GenerateBridgeEnvVars ¶ added in v0.32.0
GenerateBridgeEnvVars returns the BRIDGE_*_URL env vars for all bridge services in the DAG.
func (*DAG) TopologicalSort ¶
TopologicalSort returns execution tiers: each tier contains nodes that can be started in parallel once all nodes in previous tiers are healthy.
func (*DAG) WriteBridgeEnvFile ¶ added in v0.32.0
WriteBridgeEnvFile writes the BRIDGE_*_URL env vars to ~/.devx/bridge.env.
type DependsOnEntry ¶
type DependsOnEntry struct {
Name string `yaml:"name"`
Condition string `yaml:"condition"` // "service_healthy" or "service_started"
}
DependsOnEntry references another node and a readiness condition.
type HealthcheckConfig ¶
type HealthcheckConfig struct {
// HTTP endpoint to poll (e.g., "http://localhost:8080/health")
HTTP string `yaml:"http"`
// TCP address to probe (e.g., "localhost:5432")
TCP string `yaml:"tcp"`
// Interval between checks
Interval time.Duration `yaml:"interval"`
// Timeout for each check attempt
Timeout time.Duration `yaml:"timeout"`
// Number of consecutive successes required
Retries int `yaml:"retries"`
}
HealthcheckConfig defines how to verify a service is ready.
type Node ¶
type Node struct {
Name string
Type NodeType
DependsOn []string // names of nodes this depends on
Healthcheck HealthcheckConfig
Port int // resolved port (after conflict resolution)
Runtime Runtime
Command []string
Env map[string]string
Dir string // Working directory for host process execution (set by include resolver for multirepo)
// Bridge-specific fields (Idea 46.3)
BridgeMode BridgeMode // for RuntimeBridge nodes
BridgeConfig *BridgeNodeConfig // bridge-specific parameters
// contains filtered or unexported fields
}
Node is a single unit of work in the DAG.
type ServiceConfig ¶
type ServiceConfig struct {
Name string `yaml:"name"`
Runtime Runtime `yaml:"runtime"`
Command []string `yaml:"command"`
DependsOn []DependsOnEntry `yaml:"depends_on"`
Healthcheck HealthcheckConfig `yaml:"healthcheck"`
Port int `yaml:"port"`
Env map[string]string `yaml:"env"`
}
ServiceConfig defines a developer application in devx.yaml.