orchestrator

package
v0.0.1-dev.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 FakeOrchestrator

type FakeOrchestrator struct {

	// Exec-related fields for testing
	ExecStdout   []byte
	ExecStderr   []byte
	ExecExitCode int

	// Track calls for testing
	ExecInInstanceCalls []ExecInInstanceCall
	// 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

func (fo *FakeOrchestrator) CreateService(ctx context.Context, service *types.Service) error

CreateService implements Orchestrator interface

func (*FakeOrchestrator) DeleteService

func (fo *FakeOrchestrator) DeleteService(ctx context.Context, request *types.DeletionRequest) (*types.DeletionResponse, error)

DeleteService implements Orchestrator interface

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) 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) 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) 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

func (fo *FakeOrchestrator) UpdateService(ctx context.Context, service *types.Service) error

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)

	// Lifecycle operations
	GetInstanceByID(ctx context.Context, namespace, instanceID string) (*types.Instance, error)
	RestartService(ctx context.Context, namespace, serviceName string) 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)
}

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
}

OrchestratorOptions contains configuration for creating an orchestrator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL