Documentation

Index

Constants

const (
	// Name of the plugin used in the plugin registry and configurations.
	Name = "DefaultPreemption"
)

Variables

This section is empty.

Functions

func New

func New(_ runtime.Object, fh framework.FrameworkHandle) (framework.Plugin, error)

New initializes a new plugin and returns it.

func PodEligibleToPreemptOthers

func PodEligibleToPreemptOthers(pod *v1.Pod, nodeInfos framework.NodeInfoLister, nominatedNodeStatus *framework.Status) bool

PodEligibleToPreemptOthers determines whether this pod should be considered for preempting other pods or not. If this pod has already preempted other pods and those are in their graceful termination period, it shouldn't be considered for preemption. We look at the node that is nominated for this pod and as long as there are terminating pods on the node, we don't consider this for preempting more pods.

func PrepareCandidate

func PrepareCandidate(c Candidate, fh framework.FrameworkHandle, cs kubernetes.Interface, pod *v1.Pod) error

PrepareCandidate does some preparation work before nominating the selected candidate: - Evict the victim pods - Reject the victim pods if they are in waitingPod map - Clear the low-priority pods' nominatedNodeName status if needed

Types

type Candidate

type Candidate interface {
	// Victims wraps a list of to-be-preempted Pods and the number of PDB violation.
	Victims() *extenderv1.Victims
	// Name returns the target node name where the preemptor gets nominated to run.
	Name() string
}

Candidate represents a nominated node on which the preemptor can be scheduled, along with the list of victims that should be evicted for the preemptor to fit the node.

func CallExtenders

func CallExtenders(extenders []framework.Extender, pod *v1.Pod, nodeLister framework.NodeInfoLister,
	candidates []Candidate) ([]Candidate, error)

CallExtenders calls given <extenders> to select the list of feasible candidates. We will only check <candidates> with extenders that support preemption. Extenders which do not support preemption may later prevent preemptor from being scheduled on the nominated node. In that case, scheduler will find a different host for the preemptor in subsequent scheduling cycles.

func FindCandidates

func FindCandidates(ctx context.Context, cs kubernetes.Interface, state *framework.CycleState, pod *v1.Pod,
	m framework.NodeToStatusMap, ph framework.PreemptHandle, nodeLister framework.NodeInfoLister,
	pdbLister policylisters.PodDisruptionBudgetLister) ([]Candidate, error)

FindCandidates calculates a slice of preemption candidates. Each candidate is executable to make the given <pod> schedulable.

func SelectCandidate

func SelectCandidate(candidates []Candidate) Candidate

SelectCandidate chooses the best-fit candidate from given <candidates> and return it.

type DefaultPreemption

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

DefaultPreemption is a PostFilter plugin implements the preemption logic.

func (*DefaultPreemption) Name

func (pl *DefaultPreemption) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*DefaultPreemption) PostFilter

func (pl *DefaultPreemption) PostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, m framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)

PostFilter invoked at the postFilter extension point.