api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// K8s API group name.
	APIGroupName = icrd.APIGroupName
	// K8s API group version.
	APIVersion = icrd.APIVersion
	// PLain HW GPU to be allocated.
	GpuDeviceType = icrd.GpuDeviceType
	// SR-IOV Virtual Function to be allocated.
	VfDeviceType = icrd.VfDeviceType
	// Either GPU or VF to be allocated.
	AnyDeviceType = icrd.AnyDeviceType
	// Unsupported device type.
	UnknownDeviceType = icrd.UnknownDeviceType
	// Monitor allocation type.
	MonitorAllocType = "monitor"
	// K8s API Kind string for GpuClaimParameters.
	GpuClaimParametersKind = "GpuClaimParameters"
	// K8s API Kind string for GpuClassParameters.
	GpuClassParametersKind = "GpuClassParameters"
)
View Source
const (
	// Status indicating that CRD entry can be used by controller.
	GpuAllocationStateStatusReady = "Ready"
	// Status indicating that CRD entry cannot be used by controller.
	GpuAllocationStateStatusNotReady = "NotReady"
	// Value for UID field of device, used for VFs that are not yet provisioned.
	NewVFUID = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocatableGpu

type AllocatableGpu = intelcrd.AllocatableGpu

AllocatableGpu represents an allocatable Gpu on a node.

type AllocatedClaim

type AllocatedClaim = intelcrd.AllocatedClaim

Resources that were allocated for the claim by controller.

type AllocatedClaims

type AllocatedClaims = intelcrd.AllocatedClaims

Map of resources allocated per claim UID.

type AllocatedGpu

type AllocatedGpu = intelcrd.AllocatedGpu

AllocatedGpu represents an allocated Gpu on a node.

func AllocatedFromAllocatable

func AllocatedFromAllocatable(source *AllocatableGpu, claimParams *intelcrd.GpuClaimParametersSpec, shared bool) AllocatedGpu

AllocatedFromAllocatable returns AllocatedGpu with relevant fields copied from AllocatableGpu.

type AllocatedGpus

type AllocatedGpus = intelcrd.AllocatedGpus

AllocatedGpus represents a list of allocated devices on a node.

type DeviceSelector

type DeviceSelector = icrd.DeviceSelector

DeviceSelector allows one to match on a specific type of Device as part of the class.

type GpuAllocationState

type GpuAllocationState struct {
	*intelcrd.GpuAllocationState

	// available is a list of devices available for allocation.
	// Updated only manually when GpuAllocationState.UpdateAvailableAndConsumed() is called.
	Available map[string]*intelcrd.AllocatableGpu
	// consumed is a list of available devices' resources consumed.
	// It is identical to available but contains the occupied resources.
	// Updated only manually when GpuAllocationState.UpdateAvailableAndConsumed() is called.
	Consumed map[string]*intelcrd.AllocatableGpu
	// contains filtered or unexported fields
}

Main GpuAllocationState object structure - used to track allocatable devices, allocated devices per ResourceClaim.UID, prepared devices per ResourceClaim.UID.

func NewGpuAllocationState

func NewGpuAllocationState(config *GpuAllocationStateConfig, clientset intelclientset.Interface) *GpuAllocationState

Returns a blank GpuAllocationState object ready to retrieve the record from API or creates a new one.

func (*GpuAllocationState) Create

func (g *GpuAllocationState) Create(ctx context.Context) error

Submits a new GpuAllocationState record to the API.

func (*GpuAllocationState) Delete

func (g *GpuAllocationState) Delete(ctx context.Context) error

Removes the GpuAllocationState record from the API.

func (*GpuAllocationState) DeviceIsAllocated

func (g *GpuAllocationState) DeviceIsAllocated(deviceUID string) bool

DeviceIsAllocated returns true if device is present in any allocation, otherwise false.

func (*GpuAllocationState) Get

Fetches existing GpuAllocationState record from the API or returns error.

func (*GpuAllocationState) GetOrCreate

func (g *GpuAllocationState) GetOrCreate(ctx context.Context) error

Returns an existing GpuAllocationState record fetched from API or submits new record ensuring it exists in the API.

func (*GpuAllocationState) GpuHasVFs

func (g *GpuAllocationState) GpuHasVFs(parentUID string) bool

GpuHasVFs returns true if allocatable devices have VFs with parentUID, or allocated devices have pending / not yet provisioned VFs with parentUID.

func (*GpuAllocationState) ListNames

func (g *GpuAllocationState) ListNames(ctx context.Context) ([]string, error)

Returns list of existing GpuAllocationState records in the API.

func (*GpuAllocationState) Update

Updates the GpuAllocationState record in the API.

func (*GpuAllocationState) UpdateAvailableAndConsumed added in v0.3.0

func (g *GpuAllocationState) UpdateAvailableAndConsumed()

UpdateAvailableAndConsumed updates allocatable devices map filtering out devices that have VFs provisioned, and calculates consumed resources based on existing allocations. Use this method after the fresh contents of GAS.Spec was fetched from cache or API. Do not use this after the GAS.Spec was modified and changes not submitted to API.

func (*GpuAllocationState) UpdateStatus

func (g *GpuAllocationState) UpdateStatus(ctx context.Context, status string) error

Updates only status field of the GpuAllocationState record in the API.

type GpuAllocationStateConfig

type GpuAllocationStateConfig struct {
	Name      string
	Namespace string
	Owner     *metav1.OwnerReference
}

Config to help getting entry of GpuAllocationState.

type GpuAllocationStateSpec

type GpuAllocationStateSpec = intelcrd.GpuAllocationStateSpec

GpuAllocationStateSpec is the spec for the GpuAllocationState CRD.

type GpuClaimParameters

type GpuClaimParameters = icrd.GpuClaimParameters

Main GpuClaimParameters object for storing resource request specification.

type GpuClaimParametersList

type GpuClaimParametersList = icrd.GpuClaimParametersList

List of GpuClaimParameters.

type GpuClaimParametersSpec

type GpuClaimParametersSpec = icrd.GpuClaimParametersSpec

Spec field of GpuClaimParameters.

func DefaultGpuClaimParametersSpec

func DefaultGpuClaimParametersSpec() *GpuClaimParametersSpec

DefaultGpuClaimParametersSpec returns new object with hardcoded default values.

type GpuClassParameters

type GpuClassParameters = icrd.GpuClassParameters

Main GpuClassParameters object for storing resource request specification.

type GpuClassParametersList

type GpuClassParametersList = icrd.GpuClassParametersList

List of GpuClassParameters.

type GpuClassParametersSpec

type GpuClassParametersSpec = icrd.GpuClassParametersSpec

Spec field of GpuClassParameters.

func DefaultGpuClassParametersSpec

func DefaultGpuClassParametersSpec() *GpuClassParametersSpec

DefaultGpuClassParametersSpec returns new object with hardcoded default values.

type PreparedClaim

type PreparedClaim = intelcrd.PreparedClaim

Resources prepared for the claim by kubelet-plugin.

type PreparedClaims

type PreparedClaims = intelcrd.PreparedClaims

Resources prepared for the claim by kubelet-plugin.

type TaintedDevices added in v0.3.0

type TaintedDevices = intelcrd.TaintedDevices

TaintedDevices is map of tainted devices on a node.

type TaintedGpu added in v0.3.0

type TaintedGpu = intelcrd.TaintedGpu

TaintedGpu represents a tainted Gpu on a node.

Jump to

Keyboard shortcuts

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