manager

package
v0.0.1-dev.137 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInitialized            = Error("runner manager not initialized")
	ErrDockerRunnerNotAvailable  = Error("docker runner not available")
	ErrProcessRunnerNotAvailable = Error("process runner not available")
)

Define errors

Functions

This section is empty.

Types

type Error

type Error string

Error is a simple error type

func (Error) Error

func (e Error) Error() string

type IRunnerManager

type IRunnerManager interface {
	// Initialize initializes all runners
	Initialize() error

	// GetDockerRunner returns the Docker runner
	GetDockerRunner() (runner.Runner, error)

	// GetProcessRunner returns the Process runner
	GetProcessRunner() (runner.Runner, error)

	// GetInstanceRunner returns the appropriate runner for an instance
	GetInstanceRunner(instance *types.Instance) (runner.Runner, error)

	// GetServiceRunner returns the appropriate runner for a service
	GetServiceRunner(service *types.Service) (runner.Runner, error)

	// SetDNSInjection configures the cluster DNS servers + search
	// domains injected into every subsequently-created container.
	// Containers without injection inherit the host's /etc/resolv.conf
	// and therefore cannot resolve `<service>.<namespace>.rune` —
	// the entire Rune service-discovery layer hinges on this call
	// firing once after the agent's embedded DNS subsystem is up.
	// No-op on runners that don't support DNS injection (process
	// runner).
	SetDNSInjection(servers []string, search []string)

	// Close closes all runners
	Close() error
}

IRunnerManager defines the interface for managing runners

type RunnerManager

type RunnerManager struct {
	// contains filtered or unexported fields
}

RunnerManager provides centralized access to various runners

func NewRunnerManager

func NewRunnerManager(logger log.Logger) *RunnerManager

NewRunnerManager creates a new runner manager

func (*RunnerManager) Close

func (m *RunnerManager) Close() error

func (*RunnerManager) GetDockerRunner

func (m *RunnerManager) GetDockerRunner() (runner.Runner, error)

GetDockerRunner returns the Docker runner

func (*RunnerManager) GetInstanceRunner

func (m *RunnerManager) GetInstanceRunner(instance *types.Instance) (runner.Runner, error)

GetInstanceRunner returns the appropriate runner to use for the given instance.

func (*RunnerManager) GetProcessRunner

func (m *RunnerManager) GetProcessRunner() (runner.Runner, error)

GetProcessRunner returns the Process runner

func (*RunnerManager) GetServiceRunner

func (m *RunnerManager) GetServiceRunner(service *types.Service) (runner.Runner, error)

GetServiceRunner returns the appropriate runner to use for the given service.

func (*RunnerManager) Initialize

func (m *RunnerManager) Initialize() error

Initialize initializes all runners

func (*RunnerManager) RunnerHealth

func (m *RunnerManager) RunnerHealth(ctx context.Context) map[string]string

RunnerHealth reports readiness for each configured runner: "ready", or "unreachable: <reason>" when the runner's HealthCheck fails (e.g. the Docker daemon is down). Only configured runners appear in the map. Runners that don't implement runner.HealthChecker (the process runner) are reported ready — they have no external daemon to probe.

func (*RunnerManager) SetDNSInjection

func (m *RunnerManager) SetDNSInjection(servers []string, search []string)

Close closes all runners SetDNSInjection forwards DNS server + search domain config to the underlying docker runner so subsequent ContainerCreate calls bind `hostConfig.DNS` to the agent's embedded resolver (127.0.0.123:53 by default). Without this, containers inherit the host's /etc/resolv.conf and cannot resolve `<service>.<namespace>.rune` — every cross-service call via Rune's service-discovery layer fails with NXDOMAIN. The process runner doesn't need this; we silently skip.

type RunnerManagerOptions

type RunnerManagerOptions struct {
	Logger       log.Logger
	DockerConfig *docker.DockerConfig
}

RunnerManagerOptions holds configuration for the runner manager

type TestRunnerManager

type TestRunnerManager struct {
	// Test runners that will be returned by the respective getter methods
	MockDockerRunner  runner.Runner
	MockProcessRunner runner.Runner
	DefaultRunner     runner.Runner // Used when neither is specified

	// Track calls for testing assertions
	GetDockerCalled       bool
	GetProcessCalled      bool
	GetInstanceCalled     bool
	GetServiceCalled      bool
	InitializeCalled      bool
	CloseCalled           bool
	SetDNSInjectionCalled bool
	DNSInjectionServers   []string
	DNSInjectionSearch    []string
}

TestRunnerManager is a mock implementation of IRunnerManager for testing purposes

func NewTestRunnerManager

func NewTestRunnerManager(defaultRunner runner.Runner) *TestRunnerManager

NewTestRunnerManager creates a new test runner manager

func (*TestRunnerManager) Close

func (m *TestRunnerManager) Close() error

Close implements the RunnerManager interface

func (*TestRunnerManager) GetDockerRunner

func (m *TestRunnerManager) GetDockerRunner() (runner.Runner, error)

GetDockerRunner implements the RunnerManager interface

func (*TestRunnerManager) GetInstanceRunner

func (m *TestRunnerManager) GetInstanceRunner(instance *types.Instance) (runner.Runner, error)

GetInstanceRunner implements the RunnerManager interface

func (*TestRunnerManager) GetProcessRunner

func (m *TestRunnerManager) GetProcessRunner() (runner.Runner, error)

GetProcessRunner implements the RunnerManager interface

func (*TestRunnerManager) GetServiceRunner

func (m *TestRunnerManager) GetServiceRunner(service *types.Service) (runner.Runner, error)

GetServiceRunner implements the RunnerManager interface

func (*TestRunnerManager) Initialize

func (m *TestRunnerManager) Initialize() error

Initialize implements the RunnerManager interface

func (*TestRunnerManager) SetDNSInjection

func (m *TestRunnerManager) SetDNSInjection(servers []string, search []string)

SetDNSInjection records the call for tests that want to assert the wiring happened. No-op on the runners — the test runner doesn't model docker --dns flags.

func (*TestRunnerManager) SetDockerRunner

func (m *TestRunnerManager) SetDockerRunner(r runner.Runner)

SetDockerRunner sets the Docker runner for testing

func (*TestRunnerManager) SetProcessRunner

func (m *TestRunnerManager) SetProcessRunner(r runner.Runner)

SetProcessRunner sets the Process runner for testing

Jump to

Keyboard shortcuts

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