Documentation ¶
Index ¶
- type ResourceClaimId
- type Snapshot
- func (s Snapshot) AddClaims(newClaims []*resourceapi.ResourceClaim) error
- func (s Snapshot) AddNodeResourceSlices(nodeName string, slices []*resourceapi.ResourceSlice) error
- func (s Snapshot) Clone() Snapshot
- func (s Snapshot) DeviceClasses() schedulerframework.DeviceClassLister
- func (s Snapshot) NodeResourceSlices(nodeName string) ([]*resourceapi.ResourceSlice, bool)
- func (s Snapshot) PodClaims(pod *apiv1.Pod) ([]*resourceapi.ResourceClaim, error)
- func (s Snapshot) RemoveNodeResourceSlices(nodeName string)
- func (s Snapshot) RemovePodOwnedClaims(pod *apiv1.Pod)
- func (s Snapshot) ReservePodClaims(pod *apiv1.Pod) error
- func (s Snapshot) ResourceClaims() schedulerframework.ResourceClaimTracker
- func (s Snapshot) ResourceSlices() schedulerframework.ResourceSliceLister
- func (s Snapshot) UnreservePodClaims(pod *apiv1.Pod) error
- func (s Snapshot) WrapSchedulerNodeInfo(schedNodeInfo *schedulerframework.NodeInfo) (*framework.NodeInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceClaimId ¶
ResourceClaimId is a unique identifier for a ResourceClaim.
func GetClaimId ¶
func GetClaimId(claim *resourceapi.ResourceClaim) ResourceClaimId
GetClaimId returns the unique identifier for a ResourceClaim.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot contains a snapshot of all DRA objects taken at a ~single point in time. The Snapshot should be obtained via the Provider. Then, it can be modified using the exposed methods, to simulate scheduling actions in the cluster.
func NewSnapshot ¶
func NewSnapshot(claims map[ResourceClaimId]*resourceapi.ResourceClaim, nodeLocalSlices map[string][]*resourceapi.ResourceSlice, globalSlices []*resourceapi.ResourceSlice, deviceClasses map[string]*resourceapi.DeviceClass) Snapshot
NewSnapshot returns a Snapshot created from the provided data.
func (Snapshot) AddClaims ¶
func (s Snapshot) AddClaims(newClaims []*resourceapi.ResourceClaim) error
AddClaims adds additional ResourceClaims to the Snapshot. It can be used e.g. if we need to duplicate a Pod that owns ResourceClaims. Returns an error if any of the claims is already tracked in the snapshot.
func (Snapshot) AddNodeResourceSlices ¶
func (s Snapshot) AddNodeResourceSlices(nodeName string, slices []*resourceapi.ResourceSlice) error
AddNodeResourceSlices adds additional node-local ResourceSlices to the Snapshot. This should be used whenever a Node with node-local ResourceSlices is duplicated in the cluster snapshot.
func (Snapshot) Clone ¶
Clone returns a copy of this Snapshot that can be independently modified without affecting this Snapshot. The only mutable objects in the Snapshot are ResourceClaims, so they are deep-copied. The rest is only a shallow copy.
func (Snapshot) DeviceClasses ¶
func (s Snapshot) DeviceClasses() schedulerframework.DeviceClassLister
DeviceClasses exposes the Snapshot as schedulerframework.DeviceClassLister, in order to interact with the scheduler framework.
func (Snapshot) NodeResourceSlices ¶
func (s Snapshot) NodeResourceSlices(nodeName string) ([]*resourceapi.ResourceSlice, bool)
NodeResourceSlices returns all node-local ResourceSlices for the given Node.
func (Snapshot) PodClaims ¶
func (s Snapshot) PodClaims(pod *apiv1.Pod) ([]*resourceapi.ResourceClaim, error)
PodClaims returns ResourceClaims objects for all claims referenced by the Pod. If any of the referenced claims isn't tracked in the Snapshot, an error is returned.
func (Snapshot) RemoveNodeResourceSlices ¶
RemoveNodeResourceSlices removes all node-local ResourceSlices for the Node with the given nodeName. It's a no-op if there aren't any slices to remove.
func (Snapshot) RemovePodOwnedClaims ¶
RemovePodOwnedClaims iterates over all the claims referenced by the Pod, and removes the ones owned by the Pod from the Snapshot. Claims referenced by the Pod but not owned by it are not removed, but the Pod's reservation is removed from them. This method removes all relevant claims that are in the snapshot, and doesn't error out if any of the claims are missing.
func (Snapshot) ReservePodClaims ¶
ReservePodClaims adds a reservation for the provided Pod to all the claims it references. If any of the referenced claims isn't tracked in the Snapshot, or if any of the claims are already at maximum reservation count, an error is returned.
func (Snapshot) ResourceClaims ¶
func (s Snapshot) ResourceClaims() schedulerframework.ResourceClaimTracker
ResourceClaims exposes the Snapshot as schedulerframework.ResourceClaimTracker, in order to interact with the scheduler framework.
func (Snapshot) ResourceSlices ¶
func (s Snapshot) ResourceSlices() schedulerframework.ResourceSliceLister
ResourceSlices exposes the Snapshot as schedulerframework.ResourceSliceLister, in order to interact with the scheduler framework.
func (Snapshot) UnreservePodClaims ¶
UnreservePodClaims removes reservations for the provided Pod from all the claims it references. If any of the referenced claims isn't tracked in the Snapshot, an error is returned. If a claim is owned by the pod, or if the claim has no more reservations, its allocation is cleared.
func (Snapshot) WrapSchedulerNodeInfo ¶
func (s Snapshot) WrapSchedulerNodeInfo(schedNodeInfo *schedulerframework.NodeInfo) (*framework.NodeInfo, error)
WrapSchedulerNodeInfo wraps the provided *schedulerframework.NodeInfo into an internal *framework.NodeInfo, adding dra information. Node-local ResourceSlices are added to the NodeInfo, and all ResourceClaims referenced by each Pod are added to each PodInfo. Returns an error if any of the Pods is missing a ResourceClaim.