Documentation
¶
Index ¶
- type ExecInInstanceCall
- type FakeDialCall
- type FakeOrchestrator
- func (fo *FakeOrchestrator) AddInstance(instance *types.Instance)
- func (fo *FakeOrchestrator) AddService(service *types.Service)
- func (fo *FakeOrchestrator) CreateScalingOperation(ctx context.Context, service *types.Service, ...) error
- func (fo *FakeOrchestrator) CreateService(ctx context.Context, service *types.Service) error
- func (fo *FakeOrchestrator) DebugInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
- func (fo *FakeOrchestrator) DeleteService(ctx context.Context, request *types.DeletionRequest) (*types.DeletionResponse, error)
- func (fo *FakeOrchestrator) DialInInstance(ctx context.Context, namespace, instanceID string, port uint32) (net.Conn, *types.Instance, error)
- func (fo *FakeOrchestrator) DialInService(ctx context.Context, namespace, serviceName string, port uint32) (net.Conn, *types.Instance, error)
- func (fo *FakeOrchestrator) ExecInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
- func (fo *FakeOrchestrator) ExecInService(ctx context.Context, namespace, serviceName string, options types.ExecOptions) (types.ExecStream, error)
- func (fo *FakeOrchestrator) GetActiveScalingOperation(ctx context.Context, namespace, serviceName string) (*types.ScalingOperation, error)
- func (fo *FakeOrchestrator) GetDeletionStatus(ctx context.Context, namespace, deletionID string) (*types.DeletionOperation, error)
- func (fo *FakeOrchestrator) GetInstanceByID(ctx context.Context, namespace, instanceID string) (*types.Instance, error)
- func (fo *FakeOrchestrator) GetInstanceLogs(ctx context.Context, namespace, instanceID string, options types.LogOptions) (io.ReadCloser, error)
- func (fo *FakeOrchestrator) GetInstanceStatus(ctx context.Context, namespace, instanceID string) (*types.InstanceStatusInfo, error)
- func (fo *FakeOrchestrator) GetLastDialPeer() net.Conn
- func (fo *FakeOrchestrator) GetService(ctx context.Context, namespace, name string) (*types.Service, error)
- func (fo *FakeOrchestrator) GetServiceLogs(ctx context.Context, namespace, name string, opts types.LogOptions) (io.ReadCloser, error)
- func (fo *FakeOrchestrator) GetServiceStatus(ctx context.Context, namespace, serviceName string) (*types.ServiceStatusInfo, error)
- func (fo *FakeOrchestrator) ListDeletionOperations(ctx context.Context, namespace string) ([]*types.DeletionOperation, error)
- func (fo *FakeOrchestrator) ListInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
- func (fo *FakeOrchestrator) ListRunningInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
- func (fo *FakeOrchestrator) ListServices(ctx context.Context, namespace string) ([]*types.Service, error)
- func (fo *FakeOrchestrator) RestartInstance(ctx context.Context, namespace, instanceID string) error
- func (fo *FakeOrchestrator) RestartService(ctx context.Context, namespace, serviceName string) (int64, int, error)
- func (fo *FakeOrchestrator) ScaleService(ctx context.Context, namespace, name string, scale int) error
- func (fo *FakeOrchestrator) SetEndpointPublisher(_ controllers.EndpointPublisher, _ string)
- func (fo *FakeOrchestrator) SetMountResolver(_ controllers.MountResolver)
- func (fo *FakeOrchestrator) Start(ctx context.Context) error
- func (fo *FakeOrchestrator) Stop() error
- func (fo *FakeOrchestrator) StopInstance(ctx context.Context, namespace, instanceID string) error
- func (fo *FakeOrchestrator) StopService(ctx context.Context, namespace, serviceName string) error
- func (fo *FakeOrchestrator) UpdateService(ctx context.Context, service *types.Service) error
- func (fo *FakeOrchestrator) WatchServices(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)
- type Orchestrator
- type OrchestratorOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecInInstanceCall ¶
type ExecInInstanceCall struct {
Namespace string
ServiceID string
InstanceID string
Options types.ExecOptions
Stream types.ExecStream
Error error
}
ExecInInstanceCall tracks ExecInInstance calls
type FakeDialCall ¶
FakeDialCall records a DialInInstance/DialInService call.
type FakeOrchestrator ¶
type FakeOrchestrator struct {
// Exec-related fields for testing
ExecStdout []byte
ExecStderr []byte
ExecExitCode int
// Track calls for testing
ExecInInstanceCalls []ExecInInstanceCall
// Port-forward (RUNE-122)
DialError error
DialCalls []FakeDialCall
LastDialPeer net.Conn
// contains filtered or unexported fields
}
FakeOrchestrator provides a simple fake implementation for testing It implements the Orchestrator interface
func NewFakeOrchestrator ¶
func NewFakeOrchestrator() *FakeOrchestrator
NewFakeOrchestrator creates a new fake orchestrator for testing
func (*FakeOrchestrator) AddInstance ¶
func (fo *FakeOrchestrator) AddInstance(instance *types.Instance)
AddInstance adds an instance to the fake orchestrator
func (*FakeOrchestrator) AddService ¶
func (fo *FakeOrchestrator) AddService(service *types.Service)
AddService adds a service to the fake orchestrator
func (*FakeOrchestrator) CreateScalingOperation ¶
func (fo *FakeOrchestrator) CreateScalingOperation(ctx context.Context, service *types.Service, params types.ScalingOperationParams) error
CreateScalingOperation implements Orchestrator interface
func (*FakeOrchestrator) CreateService ¶
CreateService implements Orchestrator interface
func (*FakeOrchestrator) DebugInInstance ¶
func (fo *FakeOrchestrator) DebugInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
DebugInInstance implements Orchestrator interface. For the fake, we just return the same stream shape as ExecInInstance — production tests cover the real sidecar lifecycle in pkg/runner/docker.
func (*FakeOrchestrator) DeleteService ¶
func (fo *FakeOrchestrator) DeleteService(ctx context.Context, request *types.DeletionRequest) (*types.DeletionResponse, error)
DeleteService implements Orchestrator interface
func (*FakeOrchestrator) DialInInstance ¶
func (fo *FakeOrchestrator) DialInInstance(ctx context.Context, namespace, instanceID string, port uint32) (net.Conn, *types.Instance, error)
DialInInstance returns a net.Pipe(); the peer end is stashed on the fake so tests can read/write the "remote" side.
func (*FakeOrchestrator) DialInService ¶
func (fo *FakeOrchestrator) DialInService(ctx context.Context, namespace, serviceName string, port uint32) (net.Conn, *types.Instance, error)
DialInService is identical to DialInInstance for the fake, with a synthetic instance name derived from the service.
func (*FakeOrchestrator) ExecInInstance ¶
func (fo *FakeOrchestrator) ExecInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
ExecInInstance implements Orchestrator interface
func (*FakeOrchestrator) ExecInService ¶
func (fo *FakeOrchestrator) ExecInService(ctx context.Context, namespace, serviceName string, options types.ExecOptions) (types.ExecStream, error)
ExecInService implements the old orchestrator interface for compatibility
func (*FakeOrchestrator) GetActiveScalingOperation ¶
func (fo *FakeOrchestrator) GetActiveScalingOperation(ctx context.Context, namespace, serviceName string) (*types.ScalingOperation, error)
GetActiveScalingOperation implements Orchestrator interface
func (*FakeOrchestrator) GetDeletionStatus ¶
func (fo *FakeOrchestrator) GetDeletionStatus(ctx context.Context, namespace, deletionID string) (*types.DeletionOperation, error)
GetDeletionStatus implements the old orchestrator interface for compatibility
func (*FakeOrchestrator) GetInstanceByID ¶
func (fo *FakeOrchestrator) GetInstanceByID(ctx context.Context, namespace, instanceID string) (*types.Instance, error)
GetInstanceByID implements Orchestrator interface
func (*FakeOrchestrator) GetInstanceLogs ¶
func (fo *FakeOrchestrator) GetInstanceLogs(ctx context.Context, namespace, instanceID string, options types.LogOptions) (io.ReadCloser, error)
GetInstanceLogs implements Orchestrator interface
func (*FakeOrchestrator) GetInstanceStatus ¶
func (fo *FakeOrchestrator) GetInstanceStatus(ctx context.Context, namespace, instanceID string) (*types.InstanceStatusInfo, error)
GetInstanceStatus implements Orchestrator interface
func (*FakeOrchestrator) GetLastDialPeer ¶
func (fo *FakeOrchestrator) GetLastDialPeer() net.Conn
GetLastDialPeer returns the remote end of the net.Pipe stashed by the most recent DialIn{Instance,Service} call, or nil if none has happened yet. Locked accessor — safe to poll from a test goroutine.
func (*FakeOrchestrator) GetService ¶
func (fo *FakeOrchestrator) GetService(ctx context.Context, namespace, name string) (*types.Service, error)
GetService implements Orchestrator interface
func (*FakeOrchestrator) GetServiceLogs ¶
func (fo *FakeOrchestrator) GetServiceLogs(ctx context.Context, namespace, name string, opts types.LogOptions) (io.ReadCloser, error)
GetServiceLogs implements Orchestrator interface
func (*FakeOrchestrator) GetServiceStatus ¶
func (fo *FakeOrchestrator) GetServiceStatus(ctx context.Context, namespace, serviceName string) (*types.ServiceStatusInfo, error)
GetServiceStatus implements the old orchestrator interface for compatibility
func (*FakeOrchestrator) ListDeletionOperations ¶
func (fo *FakeOrchestrator) ListDeletionOperations(ctx context.Context, namespace string) ([]*types.DeletionOperation, error)
ListDeletionOperations implements Orchestrator interface
func (*FakeOrchestrator) ListInstances ¶
func (fo *FakeOrchestrator) ListInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
ListInstances implements Orchestrator interface
func (*FakeOrchestrator) ListRunningInstances ¶
func (fo *FakeOrchestrator) ListRunningInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
ListRunningInstances implements Orchestrator interface
func (*FakeOrchestrator) ListServices ¶
func (fo *FakeOrchestrator) ListServices(ctx context.Context, namespace string) ([]*types.Service, error)
ListServices implements Orchestrator interface
func (*FakeOrchestrator) RestartInstance ¶
func (fo *FakeOrchestrator) RestartInstance(ctx context.Context, namespace, instanceID string) error
RestartInstance implements Orchestrator interface
func (*FakeOrchestrator) RestartService ¶
func (fo *FakeOrchestrator) RestartService(ctx context.Context, namespace, serviceName string) (int64, int, error)
RestartService implements the old orchestrator interface for compatibility
func (*FakeOrchestrator) ScaleService ¶
func (fo *FakeOrchestrator) ScaleService(ctx context.Context, namespace, name string, scale int) error
ScaleService updates the scale of a service in the fake orchestrator
func (*FakeOrchestrator) SetEndpointPublisher ¶
func (fo *FakeOrchestrator) SetEndpointPublisher(_ controllers.EndpointPublisher, _ string)
SetEndpointPublisher implements Orchestrator interface; no-op for the fake.
func (*FakeOrchestrator) SetMountResolver ¶
func (fo *FakeOrchestrator) SetMountResolver(_ controllers.MountResolver)
SetMountResolver implements Orchestrator interface; no-op for the fake.
func (*FakeOrchestrator) Start ¶
func (fo *FakeOrchestrator) Start(ctx context.Context) error
Start implements Orchestrator interface
func (*FakeOrchestrator) Stop ¶
func (fo *FakeOrchestrator) Stop() error
Stop implements Orchestrator interface
func (*FakeOrchestrator) StopInstance ¶
func (fo *FakeOrchestrator) StopInstance(ctx context.Context, namespace, instanceID string) error
StopInstance implements Orchestrator interface
func (*FakeOrchestrator) StopService ¶
func (fo *FakeOrchestrator) StopService(ctx context.Context, namespace, serviceName string) error
StopService implements the old orchestrator interface for compatibility
func (*FakeOrchestrator) UpdateService ¶
UpdateService implements Orchestrator interface
func (*FakeOrchestrator) WatchServices ¶
func (fo *FakeOrchestrator) WatchServices(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)
WatchServices implements Orchestrator interface
type Orchestrator ¶
type Orchestrator interface {
// Lifecycle
Start(ctx context.Context) error
Stop() error
// Service operations
CreateService(ctx context.Context, service *types.Service) error
UpdateService(ctx context.Context, service *types.Service) error
DeleteService(ctx context.Context, request *types.DeletionRequest) (*types.DeletionResponse, error)
GetService(ctx context.Context, namespace, name string) (*types.Service, error)
ListServices(ctx context.Context, namespace string) ([]*types.Service, error)
// Status and monitoring
GetServiceStatus(ctx context.Context, namespace, name string) (*types.ServiceStatusInfo, error)
GetInstanceStatus(ctx context.Context, namespace, instanceID string) (*types.InstanceStatusInfo, error)
// Logs
GetServiceLogs(ctx context.Context, namespace, name string, opts types.LogOptions) (io.ReadCloser, error)
GetInstanceLogs(ctx context.Context, namespace, instanceID string, opts types.LogOptions) (io.ReadCloser, error)
// Execution
ExecInService(ctx context.Context, namespace, serviceName string, options types.ExecOptions) (types.ExecStream, error)
ExecInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
// DebugInInstance spawns an ephemeral inspection sidecar from a
// Failed instance's template (image, env, mounts) with the
// entrypoint overridden to `sleep infinity`, then execs the user's
// command inside it. Cleanup happens on ExecStream.Close.
DebugInInstance(ctx context.Context, namespace, instanceID string, options types.ExecOptions) (types.ExecStream, error)
// Port-forward (RUNE-122)
DialInService(ctx context.Context, namespace, serviceName string, port uint32) (net.Conn, *types.Instance, error)
DialInInstance(ctx context.Context, namespace, instanceID string, port uint32) (net.Conn, *types.Instance, error)
// Lifecycle operations
GetInstanceByID(ctx context.Context, namespace, instanceID string) (*types.Instance, error)
RestartService(ctx context.Context, namespace, serviceName string) (templateGeneration int64, scale int, err error)
RestartInstance(ctx context.Context, namespace, instanceID string) error
StopService(ctx context.Context, namespace, serviceName string) error
StopInstance(ctx context.Context, namespace, instanceID string) error
// Deletion operations
GetDeletionStatus(ctx context.Context, namespace, name string) (*types.DeletionOperation, error)
ListDeletionOperations(ctx context.Context, namespace string) ([]*types.DeletionOperation, error)
// Watch operations
WatchServices(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)
// Instance operations
ListInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
ListRunningInstances(ctx context.Context, namespace string) ([]*types.Instance, error)
// Scaling operations
CreateScalingOperation(ctx context.Context, service *types.Service, params types.ScalingOperationParams) error
GetActiveScalingOperation(ctx context.Context, namespace, serviceName string) (*types.ScalingOperation, error)
// SetEndpointPublisher wires the networking data plane (RUNE-063).
// Optional; nil-safe. Call once at startup before Start().
SetEndpointPublisher(publisher controllers.EndpointPublisher, nodeID string)
// SetMountResolver wires the agent-side volumes Subsystem (RUNE-069)
// into the instance controller. Optional; nil-safe. Call once at
// startup before Start().
SetMountResolver(resolver controllers.MountResolver)
}
Orchestrator interface - main entry point (simplified)
func NewDefaultOrchestrator ¶
func NewDefaultOrchestrator(store store.Store, logger log.Logger, runnerManager manager.IRunnerManager) (Orchestrator, error)
NewDefaultOrchestrator creates a new orchestrator with default options
func NewOrchestrator ¶
func NewOrchestrator(options OrchestratorOptions) (Orchestrator, error)
NewOrchestrator creates a new orchestrator
type OrchestratorOptions ¶
type OrchestratorOptions struct {
Store store.Store
Logger log.Logger
RunnerManager manager.IRunnerManager
WorkerCount int
EnableMetrics bool
// StorageDriverConfigs is the per-driver configuration block parsed from
// the runefile [storage] table. Key is the driver name as registered in
// pkg/storage/driver (e.g. "local", "local-host"); value is the opaque
// configuration map handed to the driver factory. Optional; nil-safe.
StorageDriverConfigs map[string]map[string]any
// DefaultStorageClass mirrors the runefile [storage].defaultStorageClass
// knob. *string so the empty-string case ("no cluster default") is
// distinguishable from "unset — keep built-in default".
DefaultStorageClass *string
// StoragePreserveOnDelete mirrors the runefile [storage].preserveOnDelete
// knob. When true, the volume controller demotes ReclaimPolicy:delete
// to retain for volumes provisioned by the in-tree "local" driver.
StoragePreserveOnDelete bool
// StorageSecretLookup resolves `secret:...` references inside
// StorageClass / Volume parameter maps before the storage drivers
// see them. Wired by cmd/runed against the store-backed SecretRepo.
// Nil disables resolution; secret-ref-shaped values then fail the
// containing operation with a clear error. See RUNE-200 PR 3 and
// pkg/storage/driverparams.
StorageSecretLookup driverparams.SecretLookup
// InitialMountResolver, if set, is installed on the InstanceController
// before the orchestrator's first reconcile tick. cmd/runed passes a
// never-ready stub here so the period between orchestrator start and
// the agent-side volumes Subsystem registering its real resolver is
// treated as "transient — retry" rather than falling back to using
// Volume.Handle as the bind source (which would be a UUID for cloud
// drivers). Without this option set, the controller starts with no
// resolver and uses the dev/test Handle-fallback path — correct for
// in-process tests, wrong for production where the agent is racing
// to come up.
InitialMountResolver controllers.MountResolver
// EventLog is the persisted event log (RUNE-126 Phase 2). When set,
// the instance and volume controllers emit status-transition events
// for `rune describe`. Nil disables emission; controllers and tests
// keep working unchanged.
EventLog events.EventLog
}
OrchestratorOptions contains configuration for creating an orchestrator
Directories
¶
| Path | Synopsis |
|---|---|
|
Package controllers — RUNE-121 init-step orchestration for the instance controller.
|
Package controllers — RUNE-121 init-step orchestration for the instance controller. |
|
Package queue provides a coalescing, rate-limited, per-key work queue with the same semantics as Kubernetes client-go's workqueue: a key added while pending is deduplicated, a key added while being processed is re-delivered exactly once after the current run finishes, and no two workers ever process the same key concurrently.
|
Package queue provides a coalescing, rate-limited, per-key work queue with the same semantics as Kubernetes client-go's workqueue: a key added while pending is deduplicated, a key added while being processed is re-delivered exactly once after the current run finishes, and no two workers ever process the same key concurrently. |