dra

package
v1.31.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivePodsFunc added in v1.31.0

type ActivePodsFunc func() []*v1.Pod

ActivePodsFunc is a function that returns a list of pods to reconcile.

type ClaimInfo added in v1.27.0

type ClaimInfo struct {
	state.ClaimInfoState
	// contains filtered or unexported fields
}

ClaimInfo holds information required to prepare and unprepare a resource claim. +k8s:deepcopy-gen=true

func (*ClaimInfo) DeepCopy added in v1.31.0

func (in *ClaimInfo) DeepCopy() *ClaimInfo

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimInfo.

func (*ClaimInfo) DeepCopyInto added in v1.31.0

func (in *ClaimInfo) DeepCopyInto(out *ClaimInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerInfo

type ContainerInfo struct {
	// CDI Devices for the container
	CDIDevices []kubecontainer.CDIDevice
}

ContainerInfo contains information required by the runtime to consume prepared resources.

type Manager

type Manager interface {
	// Start starts the reconcile loop of the manager.
	// This will ensure that all claims are unprepared even if pods get deleted unexpectedly.
	Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error

	// PrepareResources prepares resources for a pod.
	// It communicates with the DRA resource plugin to prepare resources.
	PrepareResources(pod *v1.Pod) error

	// UnprepareResources calls NodeUnprepareResource GRPC from DRA plugin to unprepare pod resources
	UnprepareResources(pod *v1.Pod) error

	// GetResources gets a ContainerInfo object from the claimInfo cache.
	// This information is used by the caller to update a container config.
	GetResources(pod *v1.Pod, container *v1.Container) (*ContainerInfo, error)

	// PodMightNeedToUnprepareResources returns true if the pod with the given UID
	// might need to unprepare resources.
	PodMightNeedToUnprepareResources(UID types.UID) bool

	// GetContainerClaimInfos gets Container ClaimInfo objects
	GetContainerClaimInfos(pod *v1.Pod, container *v1.Container) ([]*ClaimInfo, error)
}

Manager manages all the DRA resource plugins running on a node.

type ManagerImpl

type ManagerImpl struct {
	// contains filtered or unexported fields
}

ManagerImpl is the structure in charge of managing DRA drivers.

func NewManagerImpl

func NewManagerImpl(kubeClient clientset.Interface, stateFileDirectory string, nodeName types.NodeName) (*ManagerImpl, error)

NewManagerImpl creates a new manager.

func (*ManagerImpl) GetContainerClaimInfos added in v1.27.0

func (m *ManagerImpl) GetContainerClaimInfos(pod *v1.Pod, container *v1.Container) ([]*ClaimInfo, error)

GetContainerClaimInfos gets Container's ClaimInfo

func (*ManagerImpl) GetResources added in v1.27.0

func (m *ManagerImpl) GetResources(pod *v1.Pod, container *v1.Container) (*ContainerInfo, error)

GetResources gets a ContainerInfo object from the claimInfo cache. This information is used by the caller to update a container config.

func (*ManagerImpl) PodMightNeedToUnprepareResources

func (m *ManagerImpl) PodMightNeedToUnprepareResources(UID types.UID) bool

PodMightNeedToUnprepareResources returns true if the pod might need to unprepare resources

func (*ManagerImpl) PrepareResources

func (m *ManagerImpl) PrepareResources(pod *v1.Pod) error

PrepareResources attempts to prepare all of the required resources for the input container, issue NodePrepareResources rpc requests for each new resource requirement, process their responses and update the cached containerResources on success.

func (*ManagerImpl) Start added in v1.31.0

func (m *ManagerImpl) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error

Start starts the reconcile loop of the manager.

func (*ManagerImpl) UnprepareResources

func (m *ManagerImpl) UnprepareResources(pod *v1.Pod) error

UnprepareResources calls a driver's NodeUnprepareResource API for each resource claim owned by a pod. This function is idempotent and may be called multiple times against the same pod. As such, calls to the underlying NodeUnprepareResource API are skipped for claims that have already been successfully unprepared.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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