package dra

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

Index

Types

type ContainerInfo

type ContainerInfo struct {
	// The Annotations for the container
	Annotations []kubecontainer.Annotation
}

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

type Manager

type Manager interface {
	// PrepareResources prepares resources for a container in a pod.
	// It communicates with the DRA resource plugin to prepare resources and
	// returns resource info to trigger CDI injection by the runtime.
	PrepareResources(pod *v1.Pod, container *v1.Container) (*ContainerInfo, error)

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

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

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 resource Plugins.

func NewManagerImpl

func NewManagerImpl(kubeClient clientset.Interface) (*ManagerImpl, error)

NewManagerImpl creates a new manager.

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, container *v1.Container) (*ContainerInfo, error)

PrepareResources calls plugin NodePrepareResource from the registered DRA resource plugins.

func (*ManagerImpl) UnprepareResources

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

UnprepareResources calls a plugin'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

cdi.go claiminfo.go manager.go types.go

Directories

PathSynopsis
pkg/kubelet/cm/dra/plugin
Version
v1.26.4
Published
Apr 12, 2023
Platform
windows/amd64
Imports
14 packages
Last checked
52 seconds ago

Tools for package owners.