package structured
import "k8s.io/dynamic-resource-allocation/structured"
Package structured contains code for working with structured parameters.
Index ¶
Types ¶
type Allocator ¶
type Allocator interface { // ClaimsToAllocate returns the claims that the allocator was created for. ClaimsToAllocate() []*resourceapi.ResourceClaim // 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. Allocate(ctx context.Context, node *v1.Node) (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, claimsToAllocate []*resourceapi.ResourceClaim, allocatedDevices sets.Set[DeviceID], 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 DeviceClassLister ¶
type DeviceClassLister = internal.DeviceClassLister
type DeviceID ¶
func MakeDeviceID ¶
type Features ¶
Source Files ¶
allocator.go doc.go
Directories ¶
Path | Synopsis |
---|---|
structured/internal |
- Version
- v0.34.0-beta.0
- Published
- Jul 16, 2025
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 1 minute ago –
Tools for package owners.