Documentation ¶
Index ¶
- Constants
- type Gang
- type GangCache
- type GangSummary
- type Manager
- type PodGroupManager
- func (pgMgr *PodGroupManager) ActivateSiblings(pod *corev1.Pod, state *framework.CycleState)
- func (pgMgr *PodGroupManager) AllowGangGroup(pod *corev1.Pod, handle framework.Handle, pluginName string)
- func (pgMgr *PodGroupManager) GetAllPodsFromGang(gangId string) []*corev1.Pod
- func (pgMgr *PodGroupManager) GetChildScheduleCycle(pod *corev1.Pod) int
- func (pgMgr *PodGroupManager) GetCreatTime(podInfo *framework.QueuedPodInfo) time.Time
- func (pgMgr *PodGroupManager) GetGangByPod(pod *corev1.Pod) *Gang
- func (pgMgr *PodGroupManager) GetGangSummaries() map[string]*GangSummary
- func (pgMgr *PodGroupManager) GetGangSummary(gangId string) (*GangSummary, bool)
- func (pgMgr *PodGroupManager) GetGroupId(pod *corev1.Pod) (string, error)
- func (pgMgr *PodGroupManager) GetPodGroup(pod *corev1.Pod) (string, *v1alpha1.PodGroup)
- func (pgMgr *PodGroupManager) IsGangMinSatisfied(pod *corev1.Pod) bool
- func (pgMgr *PodGroupManager) OnPodAdd(obj interface{})
- func (pgMgr *PodGroupManager) OnPodDelete(obj interface{})
- func (pgMgr *PodGroupManager) OnPodGroupAdd(obj interface{})
- func (pgMgr *PodGroupManager) OnPodGroupDelete(obj interface{})
- func (pgMgr *PodGroupManager) PatchPodGroup(pgName string, namespace string, patch []byte) error
- func (pgMgr *PodGroupManager) Permit(ctx context.Context, pod *corev1.Pod) (time.Duration, Status)
- func (pgMgr *PodGroupManager) PostBind(ctx context.Context, pod *corev1.Pod, nodeName string)
- func (pgMgr *PodGroupManager) PostFilter(ctx context.Context, pod *corev1.Pod, handle framework.Handle, ...) (*framework.PostFilterResult, *framework.Status)
- func (pgMgr *PodGroupManager) PreFilter(ctx context.Context, pod *corev1.Pod) error
- func (pgMgr *PodGroupManager) Unreserve(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...)
- type Status
Constants ¶
const ( GangFromPodGroupCrd string = "GangFromPodGroupCrd" GangFromPodAnnotation string = "GangFromPodAnnotation" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gang ¶
type Gang struct { Name string WaitTime time.Duration CreateTime time.Time // strict-mode or non-strict-mode Mode string MinRequiredNumber int TotalChildrenNum int GangGroupId string GangGroup []string Children map[string]*v1.Pod // pods that have already assumed(waiting in Permit stage) WaitingForBindChildren map[string]*v1.Pod // pods that have already bound BoundChildren map[string]*v1.Pod // OnceResourceSatisfied indicates whether the gang has ever reached the ResourceSatisfied state,which means the // children number has reached the minNum in the early step, // once this variable is set true, it is irreversible. OnceResourceSatisfied bool // only-waiting, only consider waiting pods // waiting-and-running, consider waiting and running pods // waiting-running-succeed, consider waiting, running and succeed pods // once-satisfied, once gang is satisfied, no need to consider any status pods GangMatchPolicy string // if the podGroup should be passed at PreFilter stage(Strict-Mode) ScheduleCycleValid bool // these fields used to count the cycle // For example, at the beginning, `scheduleCycle` is 1, and each pod's cycle in `childrenScheduleRoundMap` is 0. When each pod comes to PreFilter, // we will check if the pod's value in `childrenScheduleRoundMap` is smaller than Gang's `scheduleCycle`, If result is positive, // we set the pod's cycle in `childrenScheduleRoundMap` equal with `scheduleCycle` and pass the check. If result is negative, means // the pod has been scheduled in this cycle, so we should reject it. With `totalChildrenNum`'s help, when the last pod comes to make all // `childrenScheduleRoundMap`'s values equal to `scheduleCycle`, Gang's `scheduleCycle` will be added by 1, which means a new schedule cycle. ScheduleCycle int ChildrenScheduleRoundMap map[string]int GangFrom string HasGangInit bool // contains filtered or unexported fields }
Gang basic podGroup info recorded in gangCache:
func (*Gang) GetGangSummary ¶
func (gang *Gang) GetGangSummary() *GangSummary
type GangCache ¶
type GangCache struct {
// contains filtered or unexported fields
}
func NewGangCache ¶
func NewGangCache(args *config.CoschedulingArgs, podLister listerv1.PodLister, pgLister pglister.PodGroupLister, client pgclientset.Interface) *GangCache
type GangSummary ¶
type GangSummary struct { Name string `json:"name"` WaitTime time.Duration `json:"waitTime"` CreateTime time.Time `json:"createTime"` Mode string `json:"mode"` GangMatchPolicy string `json:"gangMatchPolicy"` MinRequiredNumber int `json:"minRequiredNumber"` TotalChildrenNum int `json:"totalChildrenNum"` GangGroup []string `json:"gangGroup"` Children sets.String `json:"children"` WaitingForBindChildren sets.String `json:"waitingForBindChildren"` BoundChildren sets.String `json:"boundChildren"` OnceResourceSatisfied bool `json:"onceResourceSatisfied"` ScheduleCycleValid bool `json:"scheduleCycleValid"` ScheduleCycle int `json:"scheduleCycle"` ChildrenScheduleRoundMap map[string]int `json:"childrenScheduleRoundMap"` GangFrom string `json:"gangFrom"` HasGangInit bool `json:"hasGangInit"` }
type Manager ¶
type Manager interface { PreFilter(context.Context, *corev1.Pod) error Permit(context.Context, *corev1.Pod) (time.Duration, Status) PostBind(context.Context, *corev1.Pod, string) PostFilter(context.Context, *corev1.Pod, framework.Handle, string, framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status) GetCreatTime(*framework.QueuedPodInfo) time.Time GetGroupId(*corev1.Pod) (string, error) GetAllPodsFromGang(string) []*corev1.Pod ActivateSiblings(*corev1.Pod, *framework.CycleState) AllowGangGroup(*corev1.Pod, framework.Handle, string) Unreserve(context.Context, *framework.CycleState, *corev1.Pod, string, framework.Handle, string) GetGangSummary(gangId string) (*GangSummary, bool) GetGangSummaries() map[string]*GangSummary IsGangMinSatisfied(*corev1.Pod) bool GetChildScheduleCycle(*corev1.Pod) int }
Manager defines the interfaces for PodGroup management.
type PodGroupManager ¶
PodGroupManager defines the scheduling operation called
func NewPodGroupManager ¶
func NewPodGroupManager( args *config.CoschedulingArgs, pgClient pgclientset.Interface, pgSharedInformerFactory pgformers.SharedInformerFactory, sharedInformerFactory informers.SharedInformerFactory, koordSharedInformerFactory koordinatorinformers.SharedInformerFactory, ) *PodGroupManager
NewPodGroupManager creates a new operation object.
func (*PodGroupManager) ActivateSiblings ¶
func (pgMgr *PodGroupManager) ActivateSiblings(pod *corev1.Pod, state *framework.CycleState)
ActivateSiblings stashes the pods belonging to the same PodGroup of the given pod in the given state, with a reserved key "kubernetes.io/pods-to-activate".
func (*PodGroupManager) AllowGangGroup ¶
func (*PodGroupManager) GetAllPodsFromGang ¶
func (pgMgr *PodGroupManager) GetAllPodsFromGang(gangId string) []*corev1.Pod
func (*PodGroupManager) GetChildScheduleCycle ¶ added in v1.4.0
func (pgMgr *PodGroupManager) GetChildScheduleCycle(pod *corev1.Pod) int
func (*PodGroupManager) GetCreatTime ¶
func (pgMgr *PodGroupManager) GetCreatTime(podInfo *framework.QueuedPodInfo) time.Time
func (*PodGroupManager) GetGangByPod ¶
func (pgMgr *PodGroupManager) GetGangByPod(pod *corev1.Pod) *Gang
func (*PodGroupManager) GetGangSummaries ¶ added in v1.0.0
func (pgMgr *PodGroupManager) GetGangSummaries() map[string]*GangSummary
func (*PodGroupManager) GetGangSummary ¶
func (pgMgr *PodGroupManager) GetGangSummary(gangId string) (*GangSummary, bool)
func (*PodGroupManager) GetGroupId ¶ added in v1.1.1
func (pgMgr *PodGroupManager) GetGroupId(pod *corev1.Pod) (string, error)
func (*PodGroupManager) GetPodGroup ¶
GetPodGroup returns the PodGroup that a Pod belongs to in cache.
func (*PodGroupManager) IsGangMinSatisfied ¶ added in v1.1.1
func (pgMgr *PodGroupManager) IsGangMinSatisfied(pod *corev1.Pod) bool
func (*PodGroupManager) OnPodAdd ¶
func (pgMgr *PodGroupManager) OnPodAdd(obj interface{})
func (*PodGroupManager) OnPodDelete ¶
func (pgMgr *PodGroupManager) OnPodDelete(obj interface{})
func (*PodGroupManager) OnPodGroupAdd ¶
func (pgMgr *PodGroupManager) OnPodGroupAdd(obj interface{})
func (*PodGroupManager) OnPodGroupDelete ¶
func (pgMgr *PodGroupManager) OnPodGroupDelete(obj interface{})
func (*PodGroupManager) PatchPodGroup ¶
func (pgMgr *PodGroupManager) PatchPodGroup(pgName string, namespace string, patch []byte) error
PatchPodGroup patches a podGroup.
func (*PodGroupManager) Permit ¶
Permit we will calculate all Gangs in GangGroup whether the current number of assumed-pods in each Gang meets the Gang's minimum requirement. and decide whether we should let the pod wait in Permit stage or let the whole gangGroup go binding
func (*PodGroupManager) PostFilter ¶
func (pgMgr *PodGroupManager) PostFilter(ctx context.Context, pod *corev1.Pod, handle framework.Handle, pluginName string, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)
PostFilter i. If strict-mode, we will set scheduleCycleValid to false and release all assumed pods. ii. If non-strict mode, we will do nothing.
func (*PodGroupManager) PreFilter ¶
PreFilter i.Check whether children in Gang has met the requirements of minimum number under each Gang, and reject the pod if negative. ii.Check whether the Gang is inited, and reject the pod if positive. iii.Check whether the Gang is OnceResourceSatisfied iv.Check whether the Gang has met the scheduleCycleValid check, and reject the pod if negative(only Strict mode ). v.Try update scheduleCycle, scheduleCycleValid, childrenScheduleRoundMap as mentioned above.
func (*PodGroupManager) Unreserve ¶
func (pgMgr *PodGroupManager) Unreserve(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string, handle framework.Handle, pluginName string)
Unreserve if gang is resourceSatisfied, we only delAssumedPod if gang is not resourceSatisfied and is in StrictMode, we release all the assumed pods
type Status ¶
type Status string
const ( // PodGroupNotSpecified denotes no PodGroup is specified in the Pod spec. PodGroupNotSpecified Status = "PodGroup not specified" // PodGroupNotFound denotes the specified PodGroup in the Pod spec is // not found in API server. PodGroupNotFound Status = "PodGroup not found" Success Status = "Success" Wait Status = "Wait" )