greedyquad

package
v0.0.0-...-6c93f71 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package greedyquad contains an out-of-tree plugin based on the Kubernetes scheduling framework.

Index

Constants

View Source
const (
	// Name is the "official" external name of this scheduling plugin.
	Name = "GreedyQuadPlugin"
)

Variables

This section is empty.

Functions

func New

func New(configuration runtime.Object, f framework.Handle) (framework.Plugin, error)

New instantiates a GreedyQuadPlugin.

Types

type GreedyQuadPlugin

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

GreedyQuadPlugin is an out-of-tree plugin for the kube-scheduler, which takes into account information about the slowdown of colocated applications when they are wrapped into Pods and scheduled on the Kubernetes cluster.

func NewController

func NewController(
	acticlientset clientset.Interface,
	actiInformer informers.ActiNodeInformer) *GreedyQuadPlugin

func (*GreedyQuadPlugin) Filter

func (ap *GreedyQuadPlugin) Filter(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.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 (*GreedyQuadPlugin) Name

func (_ *GreedyQuadPlugin) Name() string

Name returns the official name of the GreedyQuadPlugin.

func (*GreedyQuadPlugin) NormalizeScore

func (_ *GreedyQuadPlugin) NormalizeScore(
	ctx context.Context,
	state *framework.CycleState,
	p *corev1.Pod,
	scores framework.NodeScoreList,
) *framework.Status

NormalizeScore is called for all node scores produced by the same plugin's "Score" method. A successful run of NormalizeScore will update the scores list and return a success status.

In the case of the GreedyQuadPlugin, its "Score" method produces scores of reverse priority (i.e., the lower the score, the better the result). Therefore all scores have to be reversed during the normalization, so that higher score indicates a better scheduling result in terms of slowdowns.

func (*GreedyQuadPlugin) Score

func (ap *GreedyQuadPlugin) Score(
	ctx context.Context,
	state *framework.CycleState,
	p *corev1.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.

In the case of GreedyQuadPlugin, scoring is reversed; i.e., higher score indicates worse scheduling decision. This is taken into account and "fixed" later, during the normalization.

func (*GreedyQuadPlugin) ScoreExtensions

func (ap *GreedyQuadPlugin) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions returns the GreedyQuadPlugin itself, since it implements the framework.ScoreExtensions interface.

type InterferenceModel

type InterferenceModel interface {
	// Attack returns a float64 that represents the damage inflicted to the
	// occupant Pod when the attacker Pod is scheduled along with it.
	Attack(attacker, occupant *corev1.Pod) (float64, error)

	// ToInt64Multiplier returns an integer that can be used to safely
	// convert the result of Attack into an int64.
	//
	// The aim is to multiply the double-precision floating point number
	// returned by Attack with this number before casting it to an int64.
	ToInt64Multiplier() float64
}

InterferenceModel abstracts away the core logic of interference awareness.

It is used by GreedyPlugin across various scheduling extension points, and exposes the generalized functionality that should be provided to GreedyPlugin.

Directories

Path Synopsis
Package hardcoded contains an implementation of greedyquad.InterferenceModel, where the slowdowns among all applications are known and hardcoded.
Package hardcoded contains an implementation of greedyquad.InterferenceModel, where the slowdowns among all applications are known and hardcoded.

Jump to

Keyboard shortcuts

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