preemption

package
v1.23.2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 18 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

type Evaluator

type Evaluator struct {
	PluginName string
	Handler    framework.Handle
	PodLister  corelisters.PodLister
	PdbLister  policylisters.PodDisruptionBudgetLister
	State      *framework.CycleState
	Interface
}

func (*Evaluator) DryRunPreemption

func (ev *Evaluator) DryRunPreemption(ctx context.Context, pod *v1.Pod, potentialNodes []*framework.NodeInfo,
	pdbs []*policy.PodDisruptionBudget, offset int32, numCandidates int32) ([]Candidate, framework.NodeToStatusMap, error)

DryRunPreemption simulates Preemption logic on <potentialNodes> in parallel, returns preemption candidates and a map indicating filtered nodes statuses. The number of candidates depends on the constraints defined in the plugin's args. In the returned list of candidates, ones that do not violate PDB are preferred over ones that do. NOTE: This method is exported for easier testing in default preemption.

func (*Evaluator) Preempt

func (*Evaluator) SelectCandidate

func (ev *Evaluator) SelectCandidate(candidates []Candidate) Candidate

SelectCandidate chooses the best-fit candidate from given <candidates> and return it. NOTE: This method is exported for easier testing in default preemption.

type Interface

type Interface interface {
	// GetOffsetAndNumCandidates chooses a random offset and calculates the number of candidates that should be
	// shortlisted for dry running preemption.
	GetOffsetAndNumCandidates(nodes int32) (int32, int32)
	// CandidatesToVictimsMap builds a map from the target node to a list of to-be-preempted Pods and the number of PDB violation.
	CandidatesToVictimsMap(candidates []Candidate) map[string]*extenderv1.Victims
	// PodEligibleToPreemptOthers determines whether this pod should be considered
	// for preempting other pods or not.
	PodEligibleToPreemptOthers(pod *v1.Pod, nominatedNodeStatus *framework.Status) bool
	// SelectVictimsOnNode finds minimum set of pods on the given node that should be preempted in order to make enough room
	// for "pod" to be scheduled.
	// Note that both `state` and `nodeInfo` are deep copied.
	SelectVictimsOnNode(ctx context.Context, state *framework.CycleState,
		pod *v1.Pod, nodeInfo *framework.NodeInfo, pdbs []*policy.PodDisruptionBudget) ([]*v1.Pod, int, *framework.Status)
}

Interface is expected to be implemented by different preemption plugins as all those member methods might have different behavior compared with the default preemption.

Jump to

Keyboard shortcuts

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