package internal
import "k8s.io/dynamic-resource-allocation/structured/internal"
Index ¶
- Variables
- func GenerateShareID() *types.UID
- type AllocatedState
- type Allocator
- type AllocatorExtended
- type ConsumedCapacity
- func NewConsumedCapacity() ConsumedCapacity
- func (s ConsumedCapacity) Add(addedCapacity ConsumedCapacity)
- func (s ConsumedCapacity) Clone() ConsumedCapacity
- func (s ConsumedCapacity) Empty() bool
- func (s ConsumedCapacity) Sub(subtractedCapacity ConsumedCapacity)
- type ConsumedCapacityCollection
- func NewConsumedCapacityCollection() ConsumedCapacityCollection
- func (c ConsumedCapacityCollection) Clone() ConsumedCapacityCollection
- func (c ConsumedCapacityCollection) Insert(cap DeviceConsumedCapacity)
- func (c ConsumedCapacityCollection) Remove(cap DeviceConsumedCapacity)
- type DeviceClassLister
- type DeviceConsumedCapacity
- func NewDeviceConsumedCapacity(deviceID DeviceID, consumedCapacity map[resourceapi.QualifiedName]resource.Quantity) DeviceConsumedCapacity
- func (a DeviceConsumedCapacity) Clone() DeviceConsumedCapacity
- func (a DeviceConsumedCapacity) String() string
- type DeviceID
- type Features
- type SharedDeviceID
- func MakeSharedDeviceID(deviceID DeviceID, shareID *types.UID) SharedDeviceID
- func (d SharedDeviceID) String() string
- type Stats
Variables ¶
var FeaturesAll = Features{ AdminAccess: true, ConsumableCapacity: true, DeviceBinding: true, DeviceStatus: true, DeviceTaints: true, PartitionableDevices: true, PrioritizedList: true, }
Functions ¶
func GenerateShareID ¶
Types ¶
type AllocatedState ¶
type AllocatedState struct { AllocatedDevices sets.Set[DeviceID] sets.Set[SharedDeviceID] AggregatedCapacity ConsumedCapacityCollection }
AllocatedState packs information of allocated devices which is gathered from allocated resource claims.
type Allocator ¶
type Allocator interface { Allocate(ctx context.Context, node *v1.Node, claims []*resourceapi.ResourceClaim) (finalResult []resourceapi.AllocationResult, finalErr error) }
Allocator is intentionally not documented here. See the main package for docs.
This interface is also broader than the public one.
type AllocatorExtended ¶
type AllocatorExtended interface { // Stats shows statistics from the allocation process. // May return nil if not implemented. GetStats() Stats }
AllocatorExtended is an optional interface. Not all variants implement it.
type ConsumedCapacity ¶
type ConsumedCapacity map[resourceapi.QualifiedName]*resource.Quantity
ConsumedCapacity defines consumable capacity values
func NewConsumedCapacity ¶
func NewConsumedCapacity() ConsumedCapacity
NewConsumedCapacity initiates a new map of consumable capacity values
func (ConsumedCapacity) Add ¶
func (s ConsumedCapacity) Add(addedCapacity ConsumedCapacity)
Add adds quantity to corresponding consumable capacity, and creates a new entry if no capacity created yet.
func (ConsumedCapacity) Clone ¶
func (s ConsumedCapacity) Clone() ConsumedCapacity
Clone makes a copy of consumed capacity values
func (ConsumedCapacity) Empty ¶
func (s ConsumedCapacity) Empty() bool
Empty return true if all quantity is zero.
func (ConsumedCapacity) Sub ¶
func (s ConsumedCapacity) Sub(subtractedCapacity ConsumedCapacity)
Sub subtracts quantity, and ignore if no capacity entry found.
type ConsumedCapacityCollection ¶
type ConsumedCapacityCollection map[DeviceID]ConsumedCapacity
ConsumedCapacityCollection collects consumable capacity values of each device
func NewConsumedCapacityCollection ¶
func NewConsumedCapacityCollection() ConsumedCapacityCollection
NewConsumedCapacity initiates a new map of device's consumable capacity values
func (ConsumedCapacityCollection) Clone ¶
func (c ConsumedCapacityCollection) Clone() ConsumedCapacityCollection
Clone makes a copy of ConsumedCapacity of each capacity.
func (ConsumedCapacityCollection) Insert ¶
func (c ConsumedCapacityCollection) Insert(cap DeviceConsumedCapacity)
Insert adds a new allocated capacity to the collection.
func (ConsumedCapacityCollection) Remove ¶
func (c ConsumedCapacityCollection) Remove(cap DeviceConsumedCapacity)
Remove removes an allocated capacity from the collection.
type DeviceClassLister ¶
type DeviceClassLister interface { // List returns a list of all DeviceClasses. List() ([]*resourceapi.DeviceClass, error) // Get returns the DeviceClass with the given className. Get(className string) (*resourceapi.DeviceClass, error) }
type DeviceConsumedCapacity ¶
type DeviceConsumedCapacity struct { DeviceID ConsumedCapacity }
DeviceConsumedCapacity contains consumed capacity result within device allocation.
func NewDeviceConsumedCapacity ¶
func NewDeviceConsumedCapacity(deviceID DeviceID, consumedCapacity map[resourceapi.QualifiedName]resource.Quantity) DeviceConsumedCapacity
NewDeviceConsumedCapacity creates DeviceConsumedCapacity instance from device ID and its consumed capacity.
func (DeviceConsumedCapacity) Clone ¶
func (a DeviceConsumedCapacity) Clone() DeviceConsumedCapacity
Clone makes a copy of DeviceConsumedCapacity.
func (DeviceConsumedCapacity) String ¶
func (a DeviceConsumedCapacity) String() string
String returns formatted device ID.
type DeviceID ¶
type DeviceID struct { Driver, Pool, Device draapi.UniqueString }
func MakeDeviceID ¶
func (DeviceID) String ¶
type Features ¶
type Features struct { AdminAccess bool ConsumableCapacity bool DeviceBinding bool DeviceStatus bool DeviceTaints bool PartitionableDevices bool PrioritizedList bool }
Features contains all feature gates that may influence the behavior of ResourceClaim allocation.
func (Features) Set ¶
Set returns all features which are set to true. The names of the features happen to match the Kubernetes feature gates where applicable. Plain strings are used because not all allocator features necessarily have to be Kubernetes feature gates and this package must not depend on those definitions.
type SharedDeviceID ¶
type SharedDeviceID struct { draapi.UniqueString }, , ,
func MakeSharedDeviceID ¶
func MakeSharedDeviceID(deviceID DeviceID, shareID *types.UID) SharedDeviceID
MakeSharedDeviceID creates a SharedDeviceID by extending MakeDeviceID with shareID.
func (SharedDeviceID) String ¶
func (d SharedDeviceID) String() string
type Stats ¶
type Stats struct { // NumAllocateOneInvocations counts the number of times the allocateOne function // got called. NumAllocateOneInvocations int64 }
Stats shows statistics from the allocation process.
Source Files ¶
allocatedstate.go types.go
Directories ¶
Path | Synopsis |
---|---|
structured/internal/allocatortesting | |
structured/internal/experimental | |
structured/internal/incubating | |
structured/internal/stable |
- Version
- v0.34.0-rc.0
- Published
- Aug 8, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 21 seconds ago –
Tools for package owners.