package structured
import "k8s.io/dynamic-resource-allocation/structured"
Package structured contains code for working with structured parameters.
Index ¶
- type AllocatedState
- type Allocator
- type ConsumedCapacity
- type ConsumedCapacityCollection
- type DeviceClassLister
- type DeviceConsumedCapacity
- type DeviceID
- type Features
- type SharedDeviceID
Types ¶
type AllocatedState ¶
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 ¶
type ConsumedCapacity = internal.ConsumedCapacity
type ConsumedCapacityCollection ¶
type ConsumedCapacityCollection = internal.ConsumedCapacityCollection
func NewConsumedCapacityCollection ¶
func NewConsumedCapacityCollection() ConsumedCapacityCollection
type DeviceClassLister ¶
type DeviceClassLister = internal.DeviceClassLister
type DeviceConsumedCapacity ¶
type DeviceConsumedCapacity = internal.DeviceConsumedCapacity
func NewDeviceConsumedCapacity ¶
func NewDeviceConsumedCapacity(deviceID DeviceID, consumedCapacity map[resourceapi.QualifiedName]resource.Quantity) DeviceConsumedCapacity
type DeviceID ¶
func MakeDeviceID ¶
type Features ¶
type SharedDeviceID ¶
type SharedDeviceID = internal.SharedDeviceID
func MakeSharedDeviceID ¶
func MakeSharedDeviceID(deviceID DeviceID, shareID *types.UID) SharedDeviceID
Source Files ¶
allocator.go doc.go
Directories ¶
Path | Synopsis |
---|---|
structured/internal |
- Version
- v0.34.0-rc.1
- Published
- Aug 9, 2025
- Platform
- js/wasm
- Imports
- 11 packages
- Last checked
- 19 seconds ago –
Tools for package owners.