external

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerDao added in v1.2.0

type ContainerDao struct {
	Name      string                  `json:"name"`
	Resources v1.ResourceRequirements `json:"resources"`
}

type NodeDao added in v1.2.0

type NodeDao struct {
	Name              string             `json:"name"`
	UID               types.UID          `json:"uid,omitempty"`
	NodeInfo          v1.NodeSystemInfo  `json:"nodeInfo"`
	CreationTimestamp time.Time          `json:"creationTimestamp"`
	Annotations       map[string]string  `json:"annotations,omitempty"`
	Labels            map[string]string  `json:"labels,omitempty"`
	PodCIDRs          []string           `json:"podCIDRs,omitempty"`
	Taints            []v1.Taint         `json:"taints,omitempty"`
	Addresses         []v1.NodeAddress   `json:"addresses,omitempty"`
	Allocatable       v1.ResourceList    `json:"allocatable,omitempty"`
	Capacity          v1.ResourceList    `json:"capacity,omitempty"`
	Conditions        []v1.NodeCondition `json:"conditions,omitempty"`
}

type PodDao added in v1.2.0

type PodDao struct {
	Namespace         string               `json:"namespace"`
	Name              string               `json:"name"`
	GenerateName      string               `json:"generateName,omitempty"`
	UID               types.UID            `json:"uid,omitempty"`
	CreationTimestamp time.Time            `json:"creationTimestamp"`
	Annotations       map[string]string    `json:"annotations,omitempty"`
	Labels            map[string]string    `json:"labels,omitempty"`
	NodeName          string               `json:"nodeName,omitempty"`
	Affinity          *v1.Affinity         `json:"affinity,omitempty"`
	NodeSelector      map[string]string    `json:"nodeSelector,omitempty"`
	PriorityClassName string               `json:"priorityClassName,omitempty"`
	Priority          *int32               `json:"priority,omitempty"`
	PreemptionPolicy  *v1.PreemptionPolicy `json:"preemptionPolicy,omitempty"`
	SchedulerName     string               `json:"schedulerName,omitempty"`
	Tolerations       []v1.Toleration      `json:"tolerations,omitempty"`
	Containers        []ContainerDao       `json:"containers,omitempty"`
	Status            v1.PodStatus         `json:"status"`
}

type PodSchedulingInfoDao added in v1.2.0

type PodSchedulingInfoDao struct {
	Namespace       string    `json:"-"`
	Name            string    `json:"-"`
	UID             types.UID `json:"uid,omitempty"`
	AssignedNode    string    `json:"assignedNode,omitempty"`
	Assumed         bool      `json:"assumed,omitempty"`
	AllVolumesBound bool      `json:"allVolumesBound,omitempty"`
	PendingNode     string    `json:"pendingNode,omitempty"`
	InProgressNode  string    `json:"inProgressNode,omitempty"`
}

type PriorityClassDao added in v1.2.0

type PriorityClassDao struct {
	Name             string               `json:"name"`
	Annotations      map[string]string    `json:"annotations,omitempty"`
	Labels           map[string]string    `json:"labels,omitempty"`
	Value            int32                `json:"value"`
	GlobalDefault    bool                 `json:"globalDefault,omitempty"`
	PreemptionPolicy *v1.PreemptionPolicy `json:"preemptionPolicy,omitempty"`
}

type SchedulerCache

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

SchedulerCache maintains some critical information about nodes and pods used for scheduling. Nodes are cached in the form of de-scheduler nodeInfo. Instead of re-creating all nodes info from scratch, we replicate nodes info from de-scheduler, in order to re-use predicates functions.

When running YuniKorn as a scheduler plugin, we also track pod allocations that YuniKorn has decided upon, but which have not yet been fulfilled by the default scheduler. This tracking is needed to ensure that we pass along allocations to the default scheduler once (and only) once. Allocations can be in one of two states, either pending or in-progress. A pending allocation is one which has been decided upon by YuniKorn but has not yet been communicated to the default scheduler via PreFilter() / Filter(). Once PreFilter() / Filter() pass, the allocation transitions to in-progress to signify that the default scheduler is responsible for fulfilling the allocation. Once PostBind() is called in the plugin to signify completion of the allocation, it is removed.

func NewSchedulerCache

func NewSchedulerCache(clients *client.Clients) *SchedulerCache

func (*SchedulerCache) AddPendingPodAllocation

func (cache *SchedulerCache) AddPendingPodAllocation(podKey string, nodeID string)

AddPendingPodAllocation is used to add a new pod -> node mapping to the cache when running in scheduler plugin mode. This function is called (in plugin mode) after a task is allocated by the YuniKorn scheduler.

func (*SchedulerCache) ArePodVolumesAllBound

func (cache *SchedulerCache) ArePodVolumesAllBound(podKey string) bool

func (*SchedulerCache) AssumePod

func (cache *SchedulerCache) AssumePod(pod *v1.Pod, allBound bool)

func (*SchedulerCache) ForgetPod

func (cache *SchedulerCache) ForgetPod(pod *v1.Pod)

func (*SchedulerCache) GetInProgressPodAllocation

func (cache *SchedulerCache) GetInProgressPodAllocation(podKey string) (nodeID string, ok bool)

GetInProgressPodAllocation is used in scheduler plugin mode to retrieve an in-progress pod allocation. An in-progress allocation is one which has been communicated to the default scheduler, but has not yet been bound.

func (*SchedulerCache) GetNode

func (cache *SchedulerCache) GetNode(name string) *framework.NodeInfo

func (*SchedulerCache) GetNodeInfo

func (cache *SchedulerCache) GetNodeInfo(nodeName string) (*v1.Node, error)

Implement scheduler/algorithm/predicates/predicates.go#NodeInfo interface

func (*SchedulerCache) GetNodesInfo added in v1.3.0

func (cache *SchedulerCache) GetNodesInfo() []*framework.NodeInfo

GetNodesInfo returns a (possibly cached) list of nodes. This is explicitly for the use of the predicate shared lister and requires that the scheduler cache lock be held while accessing.

func (*SchedulerCache) GetNodesInfoMap

func (cache *SchedulerCache) GetNodesInfoMap() map[string]*framework.NodeInfo

GetNodesInfoMap returns a reference to the internal node map. This is explicitly for the use of the predicate shared lister and requires that the scheduler cache lock be held while accessing.

func (*SchedulerCache) GetNodesInfoPodsWithAffinity added in v1.3.0

func (cache *SchedulerCache) GetNodesInfoPodsWithAffinity() []*framework.NodeInfo

GetNodesInfoPodsWithAffinity returns a (possibly cached) list of nodes which contain pods with affinity. This is explicitly for the use of the predicate shared lister and requires that the scheduler cache lock be held while accessing.

func (*SchedulerCache) GetNodesInfoPodsWithReqAntiAffinity added in v1.3.0

func (cache *SchedulerCache) GetNodesInfoPodsWithReqAntiAffinity() []*framework.NodeInfo

GetNodesInfoPodsWithReqAntiAffinity returns a (possibly cached) list of nodes which contain pods with required anti-affinity. This is explicitly for the use of the predicate shared lister and requires that the scheduler cache lock be held while accessing.

func (*SchedulerCache) GetPendingPodAllocation

func (cache *SchedulerCache) GetPendingPodAllocation(podKey string) (nodeID string, ok bool)

GetPendingPodAllocation is used in scheduler plugin mode to retrieve a pending pod allocation. A pending allocation is one which has been decided upon by YuniKorn but has not yet been communicated to the default scheduler.

func (*SchedulerCache) GetPersistentVolumeClaimInfo

func (cache *SchedulerCache) GetPersistentVolumeClaimInfo(nameSpace, name string) (*v1.PersistentVolumeClaim, error)

Implement scheduler/algorithm/predicates/predicates.go#PersistentVolumeClaimInfo interface

func (*SchedulerCache) GetPersistentVolumeInfo

func (cache *SchedulerCache) GetPersistentVolumeInfo(name string) (*v1.PersistentVolume, error)

Implement scheduler/algorithm/predicates/predicates.go#PersistentVolumeClaimInfo interface

func (*SchedulerCache) GetPod

func (cache *SchedulerCache) GetPod(uid string) (*v1.Pod, bool)

func (*SchedulerCache) GetPodNoLock added in v1.4.0

func (cache *SchedulerCache) GetPodNoLock(uid string) (*v1.Pod, bool)

func (*SchedulerCache) GetPriorityClass added in v1.2.0

func (cache *SchedulerCache) GetPriorityClass(name string) *schedulingv1.PriorityClass

func (*SchedulerCache) GetSchedulerCacheDao added in v1.2.0

func (cache *SchedulerCache) GetSchedulerCacheDao() SchedulerCacheDao

func (*SchedulerCache) GetStorageClassInfo

func (cache *SchedulerCache) GetStorageClassInfo(className string) (*storageV1.StorageClass, error)

Implement scheduler/algorithm/predicates/predicates.go#StorageClassInfo interface

func (*SchedulerCache) IsPVCUsedByPods added in v1.4.0

func (cache *SchedulerCache) IsPVCUsedByPods(key string) bool

IsPVCUsedByPods determines if a given volume claim is in use by any current pods. This is explicitly for the use of the predicate shared lister and requires that the scheduler cache lock be held while accessing.

func (*SchedulerCache) IsPodOrphaned added in v1.5.0

func (cache *SchedulerCache) IsPodOrphaned(uid string) bool

func (*SchedulerCache) IsTaskMaybeSchedulable added in v1.5.0

func (cache *SchedulerCache) IsTaskMaybeSchedulable(taskID string) bool

IsTaskMaybeSchedulable returns true if a task might be currently able to be scheduled. This uses a bloom filter cached from a set of taskIDs to perform efficient negative lookups.

func (*SchedulerCache) List

func (cache *SchedulerCache) List(selector labels.Selector) ([]*v1.Pod, error)

Implement k8s.io/client-go/listers/core/v1#PodLister interface

func (*SchedulerCache) LockForReads added in v1.1.0

func (cache *SchedulerCache) LockForReads()

func (*SchedulerCache) NotifyTaskSchedulerAction added in v1.5.0

func (cache *SchedulerCache) NotifyTaskSchedulerAction(taskID string)

NotifyTaskSchedulerAction registers the fact that a task has been evaluated for scheduling, and consequently the scheduler plugin should move it to the activeQ if requested to do so.

func (*SchedulerCache) RemoveNode

func (cache *SchedulerCache) RemoveNode(node *v1.Node) (*v1.Node, []*v1.Pod)

func (*SchedulerCache) RemovePod

func (cache *SchedulerCache) RemovePod(pod *v1.Pod)

RemovePod removes a pod from the cache

func (*SchedulerCache) RemovePodAllocation

func (cache *SchedulerCache) RemovePodAllocation(podKey string)

RemovePodAllocation is used to remove a pod -> node mapping from the cache when running in scheduler plugin mode. It removes both pending and in-progress allocations. This function is called (via cache) from the scheduler plugin in PreFilter() if a previous allocation was found, and in PostBind() to cleanup the allocation since it is no longer relevant.

func (*SchedulerCache) RemovePriorityClass added in v1.2.0

func (cache *SchedulerCache) RemovePriorityClass(priorityClass *schedulingv1.PriorityClass)

func (*SchedulerCache) SnapshotResources added in v1.5.0

func (cache *SchedulerCache) SnapshotResources(nodeName string) (capacity *si.Resource, occupied *si.Resource, ok bool)

func (*SchedulerCache) StartPodAllocation

func (cache *SchedulerCache) StartPodAllocation(podKey string, nodeID string) bool

StartPodAllocation is used in scheduler plugin mode to transition a pod allocation from pending to in-progress. If the given pod has a pending allocation on the given node, the allocation is marked as in-progress and this function returns true. If the pod is not pending or is pending on another node, this function does nothing and returns false.

func (*SchedulerCache) UnlockForReads added in v1.1.0

func (cache *SchedulerCache) UnlockForReads()

func (*SchedulerCache) UpdateCapacity added in v1.5.0

func (cache *SchedulerCache) UpdateCapacity(nodeName string, resource *si.Resource) (capacity *si.Resource, occupied *si.Resource, ok bool)

func (*SchedulerCache) UpdateNode

func (cache *SchedulerCache) UpdateNode(node *v1.Node) (*v1.Node, []*v1.Pod)

UpdateNode updates the given node in the cache and returns the previous node if it exists

func (*SchedulerCache) UpdateOccupiedResource added in v1.5.0

func (cache *SchedulerCache) UpdateOccupiedResource(nodeName string, namespace string, podName string, resource *si.Resource, opt UpdateType) (node *v1.Node, capacity *si.Resource, occupied *si.Resource, ok bool)

func (*SchedulerCache) UpdatePod

func (cache *SchedulerCache) UpdatePod(newPod *v1.Pod) bool

UpdatePod updates a pod in the cache

func (*SchedulerCache) UpdatePriorityClass added in v1.2.0

func (cache *SchedulerCache) UpdatePriorityClass(priorityClass *schedulingv1.PriorityClass)

type SchedulerCacheDao added in v1.2.0

type SchedulerCacheDao struct {
	Statistics      SchedulerCacheStatisticsDao     `json:"statistics"`
	Nodes           map[string]NodeDao              `json:"nodes,omitempty"`
	Pods            map[string]PodDao               `json:"pods,omitempty"`
	PriorityClasses map[string]PriorityClassDao     `json:"priorityClasses,omitempty"`
	SchedulingPods  map[string]PodSchedulingInfoDao `json:"schedulingState,omitempty"`
}

type SchedulerCacheStatisticsDao added in v1.2.0

type SchedulerCacheStatisticsDao struct {
	Nodes                 int            `json:"nodes,omitempty"`
	Pods                  int            `json:"pods,omitempty"`
	PriorityClasses       int            `json:"priorityClasses,omitempty"`
	Assumed               int            `json:"assumed,omitempty"`
	PendingAllocations    int            `json:"pendingAllocations,omitempty"`
	InProgressAllocations int            `json:"inProgressAllocations,omitempty"`
	PodsAssigned          int            `json:"podsAssigned,omitempty"`
	Phases                map[string]int `json:"phases,omitempty"`
}

type UpdateType added in v1.5.0

type UpdateType int
const (
	AddOccupiedResource UpdateType = iota
	SubOccupiedResource
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL