workload

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package workload builds the Racer dataplane DaemonSet. The Unbounded operator deploys it. Each dataplane Pod also runs the Racer control plane, so there is no separate controller workload.

Index

Constants

View Source
const (
	// DataplaneDaemonSetName names the dataplane DaemonSet and its ServiceAccount.
	DataplaneDaemonSetName = "racer"

	// ContainerName names the dataplane container.
	ContainerName = "dataplane"

	// ExclusionLabel removes a Node from dataplane placement and membership.
	ExclusionLabel = "racer.unbounded-cloud.io/exclude"

	// ControlTokenAudience is the audience of the token a Pod presents to
	// control seats.
	ControlTokenAudience = "racer-control"

	// ControlPort serves the control API on seat holders.
	ControlPort = 8443

	// WebhookPort serves the object sidecar admission webhook on seat holders.
	WebhookPort = 9443

	// ControlSeatsKey is the administrator seat policy, read from
	// racer-settings: auto picks 1 to 16 seats, or a fixed count of
	// 1 to 16. It is never injected as explicit env so the ConfigMap wins.
	ControlSeatsKey = "RACER_CONTROL_SEATS"
	// MaxControlSeats bounds a fixed seat count.
	MaxControlSeats = 16

	// APITokenPath is where the default-audience API credentials are
	// projected, the standard in-cluster client location.
	APITokenPath = "/var/run/secrets/kubernetes.io/serviceaccount"
)
View Source
const (
	// NVIDIAKey selects the NVIDIAInjection mode, read from
	// racer-settings by the operator. Unset selects NVIDIAEnv.
	NVIDIAKey = "RACER_NVIDIA"
	// CDIAnnotation requests the NVIDIA CDI device on the dataplane Pod.
	// containerd treats every key with the cdi.k8s.io/ prefix as a CDI request.
	CDIAnnotation = "cdi.k8s.io/racer"
	// CDIAllGPUs is the fully qualified CDI name for every GPU on the node.
	CDIAllGPUs = "nvidia.com/gpu=all"
)
View Source
const (
	// CUFileLogDirectory is the logging.dir of the cufile.json in the
	// dataplane image (images/racer/cufile.json).
	CUFileLogDirectory = "/var/log/cufile"
	// CUFileLogSizeLimit bounds the cuFile log emptyDir. cuFile logs at
	// ERROR level only, so this is far above normal use.
	CUFileLogSizeLimit = "64Mi"
)
View Source
const DataplaneMemoryRequest = "1Gi"

DataplaneMemoryRequest is the default memory request for the dataplane container. It covers the fixed overhead (a checkpoint working set of up to 64 MiB by default, metadata, and runtime) plus the admission floors of a handful of I/O workers (roughly 115 MiB of byte budgets per worker), so the scheduler reserves a realistic baseline on every node.

Variables

View Source
var ErrInvalid = errors.New("invalid racer dataplane configuration")

ErrInvalid reports an invalid workload configuration.

Functions

func DaemonSet added in v0.19.0

func DaemonSet(c Config) (*appsv1.DaemonSet, error)

DaemonSet builds the dataplane DaemonSet.

func DataplaneAffinity added in v0.17.0

func DataplaneAffinity() *corev1.Affinity

DataplaneAffinity is the default node affinity of dataplane Pods. Workloads that must share nodes with the dataplane reuse it.

func Labels added in v0.19.0

func Labels() map[string]string

Labels are the immutable selector labels of the dataplane Pods.

Types

type Config

type Config struct {
	Namespace      string
	DataplaneImage string
	// ObjectImage is the racer-object sidecar image the webhook injects.
	ObjectImage string
	PeerPort    uint16
	HostNetwork bool
	// Zero selects 9090, or 9091 when the peer port is 9090.
	DiagnosticsPort uint16
	// Empty selects NVIDIAEnv.
	NVIDIA NVIDIAInjection
}

Config holds the inputs of the dataplane DaemonSet.

func DefaultConfig added in v0.19.0

func DefaultConfig(namespace, dataplaneImage, objectImage string) Config

DefaultConfig returns the managed defaults for a namespace and images.

func (Config) Validate

func (c Config) Validate() error

Validate checks names, images, and that every listener port is distinct.

type NVIDIAInjection added in v0.19.0

type NVIDIAInjection string

NVIDIAInjection selects how the dataplane asks the container runtime for the host NVIDIA driver libraries. No mode requests nvidia.com/gpu.

const (
	// NVIDIAOff adds no NVIDIA env, CDI annotation, /run/udev mount, or cuFile log volume.
	NVIDIAOff NVIDIAInjection = "off"
	// NVIDIAEnv sets NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES and
	// mounts /run/udev and a cuFile log emptyDir for cuFile.
	// The NVIDIA container runtime acts on the variables; runc ignores them, so they
	// are harmless on nodes without NVIDIA.
	NVIDIAEnv NVIDIAInjection = "env"
	// NVIDIACDI also adds the CDI pod annotation. containerd fails container
	// creation when a CDI device cannot be resolved, so use this only when
	// every dataplane node has an NVIDIA CDI spec.
	NVIDIACDI NVIDIAInjection = "cdi"
)

type NodePlacement added in v0.17.0

type NodePlacement struct {
	// Affinity carries only node affinity. Pod affinity and anti-affinity
	// are relative to dataplane Pods, so a rule such as hostname
	// anti-affinity against racer would otherwise exclude the
	// copying workload from every dataplane node.
	Affinity     *corev1.Affinity
	NodeSelector map[string]string
	Tolerations  []corev1.Toleration
}

NodePlacement holds the node-level scheduling constraints of a dataplane Pod. Workloads that must run on every node that serves a cache, such as cache origins, copy it so they follow the dataplane, including user overrides applied to the live DaemonSet.

func PlacementOf added in v0.17.0

func PlacementOf(pod *corev1.PodSpec) NodePlacement

PlacementOf returns a deep copy of the node-level scheduling constraints of a Pod spec.

Jump to

Keyboard shortcuts

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