scheduler

package
v0.0.0-...-03926e5 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "naglfar-scheduler"
)

Name is the name of naglfar scheduler

View Source
const (
	// PodGroupLabel is the default label of naglfar scheduler
	PodGroupLabel = "naglfar/podgroup"
)

Variables

This section is empty.

Functions

func New

New is the constructor of Scheduler

Types

type Args

type Args struct {
	// KubeConfig is the kubeconfig file path
	KubeConfig string `yaml:"kubeconfig" json:"kubeconfig"`
	// ScheduleTimeout is the wait duration in scheduling
	ScheduleTimeout util.Duration `yaml:"scheduleTimeout" json:"scheduleTimeout"`
	// RescheduleDelayOffset is the shift of the next reschedule time since now
	RescheduleDelayOffset util.Duration `yaml:"rescheduleDelayOffset" json:"rescheduleDelayOffset"`
}

Args is the arguements for initializing scheduler

type NoOp

type NoOp struct{}

NoOp ...

func (NoOp) Clone

func (n NoOp) Clone() framework.StateData

type PodGroupManager

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

PodGroupManager is the mananger of podgroup

func NewPodGroupManager

func NewPodGroupManager(snapshotSharedLister framework.SharedLister,
	scheduleTimeout time.Duration,
	podInformer informerv1.PodInformer,
	kubeClientSet clientset.Interface,
	schedulingClient *client.SchedulingClient) *PodGroupManager

NewPodGroupManager is the constructor of PodGroupManager

func (*PodGroupManager) Permit

func (mgr *PodGroupManager) Permit(
	ctx context.Context,
	pod *corev1.Pod,
	nodeName string,
	defaultTimeout time.Duration) (bool, time.Duration, error)

Permit permits a pod to run

func (*PodGroupManager) PreFilter

func (mgr *PodGroupManager) PreFilter(ctx context.Context, pod *corev1.Pod) error

PreFilter filters out a pod if it - Check if the numbers of total pods is less than minMenber

type PodGroupNameSlice

type PodGroupNameSlice []string

PodGroupNameSlice is type alias of []string

func ParsePodGroupNameSliceFromStr

func ParsePodGroupNameSliceFromStr(pgName string) PodGroupNameSlice

ParsePodGroupNameSliceFromStr parses podGroupNameSlice from raw string

func (PodGroupNameSlice) Add

Add adds requirements to the Selector

func (PodGroupNameSlice) DeepCopySelector

func (p PodGroupNameSlice) DeepCopySelector() labels.Selector

Make a deep copy of the selector.

func (PodGroupNameSlice) Empty

func (p PodGroupNameSlice) Empty() bool

Empty returns true if this selector does not restrict the selection space.

func (PodGroupNameSlice) IsBelongTo

func (p PodGroupNameSlice) IsBelongTo(ancestor PodGroupNameSlice) bool

IsUpperPodGroupOf checks whether this belongs to ancestor

func (PodGroupNameSlice) IsEmpty

func (p PodGroupNameSlice) IsEmpty() bool

func (PodGroupNameSlice) Matches

func (p PodGroupNameSlice) Matches(labels labels.Labels) bool

Matches returns true if this selector matches the given set of labels.

func (PodGroupNameSlice) PodGroupName

func (p PodGroupNameSlice) PodGroupName() string

func (PodGroupNameSlice) Requirements

func (p PodGroupNameSlice) Requirements() (labels.Requirements, bool)

Requirements converts this interface into Requirements to expose more detailed selection information. If there are querying parameters, it will return converted requirements and selectable=true. If this selector doesn't want to select anything, it will return selectable=false.

func (PodGroupNameSlice) RequiresExactMatch

func (p PodGroupNameSlice) RequiresExactMatch(label string) (value string, found bool)

RequiresExactMatch allows a caller to introspect whether a given selector requires a single specific label to be set, and if so returns the value it requires.

func (PodGroupNameSlice) String

func (p PodGroupNameSlice) String() string

String returns a human readable string that represents this selector.

type Scheduler

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

Scheduler is the custom scheduler of naglfar system

func (*Scheduler) Filter

func (s *Scheduler) Filter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

Filter is called by the scheduling framework. All FilterPlugins should return "Success" to declare that the given node fits the pod. If Filter doesn't return "Success", it will return "Unschedulable", "UnschedulableAndUnresolvable" or "Error". For the node being evaluated, Filter plugins should look at the passed nodeInfo reference for this particular node's information (e.g., pods considered to be running on the node) instead of looking it up in the NodeInfoSnapshot because we don't guarantee that they will be the same. For example, during preemption, we may pass a copy of the original nodeInfo object that has some pods removed from it to evaluate the possibility of preempting them to schedule the target pod.

func (*Scheduler) Less

func (s *Scheduler) Less(podInfo1, podInfo2 *framework.QueuedPodInfo) bool

Less are used to sort pods in the scheduling queue.

func (*Scheduler) Name

func (s *Scheduler) Name() string

Name is the name of scheduler

func (*Scheduler) Permit

func (s *Scheduler) Permit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (*framework.Status, time.Duration)

Permit is the functions invoked by the framework at "Permit" extension point.

func (*Scheduler) PostBind

func (s *Scheduler) PostBind(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeName string)

PostBind is called after a pod is successfully bound. These plugins are used update PodGroup when pod is bound.

func (*Scheduler) PostFilter

func (s *Scheduler) PostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod,
	filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)

PostFilter is called by the scheduling framework. A PostFilter plugin should return one of the following statuses: - Unschedulable: the plugin gets executed successfully but the pod cannot be made schedulable. - Success: the plugin gets executed successfully and the pod can be made schedulable. - Error: the plugin aborts due to some internal error.

Informational plugins should be configured ahead of other ones, and always return Unschedulable status. Optionally, a non-nil PostFilterResult may be returned along with a Success status. For example, a preemption plugin may choose to return nominatedNodeName, so that framework can reuse that to update the preemptor pod's .spec.status.nominatedNodeName field.

Is used to rejecting a group of pods if a pod does not pass PreFilter or Filter.

func (*Scheduler) PreFilter

func (s *Scheduler) PreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) *framework.Status

PreFilter is called at the beginning of the scheduling cycle. All PreFilter plugins must return success or the pod will be rejected.

func (*Scheduler) PreFilterExtensions

func (s *Scheduler) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns a PreFilterExtensions interface if the plugin implements one, or nil if it does not. A Pre-filter plugin can provide extensions to incrementally modify its pre-processed info. The framework guarantees that the extensions AddPod/RemovePod will only be called after PreFilter, possibly on a cloned CycleState, and may call those functions more than once before calling Filter again on a specific node.

func (*Scheduler) Reserve

func (s *Scheduler) Reserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status

Reserve is the functions invoked by the framework at "reserve" extension point.

func (*Scheduler) Score

func (s *Scheduler) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)

Score is called on each filtered node. It must return success and an integer indicating the rank of the node. All scoring plugins must return success or the pod will be rejected.

func (*Scheduler) ScoreExtensions

func (s *Scheduler) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions returns a ScoreExtensions interface if it implements one, or nil if does not.

func (*Scheduler) Unreserve

func (s *Scheduler) Unreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string)

Unreserve rejects all other Pods in the PodGroup when one of the pods in the group times out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳