warmpool

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package warmpool drives the official agents.x-k8s.io SandboxWarmPool CRD onto the L3 node-local warm pools. It is the control-plane surface for warm capacity: `kubectl apply` a SandboxWarmPool sets the target, editing spec.replicas scales it, deleting it drains — no SSH, no per-node poking.

The design contract the whole L3 stack depends on: this reconcile is POOL-LEVEL, O(pools + nodes), NEVER O(sandboxes). It runs inside the aggregated apiserver process alongside the NodeInventory cache, so one component polls node state and writes back CR status. There is deliberately NO per-sandbox reconcile — individual Sandbox status is synthesized on read from NodeInventory, so the apiserver never carries a per-sandbox background load and cannot wedge as the sandbox count grows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory

type ClientFactory func(addr, token string) PoolSetter

ClientFactory builds a PoolSetter for one node's advertise address and the uniform fleet api_token.

func NewSandboxdFactory

func NewSandboxdFactory() ClientFactory

NewSandboxdFactory returns the production factory backed by the real HTTP client.

type Driver

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

Driver reconciles SandboxWarmPool CRs into node-local sandboxd warm targets.

func New

func New(kube client.Client, inv scale.InventorySource, token string, factory ClientFactory, opts Options) *Driver

New builds a Driver. token empty leaves the driver fail-closed (it logs and sets no pools rather than driving sandboxd unauthenticated).

func (*Driver) Reconcile

func (d *Driver) Reconcile(ctx context.Context, _ ctrl.Request) (ctrl.Result, error)

Reconcile runs a full pool reconcile on ANY SandboxWarmPool or NodeInventory event — so a `kubectl apply/patch/delete` reacts in milliseconds, not after a poll tick. It ignores the request key (the loop is global, O(pools+nodes)) and requeues after d.interval, which doubles as the sampling period of the warm count written back to status. Target changes therefore land in milliseconds (event-driven), while the fill they kick off — the node side provisions at O(100)/s per node — becomes visible one interval at a time.

func (*Driver) SetupWithManager

func (d *Driver) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the driver as a controller watching SandboxWarmPool (the desired-state object) and NodeInventory (the node set to spread across). It uses the manager's cached client for pool/template reads and status writes.

type Options

type Options struct {
	Interval time.Duration
	Log      logr.Logger
}

Options configures a Driver.

type PoolSetter

type PoolSetter interface {
	SetPools(ctx context.Context, pools []sandboxd.PoolSpec) (*sandboxd.NodeInfo, error)
}

PoolSetter is the sandboxd surface the driver needs: replace a node's whole warm-target set. The concrete *sandboxd.Client satisfies it; tests inject a fake.

Jump to

Keyboard shortcuts

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