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 Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
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, claimsToAllocate []*resourceapi.ResourceClaim, claimLister ClaimLister, classLister resourcelisters.DeviceClassLister, sliceLister resourcelisters.ResourceSliceLister, ) (*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.
func (*Allocator) Allocate ¶
func (a *Allocator) Allocate(ctx context.Context, node *v1.Node) (finalResult []*resourceapi.AllocationResult, finalErr error)
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.
func (*Allocator) ClaimsToAllocate ¶
func (a *Allocator) ClaimsToAllocate() []*resourceapi.ResourceClaim
ClaimsToAllocate returns the claims that the allocated was created for.
type ClaimLister ¶
type ClaimLister interface { // ListAllAllocated returns only claims which are allocated. ListAllAllocated() ([]*resourceapi.ResourceClaim, error) }
ClaimLister returns a subset of the claims that a resourcelisters.ResourceClaimLister would return.
type Pool ¶
type Pool struct { PoolID IsIncomplete bool Slices []*resourceapi.ResourceSlice }
func GatherPools ¶
func GatherPools(ctx context.Context, sliceLister resourcelisters.ResourceSliceLister, node *v1.Node) ([]*Pool, error)
GatherPools collects information about all resource pools which provide devices that are accessible from the given node.
Out-dated slices are silently ignored. Pools may be incomplete, which is recorded in the result.