predicates

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LuckyPred rejects a node if you're not lucky ¯\_(ツ)_/¯
	LuckyPredFailMsg = "Well, you're not lucky"
)

Variables

View Source
var (
	// Newly added predicates should be placed here
	DefaultPredicateFuncs = []PredicateFunc{

		StorageTypePredicate,
		CapacityPredicate,
	}
)

Functions

func CapacityPredicate

func CapacityPredicate(ctx *algorithm.SchedulingContext, pod *corev1.Pod, node *corev1.Node) (bool, error)

CapacityPredicate checks if local storage on a node matches the persistent volume claims, follow rules are applied:

  1. pvc contains vg or mount point or device claim
  2. node free size must larger or equal to pvcs
  3. for pvc of type mount point/device: a. must contains more mount points than pvc count

func LuckyPredicate

func LuckyPredicate(pod *corev1.Pod, node *corev1.Node) (bool, []string, error)

func Predicates

func Predicates(Ctx *algorithm.SchedulingContext, PredicateFuncs []PredicateFunc, pod *corev1.Pod, node *corev1.Node) (fits bool, failedReasons []string, err error)

func StorageTypePredicate added in v0.6.0

func StorageTypePredicate(ctx *algorithm.SchedulingContext, pod *corev1.Pod, node *corev1.Node) (bool, error)

StorageTypePredicate 1. if SPDK support is required, filter out the nodes without SPDK support 2. if SPDK support is unnecessary, filter out the nodes with SPDK support 3. if no volume is required, do nothing

Types

type Predicate

type Predicate struct {
	Name           string
	Ctx            *algorithm.SchedulingContext
	PredicateFuncs []PredicateFunc
}

func NewPredicate

func NewPredicate(ctx *algorithm.SchedulingContext) *Predicate

func (Predicate) Handler

type PredicateFunc

type PredicateFunc func(ctx *algorithm.SchedulingContext, pod *corev1.Pod, node *corev1.Node) (bool, error)

Jump to

Keyboard shortcuts

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