package dynamicresources
import "k8s.io/kubernetes/pkg/scheduler/framework/plugins/dynamicresources"
Index ¶
- Constants
- func New(ctx context.Context, plArgs runtime.Object, fh framework.Handle, fts feature.Features) (framework.Plugin, error)
- type DefaultDRAManager
- func NewDRAManager(ctx context.Context, claimsCache *assumecache.AssumeCache, resourceSliceTracker *resourceslicetracker.Tracker, informerFactory informers.SharedInformerFactory) *DefaultDRAManager
- func (s *DefaultDRAManager) DeviceClasses() framework.DeviceClassLister
- func (s *DefaultDRAManager) ResourceClaims() framework.ResourceClaimTracker
- func (s *DefaultDRAManager) ResourceSlices() framework.ResourceSliceLister
- type DynamicResources
- func (pl *DynamicResources) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error)
- func (pl *DynamicResources) Filter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status
- func (pl *DynamicResources) Name() string
- func (pl *DynamicResources) PostFilter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusReader) (*framework.PostFilterResult, *framework.Status)
- func (pl *DynamicResources) PreBind(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status
- func (pl *DynamicResources) PreEnqueue(ctx context.Context, pod *v1.Pod) (status *framework.Status)
- func (pl *DynamicResources) PreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status)
- func (pl *DynamicResources) PreFilterExtensions() framework.PreFilterExtensions
- func (pl *DynamicResources) Reserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) (status *framework.Status)
- func (pl *DynamicResources) Unreserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string)
Constants ¶
const ( // Name is the name of the plugin used in Registry and configurations. Name = names.DynamicResources )
Functions ¶
func New ¶
func New(ctx context.Context, plArgs runtime.Object, fh framework.Handle, fts feature.Features) (framework.Plugin, error)
New initializes a new plugin and returns it.
Types ¶
type DefaultDRAManager ¶
type DefaultDRAManager struct {
// contains filtered or unexported fields
}
DefaultDRAManager is the default implementation of SharedDRAManager. It obtains the DRA objects from API informers, and uses an AssumeCache and a map of in-flight allocations in order to avoid race conditions when modifying ResourceClaims.
func NewDRAManager ¶
func NewDRAManager(ctx context.Context, claimsCache *assumecache.AssumeCache, resourceSliceTracker *resourceslicetracker.Tracker, informerFactory informers.SharedInformerFactory) *DefaultDRAManager
func (*DefaultDRAManager) DeviceClasses ¶
func (s *DefaultDRAManager) DeviceClasses() framework.DeviceClassLister
func (*DefaultDRAManager) ResourceClaims ¶
func (s *DefaultDRAManager) ResourceClaims() framework.ResourceClaimTracker
func (*DefaultDRAManager) ResourceSlices ¶
func (s *DefaultDRAManager) ResourceSlices() framework.ResourceSliceLister
type DynamicResources ¶
type DynamicResources struct {
// contains filtered or unexported fields
}
DynamicResources is a plugin that ensures that ResourceClaims are allocated.
func (*DynamicResources) EventsToRegister ¶
func (pl *DynamicResources) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error)
EventsToRegister returns the possible events that may make a Pod failed by this plugin schedulable.
func (*DynamicResources) Filter ¶
func (pl *DynamicResources) Filter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status
Filter invoked at the filter extension point. It evaluates if a pod can fit due to the resources it requests, for both allocated and unallocated claims.
For claims that are bound, then it checks that the node affinity is satisfied by the given node.
For claims that are unbound, it checks whether the claim might get allocated for the node.
func (*DynamicResources) Name ¶
func (pl *DynamicResources) Name() string
Name returns name of the plugin. It is used in logs, etc.
func (*DynamicResources) PostFilter ¶
func (pl *DynamicResources) PostFilter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusReader) (*framework.PostFilterResult, *framework.Status)
PostFilter checks whether there are allocated claims that could get deallocated to help get the Pod schedulable. If yes, it picks one and requests its deallocation. This only gets called when filtering found no suitable node.
func (*DynamicResources) PreBind ¶
func (pl *DynamicResources) PreBind(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status
PreBind gets called in a separate goroutine after it has been determined that the pod should get bound to this node. Because Reserve did not actually reserve claims, we need to do it now. For claims with the builtin controller, we also handle the allocation.
If anything fails, we return an error and the pod will have to go into the backoff queue. The scheduler will call Unreserve as part of the error handling.
func (*DynamicResources) PreEnqueue ¶
PreEnqueue checks if there are known reasons why a pod currently cannot be scheduled. When this fails, one of the registered events can trigger another attempt.
func (*DynamicResources) PreFilter ¶
func (pl *DynamicResources) PreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status)
PreFilter invoked at the prefilter extension point to check if pod has all immediate claims bound. UnschedulableAndUnresolvable is returned if the pod cannot be scheduled at the moment on any node.
func (*DynamicResources) PreFilterExtensions ¶
func (pl *DynamicResources) PreFilterExtensions() framework.PreFilterExtensions
PreFilterExtensions returns prefilter extensions, pod add and remove.
func (*DynamicResources) Reserve ¶
func (pl *DynamicResources) Reserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) (status *framework.Status)
Reserve reserves claims for the pod.
func (*DynamicResources) Unreserve ¶
func (pl *DynamicResources) Unreserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string)
Unreserve clears the ReservedFor field for all claims. It's idempotent, and does nothing if no state found for the given pod.
Source Files ¶
allocateddevices.go dra_manager.go dynamicresources.go
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 33 packages
- Last checked
- 3 hours ago –
Tools for package owners.