Documentation
¶
Index ¶
- type ActivePodsFunc
- type ClaimInfo
- type ClaimsInUse
- type ClaimsInUseDelta
- type ContainerInfo
- type GetNodeFunc
- type Manager
- func (m *Manager) GetContainerClaimInfos(pod *v1.Pod, container *v1.Container) ([]*ClaimInfo, error)
- func (m *Manager) GetResources(pod *v1.Pod, container *v1.Container) (*ContainerInfo, error)
- func (m *Manager) GetWatcherHandler() cache.PluginHandler
- func (m *Manager) HandleWatchResourcesStream(ctx context.Context, ...) error
- func (m *Manager) NewMetricsCollector() metrics.StableCollector
- func (m *Manager) PodMightNeedToUnprepareResources(uid types.UID) bool
- func (m *Manager) PrepareResources(ctx context.Context, pod *v1.Pod) error
- func (m *Manager) Start(ctx context.Context, activePods ActivePodsFunc, getNode GetNodeFunc, ...) error
- func (m *Manager) UnprepareResources(ctx context.Context, pod *v1.Pod) error
- func (m *Manager) UpdateAllocatedResourcesStatus(pod *v1.Pod, status *v1.PodStatus)
- func (m *Manager) Updates() <-chan resourceupdates.Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivePodsFunc ¶ added in v1.31.0
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
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimInfo.
func (*ClaimInfo) DeepCopyInto ¶ added in v1.31.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ClaimsInUse ¶ added in v1.34.0
type ClaimsInUseDelta ¶ added in v1.34.0
type ClaimsInUseDelta []ClaimsInUse
ClaimsInUseDelta provides String (for text logging) and MarshalLog (for structured logging).
func (ClaimsInUseDelta) MarshalLog ¶ added in v1.34.0
func (d ClaimsInUseDelta) MarshalLog() any
func (ClaimsInUseDelta) String ¶ added in v1.34.0
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 ¶ added in v1.32.0
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 ¶ added in v1.34.0
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 ¶ added in v1.27.0
func (m *Manager) GetContainerClaimInfos(pod *v1.Pod, container *v1.Container) ([]*ClaimInfo, error)
GetContainerClaimInfos gets Container's ClaimInfo
func (*Manager) GetResources ¶ added in v1.27.0
GetResources gets a ContainerInfo object from the claimInfo cache. This information is used by the caller to update a container config.
func (*Manager) GetWatcherHandler ¶ added in v1.32.0
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) HandleWatchResourcesStream ¶ added in v1.34.0
func (m *Manager) HandleWatchResourcesStream(ctx context.Context, stream drahealthv1alpha1.DRAResourceHealth_NodeWatchResourcesClient, pluginName string) error
HandleWatchResourcesStream processes health updates from the DRA plugin.
func (*Manager) NewMetricsCollector ¶ added in v1.34.0
func (m *Manager) NewMetricsCollector() metrics.StableCollector
func (*Manager) PodMightNeedToUnprepareResources ¶
PodMightNeedToUnprepareResources returns true if the pod might need to unprepare resources
func (*Manager) PrepareResources ¶
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 ¶ added in v1.31.0
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 ¶
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.
func (*Manager) UpdateAllocatedResourcesStatus ¶ added in v1.34.0
UpdateAllocatedResourcesStatus updates the health status of allocated DRA resources in the pod's container statuses.
func (*Manager) Updates ¶ added in v1.34.0
func (m *Manager) Updates() <-chan resourceupdates.Update
Updates returns the channel that provides resource updates.