runner

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaulWorkers = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	RunnerConfig

	Log *slog.Logger
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(log *slog.Logger, deps RunnerDeps, cfg RunnerConfig) (*Runner, error)

func (*Runner) Close

func (r *Runner) Close() error

func (*Runner) ContainerdContainerForSandbox

func (r *Runner) ContainerdContainerForSandbox(ctx context.Context, id entity.Id) (containerd.Container, error)

func (*Runner) ContainerdNamespace

func (r *Runner) ContainerdNamespace() string

func (*Runner) Drain

func (r *Runner) Drain(ctx context.Context) error

Drain sets the runner's node status to disabled and stops all running sandboxes

func (*Runner) SetRestartMode added in v0.3.1

func (r *Runner) SetRestartMode(v bool)

SetRestartMode sets whether outboard processes should be preserved when closing. When true, disk mounts are left in place so the replacement process can pick them up.

func (*Runner) SetupControllers

func (r *Runner) SetupControllers(
	ctx context.Context,
	eas *es.EntityAccessClient,
	rs *rpc.Server,
) (
	_ *controller.ControllerManager,
	retErr error,
)

func (*Runner) Start

func (r *Runner) Start(ctx context.Context, eg ...*errgroup.Group) error

Start initializes and starts the runner. The optional errgroup parameter is used for running background tasks like the Flannel network. If eg is nil and the runner needs to join a Flannel network, an internal errgroup will be created.

type RunnerConfig

type RunnerConfig struct {
	Id            string `json:"id" cbor:"id" yaml:"id"`
	ListenAddress string `json:"listen_address" cbor:"listen_address" yaml:"listen_address"`
	Workers       int    `json:"workers" cbor:"workers" yaml:"workers"`
	DataPath      string `json:"data_path" cbor:"data_path" yaml:"data_path"`

	// Optional RPC configuration for advanced setups
	// If not provided, a default insecure connection will be used
	// to connect to the server address.
	Config *clientconfig.Config `json:"config" cbor:"config" yaml:"config"`

	// Optional cloud authentication configuration for disk replication
	CloudAuth *coordinate.CloudAuthConfig `json:"cloud_auth,omitempty" cbor:"cloud_auth,omitempty" yaml:"cloud_auth,omitempty"`

	// DiskMode configures disk I/O mode ("", "auto", "universal", "accelerator")
	DiskMode string `json:"disk_mode,omitempty" cbor:"disk_mode,omitempty" yaml:"disk_mode,omitempty"`
}

type RunnerDeps added in v0.3.0

type RunnerDeps struct {
	CC        *containerd.Client
	Namespace string
	Bridge    string
	Tempdir   string
	Subnet    *netdb.Subnet

	// Network dependencies
	NetServ *network.ServiceManager

	// Observability dependencies
	LogsMaintainer *observability.LogsMaintainer
	LogWriter      observability.LogWriter
	StatusMon      *observability.StatusMonitor

	// Network config
	IPv4Routable    netip.Prefix
	ServicePrefixes []netip.Prefix
	DisableLocalNet bool

	// Resolver
	Resolver netresolve.Resolver

	// Sandbox metrics
	SandboxMetrics *sandbox.Metrics

	// IsCoordinator indicates this runner is the coordinator node.
	// Affects scheduling: stateful sandboxes are routed to the coordinator.
	IsCoordinator bool

	// Flannel network configuration (for distributed runners)
	// If EtcdEndpoints is non-empty, the runner will join the Flannel network
	EtcdEndpoints  []string
	EtcdPrefix     string
	NetworkBackend string

	// TLS configuration for etcd mTLS (for distributed runners, file paths)
	EtcdTLSCertFile string // Client certificate file path
	EtcdTLSKeyFile  string // Client private key file path
	EtcdTLSCAFile   string // CA certificate file path
}

RunnerDeps holds dependencies needed by the Runner to construct controllers.

Jump to

Keyboard shortcuts

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