Documentation ¶
Index ¶
- Constants
- func CleanupPluginBuilders()
- func CloseSession(ssn *Session)
- func GenerateNodeMapAndSlice(nodes map[string]*api.NodeInfo) map[string]*k8sframework.NodeInfo
- func HaveAffinity(pod *v1.Pod) bool
- func LoadCustomPlugins(pluginsDir string) error
- func RegisterAction(act Action)
- func RegisterPluginBuilder(name string, pc PluginBuilder)
- func TimeJitterAfter(new, old time.Time, duration, maxJitter time.Duration) bool
- type Action
- type Arguments
- type CachedNodeInfo
- type Event
- type EventHandler
- type NodeLister
- type Operation
- type Plugin
- type PluginBuilder
- type PodAffinityLister
- type PodFilter
- type PodLister
- func (pl *PodLister) AffinityFilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
- func (pl *PodLister) AffinityLister() *PodAffinityLister
- func (pl *PodLister) FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
- func (pl *PodLister) GetPod(task *api.TaskInfo) *v1.Pod
- func (pl *PodLister) List(selector labels.Selector) ([]*v1.Pod, error)
- func (pl *PodLister) UpdateTask(task *api.TaskInfo, nodeName string) *v1.Pod
- type PodsLister
- type Session
- func (ssn *Session) AddAllocatableFn(name string, fn api.AllocatableFn)
- func (ssn *Session) AddBatchNodeOrderFn(name string, pf api.BatchNodeOrderFn)
- func (ssn *Session) AddBestNodeFn(name string, pf api.BestNodeFn)
- func (ssn *Session) AddClusterOrderFn(name string, qf api.CompareFn)
- func (ssn *Session) AddEventHandler(eh *EventHandler)
- func (ssn *Session) AddJobEnqueueableFn(name string, fn api.VoteFn)
- func (ssn *Session) AddJobEnqueuedFn(name string, fn api.JobEnqueuedFn)
- func (ssn *Session) AddJobOrderFn(name string, cf api.CompareFn)
- func (ssn *Session) AddJobPipelinedFn(name string, vf api.VoteFn)
- func (ssn *Session) AddJobReadyFn(name string, vf api.ValidateFn)
- func (ssn *Session) AddJobStarvingFns(name string, fn api.ValidateFn)
- func (ssn *Session) AddJobValidFn(name string, fn api.ValidateExFn)
- func (ssn *Session) AddNodeMapFn(name string, pf api.NodeMapFn)
- func (ssn *Session) AddNodeOrderFn(name string, pf api.NodeOrderFn)
- func (ssn *Session) AddNodeReduceFn(name string, pf api.NodeReduceFn)
- func (ssn *Session) AddOverusedFn(name string, fn api.ValidateFn)
- func (ssn *Session) AddPrePredicateFn(name string, pf api.PrePredicateFn)
- func (ssn *Session) AddPredicateFn(name string, pf api.PredicateFn)
- func (ssn *Session) AddPreemptableFn(name string, cf api.EvictableFn)
- func (ssn *Session) AddPreemptiveFn(name string, fn api.ValidateWithCandidateFn)
- func (ssn *Session) AddQueueOrderFn(name string, qf api.CompareFn)
- func (ssn *Session) AddReclaimableFn(name string, rf api.EvictableFn)
- func (ssn *Session) AddReservedNodesFn(name string, fn api.ReservedNodesFn)
- func (ssn *Session) AddTargetJobFn(name string, fn api.TargetJobFn)
- func (ssn *Session) AddTaskOrderFn(name string, cf api.CompareFn)
- func (ssn *Session) AddVictimTasksFns(name string, fns []api.VictimTasksFn)
- func (ssn *Session) Allocatable(queue *api.QueueInfo, candidate *api.TaskInfo) bool
- func (ssn *Session) Allocate(task *api.TaskInfo, nodeInfo *api.NodeInfo) (err error)
- func (ssn *Session) BatchNodeOrderFn(task *api.TaskInfo, nodes []*api.NodeInfo) (map[string]float64, error)
- func (ssn *Session) BestNodeFn(task *api.TaskInfo, nodeScores map[float64][]*api.NodeInfo) *api.NodeInfo
- func (ssn *Session) BindPodGroup(job *api.JobInfo, cluster string) error
- func (ssn *Session) BuildVictimsPriorityQueue(victims []*api.TaskInfo) *util.PriorityQueue
- func (ssn Session) ClientConfig() *rest.Config
- func (ssn *Session) ClusterOrderFn(l, r interface{}) bool
- func (ssn *Session) Evict(reclaimee *api.TaskInfo, reason string) error
- func (ssn *Session) GetUnschedulableAndUnresolvableNodesForTask(task *api.TaskInfo) []*api.NodeInfo
- func (ssn Session) InformerFactory() informers.SharedInformerFactory
- func (ssn *Session) JobEnqueueable(obj interface{}) bool
- func (ssn *Session) JobEnqueued(obj interface{})
- func (ssn *Session) JobOrderFn(l, r interface{}) bool
- func (ssn *Session) JobPipelined(obj interface{}) bool
- func (ssn *Session) JobReady(obj interface{}) bool
- func (ssn *Session) JobStarving(obj interface{}) bool
- func (ssn *Session) JobValid(obj interface{}) *api.ValidateResult
- func (ssn Session) KubeClient() kubernetes.Interface
- func (ssn *Session) NodeOrderFn(task *api.TaskInfo, node *api.NodeInfo) (float64, error)
- func (ssn *Session) NodeOrderMapFn(task *api.TaskInfo, node *api.NodeInfo) (map[string]float64, float64, error)
- func (ssn *Session) NodeOrderReduceFn(task *api.TaskInfo, pluginNodeScoreMap map[string]k8sframework.NodeScoreList) (map[string]float64, error)
- func (ssn *Session) Overused(queue *api.QueueInfo) bool
- func (ssn *Session) Pipeline(task *api.TaskInfo, hostname string) error
- func (ssn *Session) PrePredicateFn(task *api.TaskInfo) error
- func (ssn *Session) PredicateFn(task *api.TaskInfo, node *api.NodeInfo) error
- func (ssn *Session) PredicateForAllocateAction(task *api.TaskInfo, node *api.NodeInfo) error
- func (ssn *Session) PredicateForPreemptAction(task *api.TaskInfo, node *api.NodeInfo) error
- func (ssn *Session) Preemptable(preemptor *api.TaskInfo, preemptees []*api.TaskInfo) []*api.TaskInfo
- func (ssn *Session) Preemptive(queue *api.QueueInfo, candidate *api.TaskInfo) bool
- func (ssn *Session) QueueOrderFn(l, r interface{}) bool
- func (ssn *Session) Reclaimable(reclaimer *api.TaskInfo, reclaimees []*api.TaskInfo) []*api.TaskInfo
- func (ssn Session) RecordPodGroupEvent(podGroup *api.PodGroup, eventType, reason, msg string)
- func (ssn *Session) ReservedNodes()
- func (ssn *Session) Statement() *Statement
- func (ssn Session) String() string
- func (ssn *Session) TargetJob(jobs []*api.JobInfo) *api.JobInfo
- func (ssn *Session) TaskCompareFns(l, r interface{}) int
- func (ssn *Session) TaskOrderFn(l, r interface{}) bool
- func (ssn *Session) UpdatePodGroupCondition(jobInfo *api.JobInfo, cond *scheduling.PodGroupCondition) error
- func (ssn *Session) UpdateSchedulerNumaInfo(AllocatedSets map[string]api.ResNumaSets)
- func (ssn *Session) VictimTasks(tasks []*api.TaskInfo) map[*api.TaskInfo]bool
- type Statement
- func (s *Statement) Allocate(task *api.TaskInfo, nodeInfo *api.NodeInfo) (err error)
- func (s *Statement) Commit()
- func (s *Statement) Discard()
- func (s *Statement) Evict(reclaimee *api.TaskInfo, reason string) error
- func (s *Statement) Pipeline(task *api.TaskInfo, hostname string, evictionOccurred bool) error
- func (s *Statement) UnPipeline(task *api.TaskInfo) error
Constants ¶
const ( // Evict op Evict = iota // Pipeline op Pipeline // Allocate op Allocate )
Variables ¶
This section is empty.
Functions ¶
func CleanupPluginBuilders ¶
func CleanupPluginBuilders()
CleanupPluginBuilders cleans up all the plugin
func GenerateNodeMapAndSlice ¶ added in v1.8.0
GenerateNodeMapAndSlice returns the nodeMap and nodeSlice generated from ssn
func HaveAffinity ¶ added in v1.8.0
HaveAffinity checks pod have affinity or not
func LoadCustomPlugins ¶ added in v1.1.1
LoadCustomPlugins loads custom implement plugins
func RegisterPluginBuilder ¶
func RegisterPluginBuilder(name string, pc PluginBuilder)
RegisterPluginBuilder register the plugin
Types ¶
type Action ¶
type Action interface { // The unique name of Action. Name() string // Initialize initializes the allocator plugins. Initialize() // Execute allocates the cluster's resources into each queue. Execute(ssn *Session) // UnInitialize un-initializes the allocator plugins. UnInitialize() }
Action is the interface of scheduler action.
type Arguments ¶
type Arguments map[string]interface{}
Arguments map
func GetArgOfActionFromConf ¶
func GetArgOfActionFromConf(configurations []conf.Configuration, actionName string) Arguments
GetArgOfActionFromConf return argument of action reading from configuration of schedule
func (Arguments) GetFloat64 ¶
GetFloat64 get the float64 value from string
type CachedNodeInfo ¶ added in v1.8.0
type CachedNodeInfo struct {
Session *Session
}
CachedNodeInfo is used in nodeorder and predicate plugin
func (*CachedNodeInfo) GetNodeInfo ¶ added in v1.8.0
func (c *CachedNodeInfo) GetNodeInfo(name string) (*v1.Node, error)
GetNodeInfo is used to get info of a particular node
type EventHandler ¶
EventHandler structure
type NodeLister ¶ added in v1.8.0
type NodeLister struct {
Session *Session
}
NodeLister is used in nodeorder plugin
type Plugin ¶
type Plugin interface { // The unique name of Plugin. Name() string OnSessionOpen(ssn *Session) OnSessionClose(ssn *Session) }
Plugin is the interface of scheduler plugin
type PluginBuilder ¶
PluginBuilder plugin management
func GetPluginBuilder ¶
func GetPluginBuilder(name string) (PluginBuilder, bool)
GetPluginBuilder get the pluginbuilder by name
type PodAffinityLister ¶ added in v1.8.0
type PodAffinityLister struct {
// contains filtered or unexported fields
}
PodAffinityLister is used to list pod with affinity
func (*PodAffinityLister) FilteredList ¶ added in v1.8.0
func (pal *PodAffinityLister) FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
FilteredList is used to list all the pods with affinity under filter condition
type PodFilter ¶ added in v1.8.0
PodFilter is a function to filter a pod. If pod passed return true else return false.
type PodLister ¶ added in v1.8.0
type PodLister struct { Session *Session CachedPods map[api.TaskID]*v1.Pod Tasks map[api.TaskID]*api.TaskInfo TaskWithAffinity map[api.TaskID]*api.TaskInfo }
PodLister is used in predicate and nodeorder plugin
func NewPodLister ¶ added in v1.8.0
NewPodLister returns a PodLister generate from ssn
func NewPodListerFromNode ¶ added in v1.8.0
NewPodListerFromNode returns a PodLister generate from ssn
func (*PodLister) AffinityFilteredList ¶ added in v1.8.0
func (pl *PodLister) AffinityFilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
AffinityFilteredList is used to list all the pods with affinity under filter condition
func (*PodLister) AffinityLister ¶ added in v1.8.0
func (pl *PodLister) AffinityLister() *PodAffinityLister
AffinityLister generate a PodAffinityLister following current PodLister
func (*PodLister) FilteredList ¶ added in v1.8.0
FilteredList is used to list all the pods under filter condition
func (*PodLister) GetPod ¶ added in v1.8.0
GetPod will get pod with proper nodeName, from cache or DeepCopy keeping this function read only to avoid concurrent panic of map
type PodsLister ¶ added in v1.8.0
type PodsLister interface { // Returns the list of pods. List(labels.Selector) ([]*v1.Pod, error) // This is similar to "List()", but the returned slice does not // contain pods that don't pass `podFilter`. FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error) }
PodsLister interface represents anything that can list pods for a scheduler.
type Session ¶
type Session struct { UID types.UID TotalResource *api.Resource Jobs map[api.JobID]*api.JobInfo Nodes map[string]*api.NodeInfo CSINodesStatus map[string]*api.CSINodeStatusInfo RevocableNodes map[string]*api.NodeInfo Queues map[api.QueueID]*api.QueueInfo NamespaceInfo map[api.NamespaceName]*api.NamespaceInfo // NodeMap is like Nodes except that it uses k8s NodeInfo api and should only // be used in k8s compatable api scenarios such as in predicates and nodeorder plugins. NodeMap map[string]*k8sframework.NodeInfo PodLister *PodLister Tiers []conf.Tier Configurations []conf.Configuration NodeList []*api.NodeInfo // contains filtered or unexported fields }
Session information for the current session
func OpenSession ¶
func OpenSession(cache cache.Cache, tiers []conf.Tier, configurations []conf.Configuration) *Session
OpenSession start the session
func (*Session) AddAllocatableFn ¶ added in v1.5.1
func (ssn *Session) AddAllocatableFn(name string, fn api.AllocatableFn)
AddAllocatableFn add allocatable function
func (*Session) AddBatchNodeOrderFn ¶
func (ssn *Session) AddBatchNodeOrderFn(name string, pf api.BatchNodeOrderFn)
AddBatchNodeOrderFn add Batch Node order function
func (*Session) AddBestNodeFn ¶ added in v0.4.1
func (ssn *Session) AddBestNodeFn(name string, pf api.BestNodeFn)
AddBestNodeFn add BestNode function
func (*Session) AddClusterOrderFn ¶ added in v1.4.0
AddClusterOrderFn add queue order function
func (*Session) AddEventHandler ¶
func (ssn *Session) AddEventHandler(eh *EventHandler)
AddEventHandler add event handlers
func (*Session) AddJobEnqueueableFn ¶
AddJobEnqueueableFn add jobenqueueable function
func (*Session) AddJobEnqueuedFn ¶ added in v1.4.0
func (ssn *Session) AddJobEnqueuedFn(name string, fn api.JobEnqueuedFn)
AddJobEnqueuedFn add jobEnqueued function
func (*Session) AddJobOrderFn ¶
AddJobOrderFn add job order function
func (*Session) AddJobPipelinedFn ¶
AddJobPipelinedFn add pipelined function
func (*Session) AddJobReadyFn ¶
func (ssn *Session) AddJobReadyFn(name string, vf api.ValidateFn)
AddJobReadyFn add JobReady function
func (*Session) AddJobStarvingFns ¶ added in v1.2.0
func (ssn *Session) AddJobStarvingFns(name string, fn api.ValidateFn)
AddJobStarvingFns add jobStarvingFns function
func (*Session) AddJobValidFn ¶
func (ssn *Session) AddJobValidFn(name string, fn api.ValidateExFn)
AddJobValidFn add jobvalid function
func (*Session) AddNodeMapFn ¶
AddNodeMapFn add Node map function
func (*Session) AddNodeOrderFn ¶
func (ssn *Session) AddNodeOrderFn(name string, pf api.NodeOrderFn)
AddNodeOrderFn add Node order function
func (*Session) AddNodeReduceFn ¶
func (ssn *Session) AddNodeReduceFn(name string, pf api.NodeReduceFn)
AddNodeReduceFn add Node reduce function
func (*Session) AddOverusedFn ¶
func (ssn *Session) AddOverusedFn(name string, fn api.ValidateFn)
AddOverusedFn add overused function
func (*Session) AddPrePredicateFn ¶ added in v1.7.0
func (ssn *Session) AddPrePredicateFn(name string, pf api.PrePredicateFn)
AddPrePredicateFn add PrePredicate function
func (*Session) AddPredicateFn ¶
func (ssn *Session) AddPredicateFn(name string, pf api.PredicateFn)
AddPredicateFn add Predicate function
func (*Session) AddPreemptableFn ¶
func (ssn *Session) AddPreemptableFn(name string, cf api.EvictableFn)
AddPreemptableFn add preemptable function
func (*Session) AddPreemptiveFn ¶ added in v1.9.0
func (ssn *Session) AddPreemptiveFn(name string, fn api.ValidateWithCandidateFn)
AddPreemptiveFn add preemptive function
func (*Session) AddQueueOrderFn ¶
AddQueueOrderFn add queue order function
func (*Session) AddReclaimableFn ¶
func (ssn *Session) AddReclaimableFn(name string, rf api.EvictableFn)
AddReclaimableFn add Reclaimable function
func (*Session) AddReservedNodesFn ¶ added in v1.1.0
func (ssn *Session) AddReservedNodesFn(name string, fn api.ReservedNodesFn)
AddReservedNodesFn add reservedNodesFn function
func (*Session) AddTargetJobFn ¶ added in v1.1.0
func (ssn *Session) AddTargetJobFn(name string, fn api.TargetJobFn)
AddTargetJobFn add targetjob function
func (*Session) AddTaskOrderFn ¶
AddTaskOrderFn add task order function
func (*Session) AddVictimTasksFns ¶ added in v1.2.0
func (ssn *Session) AddVictimTasksFns(name string, fns []api.VictimTasksFn)
AddVictimTasksFns add victimTasksFns function
func (*Session) Allocatable ¶ added in v1.5.1
Allocatable invoke allocatable function of the plugins
func (*Session) BatchNodeOrderFn ¶
func (ssn *Session) BatchNodeOrderFn(task *api.TaskInfo, nodes []*api.NodeInfo) (map[string]float64, error)
BatchNodeOrderFn invoke node order function of the plugins
func (*Session) BestNodeFn ¶ added in v0.4.1
func (ssn *Session) BestNodeFn(task *api.TaskInfo, nodeScores map[float64][]*api.NodeInfo) *api.NodeInfo
BestNodeFn invoke bestNode function of the plugins
func (*Session) BindPodGroup ¶ added in v1.4.0
BindPodGroup bind PodGroup to specified cluster
func (*Session) BuildVictimsPriorityQueue ¶ added in v1.9.0
func (ssn *Session) BuildVictimsPriorityQueue(victims []*api.TaskInfo) *util.PriorityQueue
BuildVictimsPriorityQueue returns a priority queue with victims sorted by: if victims has same job id, sorted by !ssn.TaskOrderFn if victims has different job id, sorted by !ssn.JobOrderFn
func (Session) ClientConfig ¶ added in v1.6.1
ClientConfig returns the rest client
func (*Session) ClusterOrderFn ¶ added in v1.4.0
ClusterOrderFn invoke ClusterOrderFn function of the plugins
func (*Session) GetUnschedulableAndUnresolvableNodesForTask ¶ added in v1.10.0
GetUnschedulableAndUnresolvableNodesForTask filter out those node that has UnschedulableAndUnresolvable
func (Session) InformerFactory ¶ added in v1.4.0
func (ssn Session) InformerFactory() informers.SharedInformerFactory
InformerFactory returns the scheduler ShareInformerFactory
func (*Session) JobEnqueueable ¶
JobEnqueueable invoke jobEnqueueableFns function of the plugins
func (*Session) JobEnqueued ¶ added in v1.4.0
func (ssn *Session) JobEnqueued(obj interface{})
JobEnqueued invoke jobEnqueuedFns function of the plugins
func (*Session) JobOrderFn ¶
JobOrderFn invoke joborder function of the plugins
func (*Session) JobPipelined ¶
JobPipelined invoke pipelined function of the plugins Check if job has get enough resource to run
func (*Session) JobStarving ¶ added in v1.2.0
JobStarving invoke jobStarving function of the plugins Check if job still need more resource
func (*Session) JobValid ¶
func (ssn *Session) JobValid(obj interface{}) *api.ValidateResult
JobValid invoke jobvalid function of the plugins
func (Session) KubeClient ¶ added in v1.0.0
func (ssn Session) KubeClient() kubernetes.Interface
KubeClient returns the kubernetes client
func (*Session) NodeOrderFn ¶
NodeOrderFn invoke node order function of the plugins
func (*Session) NodeOrderMapFn ¶
func (ssn *Session) NodeOrderMapFn(task *api.TaskInfo, node *api.NodeInfo) (map[string]float64, float64, error)
NodeOrderMapFn invoke node order function of the plugins
func (*Session) NodeOrderReduceFn ¶
func (ssn *Session) NodeOrderReduceFn(task *api.TaskInfo, pluginNodeScoreMap map[string]k8sframework.NodeScoreList) (map[string]float64, error)
NodeOrderReduceFn invoke node order function of the plugins
func (*Session) PrePredicateFn ¶ added in v1.7.0
PrePredicateFn invoke predicate function of the plugins
func (*Session) PredicateFn ¶
PredicateFn invoke predicate function of the plugins
func (*Session) PredicateForAllocateAction ¶ added in v1.10.0
PredicateForAllocateAction checks if the predicate error contains - Unschedulable - UnschedulableAndUnresolvable - ErrorSkipOrWait
func (*Session) PredicateForPreemptAction ¶ added in v1.10.0
PredicateForPreemptAction checks if the predicate error contains: - UnschedulableAndUnresolvable - ErrorSkipOrWait
func (*Session) Preemptable ¶
func (ssn *Session) Preemptable(preemptor *api.TaskInfo, preemptees []*api.TaskInfo) []*api.TaskInfo
Preemptable invoke preemptable function of the plugins
func (*Session) Preemptive ¶ added in v1.9.0
Preemptive invoke can preemptive function of the plugins
func (*Session) QueueOrderFn ¶
QueueOrderFn invoke queueorder function of the plugins
func (*Session) Reclaimable ¶
func (ssn *Session) Reclaimable(reclaimer *api.TaskInfo, reclaimees []*api.TaskInfo) []*api.TaskInfo
Reclaimable invoke reclaimable function of the plugins
func (Session) RecordPodGroupEvent ¶ added in v1.6.0
RecordPodGroupEvent records podGroup events
func (*Session) ReservedNodes ¶ added in v1.1.0
func (ssn *Session) ReservedNodes()
ReservedNodes invoke ReservedNodes function of the plugins
func (*Session) TaskCompareFns ¶
TaskCompareFns invoke taskorder function of the plugins
func (*Session) TaskOrderFn ¶
TaskOrderFn invoke taskorder function of the plugins
func (*Session) UpdatePodGroupCondition ¶ added in v0.4.2
func (ssn *Session) UpdatePodGroupCondition(jobInfo *api.JobInfo, cond *scheduling.PodGroupCondition) error
UpdatePodGroupCondition update job condition accordingly.
func (*Session) UpdateSchedulerNumaInfo ¶ added in v1.4.0
func (ssn *Session) UpdateSchedulerNumaInfo(AllocatedSets map[string]api.ResNumaSets)
UpdateSchedulerNumaInfo update SchedulerNumaInfo
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
Statement structure
func NewStatement ¶ added in v1.0.0
NewStatement returns new statement object
func (*Statement) Discard ¶
func (s *Statement) Discard()
Discard operation for evict, pipeline and allocate