package dra

import "k8s.io/kubernetes/pkg/kubelet/cm/dra"

Index

Types

type ActivePodsFunc

type ActivePodsFunc func() []*v1.Pod

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

type ClaimInfo

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

func (in *ClaimInfo) DeepCopy() *ClaimInfo

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

func (*ClaimInfo) DeepCopyInto

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

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

type ClaimsInUse

type ClaimsInUse struct {
	DriverName string
	Count      int
	Delta      int
}

type ClaimsInUseDelta

type ClaimsInUseDelta []ClaimsInUse

ClaimsInUseDelta provides String (for text logging) and MarshalLog (for structured logging).

func (ClaimsInUseDelta) MarshalLog

func (d ClaimsInUseDelta) MarshalLog() any

func (ClaimsInUseDelta) String

func (d ClaimsInUseDelta) String() string

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 GetNodeFunc

type GetNodeFunc func() (*v1.Node, error)

GetNodeFunc is a function that returns the node object using the kubelet's node lister.

type Manager

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

Manager is responsible for managing ResourceClaims. It ensures that they are prepared before starting pods and that they are unprepared before the last consuming pod is declared as terminated.

func NewManager

func NewManager(logger klog.Logger, kubeClient clientset.Interface, stateFileDirectory string) (*Manager, error)

NewManager creates a new DRA manager.

Most errors returned by the manager show up in the context of a pod. They try to adhere to the following convention: - Don't include the pod. - Use terms that are familiar to users. - Don't include the namespace, it can be inferred from the context. - Avoid repeated "failed to ...: failed to ..." when wrapping errors. - Avoid wrapping when it does not provide relevant additional information to keep the user-visible error short.

func (*Manager) GetContainerClaimInfos

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

GetContainerClaimInfos gets Container's ClaimInfo

func (*Manager) GetResources

func (m *Manager) 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 (*Manager) GetWatcherHandler

func (m *Manager) GetWatcherHandler() cache.PluginHandler

GetWatcherHandler must be called after Start, it indirectly depends on parameters which only get passed to Start, for example the context.

func (*Manager) NewMetricsCollector

func (m *Manager) NewMetricsCollector() metrics.StableCollector

func (*Manager) PodMightNeedToUnprepareResources

func (m *Manager) PodMightNeedToUnprepareResources(uid types.UID) bool

PodMightNeedToUnprepareResources returns true if the pod might need to unprepare resources

func (*Manager) PrepareResources

func (m *Manager) PrepareResources(ctx context.Context, 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 (*Manager) Start

func (m *Manager) Start(ctx context.Context, activePods ActivePodsFunc, getNode GetNodeFunc, sourcesReady config.SourcesReady) error

Start starts the reconcile loop of the manager.

func (*Manager) UnprepareResources

func (m *Manager) UnprepareResources(ctx context.Context, 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.

Source Files

claiminfo.go manager.go types.go zz_generated.deepcopy.go

Directories

PathSynopsis
pkg/kubelet/cm/dra/plugin
pkg/kubelet/cm/dra/state
Version
v1.34.0-beta.0
Published
Jul 16, 2025
Platform
js/wasm
Imports
26 packages
Last checked
9 minutes ago

Tools for package owners.