structured

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 11 Imported by: 8

Documentation

Overview

Package structured contains code for working with structured parameters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocatedState added in v0.34.0

type AllocatedState = internal.AllocatedState

types_experimental

type Allocator

type Allocator interface {
	// Allocate calculates the allocation(s) for one particular node.
	//
	// It returns an error only if some fatal problem occurred. These are errors
	// caused by invalid input data, like for example errors in CEL selectors, so a
	// scheduler should abort and report that problem instead of trying to find
	// other nodes where the error doesn't occur.
	//
	// In the future, special errors will be defined which enable the caller to
	// identify which object (like claim or class) caused the problem. This will
	// enable reporting the problem as event for those objects.
	//
	// If the claims cannot be allocated, it returns nil. This includes the
	// situation where the resource slices are incomplete at the moment.
	//
	// If the claims can be allocated, then it prepares one allocation result for
	// each unallocated claim. It is the responsibility of the caller to persist
	// those allocations, if desired.
	//
	// Allocate is thread-safe. If the caller wants to get the node name included
	// in log output, it can use contextual logging and add the node as an
	// additional value. A name can also be useful because log messages do not
	// have a common prefix. V(5) is used for one-time log entries, V(6) for important
	// progress reports, and V(7) for detailed debug output.
	//
	//
	// Context cancellation is supported. An error wrapping the context's error will
	// be returned in case of cancellation.
	Allocate(ctx context.Context, node *v1.Node, claims []*resourceapi.ResourceClaim) (finalResult []resourceapi.AllocationResult, finalErr error)
}

Allocator calculates how to allocate a set of unallocated claims which use structured parameters.

It needs as input the node where the allocated claims are meant to be available and the current state of the cluster (claims, classes, resource slices).

func NewAllocator

func NewAllocator(ctx context.Context,
	features Features,
	allocatedState AllocatedState,
	classLister DeviceClassLister,
	slices []*resourceapi.ResourceSlice,
	celCache *cel.Cache,
) (Allocator, error)

NewAllocator returns an allocator for a certain set of claims or an error if some problem was detected which makes it impossible to allocate claims.

The returned Allocator can be used multiple times and is thread-safe.

type ConsumedCapacity added in v0.34.0

type ConsumedCapacity = internal.ConsumedCapacity

type ConsumedCapacityCollection added in v0.34.0

type ConsumedCapacityCollection = internal.ConsumedCapacityCollection

func NewConsumedCapacityCollection added in v0.34.0

func NewConsumedCapacityCollection() ConsumedCapacityCollection

type DeviceClassLister added in v0.34.0

type DeviceClassLister = internal.DeviceClassLister

type DeviceConsumedCapacity added in v0.34.0

type DeviceConsumedCapacity = internal.DeviceConsumedCapacity

func NewDeviceConsumedCapacity added in v0.34.0

func NewDeviceConsumedCapacity(deviceID DeviceID,
	consumedCapacity map[resourceapi.QualifiedName]resource.Quantity) DeviceConsumedCapacity

type DeviceID

type DeviceID = internal.DeviceID

func MakeDeviceID added in v0.32.0

func MakeDeviceID(driver, pool, device string) DeviceID

type Features added in v0.33.0

type Features = internal.Features

type SharedDeviceID added in v0.34.0

type SharedDeviceID = internal.SharedDeviceID

func MakeSharedDeviceID added in v0.34.0

func MakeSharedDeviceID(deviceID DeviceID, shareID *types.UID) SharedDeviceID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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