Help us shape the future of Go! Take the 2026 Go Developer Survey

controller

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package controller wires informer snapshots and keyed workqueues to the rack, projection, and status reconcilers, and compiles effective runtime state from runtime policies.

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheNotReady = errors.New("controller caches are not ready")

ErrCacheNotReady indicates that the replica has not synchronized its informer stores.

View Source
var ErrStaleRuntimeInputs = errors.New("cached runtime inputs do not match the rendered rack")

ErrStaleRuntimeInputs indicates that the cached inventory or profile is not the revision a rack was rendered from. It lasts until the rack re-renders, so callers retry instead of serving state that mixes revisions.

Functions

This section is empty.

Types

type AssignmentSnapshot

type AssignmentSnapshot struct {
	Rack *mokkav1alpha1.SGPURack
	Node *mokkav1alpha1.SGPURackNode
}

AssignmentSnapshot is one durable rack-slot assignment observed in the informer cache. Node points into Rack, which is a caller-owned deep copy.

type Controller

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

Controller owns process-lifetime informer caches and leader-lifetime workers.

func New

func New(kubeClient kubernetes.Interface, mokkaClient versioned.Interface, options Options) (*Controller, error)

New assembles shared zero-resync informers and all committed reconcilers.

func (*Controller) AssignmentsForNode

func (c *Controller) AssignmentsForNode(
	ref mokkav1alpha1.SGPUNodeReference,
) ([]AssignmentSnapshot, error)

AssignmentsForNode returns every durable assignment matching an exact Node identity.

func (*Controller) CacheReady

func (c *Controller) CacheReady() bool

CacheReady reports whether synchronized process-lifetime caches are running.

func (*Controller) CachesSynced

func (c *Controller) CachesSynced() <-chan struct{}

CachesSynced is closed after every process-lifetime informer store has synchronized.

func (*Controller) EffectiveRuntime

func (c *Controller) EffectiveRuntime(assignment AssignmentSnapshot) ([]GPURuntime, error)

EffectiveRuntime compiles the effective runtime state of every GPU on an assignment's logical Node: the profile defaults overridden by each accepted runtime policy that selects the GPU. Any replica with synchronized caches can serve it. It returns ErrCacheNotReady before the caches synchronize and an error wrapping ErrStaleRuntimeInputs while the rack's inventory or profile is changing.

func (*Controller) LeaderReady

func (c *Controller) LeaderReady() bool

LeaderReady reports whether leader handlers have replayed and workers are running.

func (*Controller) RunCaches

func (c *Controller) RunCaches(ctx context.Context) error

RunCaches runs informer stores for the process lifetime without routing write work.

func (*Controller) RunLeader

func (c *Controller) RunLeader(ctx context.Context) error

RunLeader attaches write-side handlers to warm caches and runs workers for one elected term.

type GPURuntime

type GPURuntime struct {
	Index   int32
	Runtime mokkav1alpha1.RuntimeState
}

GPURuntime is the effective runtime state of one rendered GPU.

type Options

type Options struct {
	Workers int
	// StatusDebounce is the quiet period before a final status update.
	StatusDebounce time.Duration
	// StatusProgressInterval bounds status staleness while changes continue.
	StatusProgressInterval time.Duration
	// LiveNodeGetTimeout bounds the exact GET used when a Node leaves the filtered cache.
	LiveNodeGetTimeout time.Duration
}

Options controls worker concurrency and aggregate-status coalescing.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the production controller defaults.

Jump to

Keyboard shortcuts

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