controller

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package controller provides helpers for controller integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(
	ctx context.Context,
	c client.Client,
	generateName string,
	timeout time.Duration,
	pollingInterval ...time.Duration,
) *corev1.Namespace

CreateNamespace creates a namespace and waits until it can be retrieved.

func DeleteNamespace

func DeleteNamespace(ctx context.Context, c client.Client, ns *corev1.Namespace)

DeleteNamespace deletes a non-nil namespace, ignoring an already absent namespace.

func FindBindableNonLoopbackIPv4

func FindBindableNonLoopbackIPv4(port int) string

FindBindableNonLoopbackIPv4 returns a non-loopback IPv4 address that can bind port.

func ListModelWarmupJobs

func ListModelWarmupJobs(g gomega.Gomega, ctx context.Context, c client.Client, namespace, name string) []batchv1.Job

func ModelWarmupJobNode

func ModelWarmupJobNode(job *batchv1.Job) string

func NewModelWarmup

func NewModelWarmup(namespace, name, node string) *modelapi.ModelWarmup

func StartFixedPortHTTPServer

func StartFixedPortHTTPServer(
	ip string,
	port int,
	handler http.Handler,
	timeout time.Duration,
	interval time.Duration,
) *httptest.Server

StartFixedPortHTTPServer starts handler on ip:port, retrying temporary port conflicts.

Types

type FakeModelClaimRuntime

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

FakeModelClaimRuntime serves controllable runtime responses for ModelClaim tests.

func (*FakeModelClaimRuntime) ActivateCallCount

func (f *FakeModelClaimRuntime) ActivateCallCount() int

ActivateCallCount returns the total number of activation attempts, including failures.

func (*FakeModelClaimRuntime) ClaimUIDs

func (f *FakeModelClaimRuntime) ClaimUIDs() []string

ClaimUIDs returns the unique claim UIDs recorded in activation requests.

func (*FakeModelClaimRuntime) Close

func (f *FakeModelClaimRuntime) Close()

Close stops the fake server and tolerates incomplete setup.

func (*FakeModelClaimRuntime) DeactivateRequests

DeactivateRequests returns a defensive copy of the recorded deactivation requests.

func (*FakeModelClaimRuntime) FailNextActivations

func (f *FakeModelClaimRuntime) FailNextActivations(count int)

FailNextActivations injects failures into the next count activation requests.

func (*FakeModelClaimRuntime) FailNextWakes

func (f *FakeModelClaimRuntime) FailNextWakes(count int)

FailNextWakes makes the next count wake requests fail, as a runtime does when vLLM cannot wake its engine.

func (*FakeModelClaimRuntime) IP

func (f *FakeModelClaimRuntime) IP() string

IP returns the address used by fixture pods to reach the runtime.

func (*FakeModelClaimRuntime) KVLimitRequests

KVLimitRequests returns a defensive copy of the recorded KV-limit requests.

func (*FakeModelClaimRuntime) ServeHTTP

ServeHTTP handles the runtime activation, deactivation, snapshot, and model-list endpoints.

func (*FakeModelClaimRuntime) SetCard

func (f *FakeModelClaimRuntime) SetCard(bytes int64)

SetCard has the runtime report one card of the given size.

func (*FakeModelClaimRuntime) SetCards

func (f *FakeModelClaimRuntime) SetCards(sizes ...int64)

SetCards has the runtime report cards of the given sizes.

func (*FakeModelClaimRuntime) SetClaimKV

func (f *FakeModelClaimRuntime) SetClaimKV(uid string, used, capacity int64)

SetClaimKV changes the KV usage and capacity reported for an activated claim.

func (*FakeModelClaimRuntime) SetClaimRequests

func (f *FakeModelClaimRuntime) SetClaimRequests(uid string, running, waiting int64)

SetClaimRequests changes the request counts reported for an activated claim.

func (*FakeModelClaimRuntime) SetClaimState

func (f *FakeModelClaimRuntime) SetClaimState(uid, phase string, ready bool, lastError string)

SetClaimState updates the runtime state for an already activated claim UID. An engine set asleep holds the sleeping footprint the fixture sets.

func (*FakeModelClaimRuntime) SetDefaultState

func (f *FakeModelClaimRuntime) SetDefaultState(phase string, ready bool)

SetDefaultState sets the initial phase and readiness of future activations.

func (*FakeModelClaimRuntime) SetKVLimitReadBack

func (f *FakeModelClaimRuntime) SetKVLimitReadBack(enabled bool)

SetKVLimitReadBack controls whether a successful KV-limit write changes the capacity returned by subsequent snapshots.

func (*FakeModelClaimRuntime) SetSleepingFootprint

func (f *FakeModelClaimRuntime) SetSleepingFootprint(bytes int64)

SetSleepingFootprint sets what an engine holds once it is asleep.

func (*FakeModelClaimRuntime) SleepRequests

SleepRequests returns a copy of the recorded sleep requests.

func (*FakeModelClaimRuntime) WakeRequests

WakeRequests returns a defensive copy of the recorded wake requests.

type ModelClaimFixture

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

ModelClaimFixture owns the client dependencies and fake runtime for a ModelClaim scenario.

func NewModelClaimFixture

func NewModelClaimFixture(ctx context.Context, c client.Client, timeout, interval time.Duration) *ModelClaimFixture

NewModelClaimFixture starts a runtime, registers cleanup, and configures the scenario's polling helpers.

func (*ModelClaimFixture) Close

func (f *ModelClaimFixture) Close()

Close stops the fixture runtime and tolerates incomplete setup.

func (*ModelClaimFixture) CreateClaim

func (f *ModelClaimFixture) CreateClaim(
	namespace, name, pool string,
	modelName *string,
	engineArgs map[string]string,
) *modelapi.ModelClaim

CreateClaim creates a ModelClaim with the integration runtime defaults.

func (*ModelClaimFixture) CreatePoolPod

func (f *ModelClaimFixture) CreatePoolPod(namespace, name, pool, policy string) *corev1.Pod

CreatePoolPod creates a running pool pod that belongs to a Deployment, through a ReplicaSet, as a warm pool's pods do. The Deployment carries the given pool policy.

func (*ModelClaimFixture) CreateWarmPod

func (f *ModelClaimFixture) CreateWarmPod(namespace, name, pool string) *corev1.Pod

CreateWarmPod creates a running pool pod pointing to the fixture runtime.

func (*ModelClaimFixture) CreateWarmPodPending

func (f *ModelClaimFixture) CreateWarmPodPending(namespace, name, pool string, gpuCount int64) *corev1.Pod

CreateWarmPodPending creates a pool pod without making it a runtime candidate. Tests can change the same object to Running with a Pod IP to exercise the controller's Pod update watch.

func (*ModelClaimFixture) ExpectEvent

func (f *ModelClaimFixture) ExpectEvent(claim *modelapi.ModelClaim, eventType, reason string)

ExpectEvent waits for an event matching the claim UID, type, and reason.

func (*ModelClaimFixture) ExpectRoute

func (f *ModelClaimFixture) ExpectRoute(
	g gomega.Gomega,
	namespace, podName, claimName string,
	port int32,
	state string,
)

ExpectRoute checks the pod routing annotation for a claim's port and state.

func (*ModelClaimFixture) GetClaim

GetClaim retrieves the latest claim using the supplied polling assertions.

func (*ModelClaimFixture) MarkWarmPodRunning

func (f *ModelClaimFixture) MarkWarmPodRunning(pod *corev1.Pod)

MarkWarmPodRunning makes a previously-created pool pod eligible for model placement without replacing it.

func (*ModelClaimFixture) RequestWake

func (f *ModelClaimFixture) RequestWake(namespace, podName, claimName string)

RequestWake writes a wake request for a claim on a pod, as the gateway does for a request that finds the claim's engine asleep.

func (*ModelClaimFixture) Runtime

Runtime returns the fake runtime used by this fixture.

func (*ModelClaimFixture) TriggerReconcile

func (f *ModelClaimFixture) TriggerReconcile(claim *modelapi.ModelClaim)

TriggerReconcile updates a claim annotation to trigger reconciliation.

Jump to

Keyboard shortcuts

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