scheduler

package
v0.26.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

The scheduler is responsible for placing virtual pod (VPod) replicas within real pods.

Index

Constants

View Source
const (
	// MaxWeight is the maximum weight that can be assigned for a priority.
	MaxWeight uint64 = 10
	// MinWeight is the minimum weight that can be assigned for a priority.
	MinWeight uint64 = 0
)
View Source
const (
	ZoneLabel = "topology.kubernetes.io/zone"
)

Variables

View Source
var (
	ErrNotEnoughReplicas = errors.New("scheduling failed (not enough pod replicas)")
)

Functions

func GetPlacementForPod

func GetPlacementForPod(placements []duckv1alpha1.Placement, podName string) *duckv1alpha1.Placement

GetPlacementForPod returns the placement corresponding to podName

func GetPodCount added in v0.22.4

func GetPodCount(placements []duckv1alpha1.Placement) int

GetPodCount returns the number of pods with the given placements

func GetTotalVReplicas

func GetTotalVReplicas(placements []duckv1alpha1.Placement) int32

GetTotalVReplicas returns the total number of placed virtual replicas

Types

type Evictor added in v0.24.0

type Evictor func(pod *corev1.Pod, vpod VPod, from *duckv1alpha1.Placement) error

Evictor allows for vreplicas to be evicted. For instance, the evictor is used by the statefulset scheduler to move vreplicas to pod with a lower ordinal.

type PredicatePolicy added in v0.26.0

type PredicatePolicy struct {
	// Identifier of the predicate policy
	Name string
	// Holds the parameters to configure the given predicate
	Args interface{}
}

PredicatePolicy describes a struct of a predicate policy.

type PriorityPolicy added in v0.26.0

type PriorityPolicy struct {
	// Identifier of the priority policy
	Name string
	// The numeric multiplier for the pod scores that the priority function generates
	// The weight should be a positive integer
	Weight uint64
	// Holds the parameters to configure the given priority function
	Args interface{}
}

PriorityPolicy describes a struct of a priority policy.

type Scheduler

type Scheduler interface {
	// Schedule computes the new set of placements for vpod.
	Schedule(vpod VPod) ([]duckv1alpha1.Placement, error)
}

Scheduler is responsible for placing VPods into real Kubernetes pods

type SchedulerPolicy added in v0.26.0

type SchedulerPolicy struct {
	// Holds the information to configure the fit predicate functions.
	Predicates []PredicatePolicy
	// Holds the information to configure the priority functions.
	Priorities []PriorityPolicy
}

Policy describes a struct of a policy resource.

type SchedulerPolicyType added in v0.26.0

type SchedulerPolicyType string
const (
	// MAXFILLUP policy type adds vreplicas to existing pods to fill them up before adding to new pods
	MAXFILLUP SchedulerPolicyType = "MAXFILLUP"
)

type VPod

type VPod interface {
	// GetKey returns the VPod key (namespace/name).
	GetKey() types.NamespacedName

	// GetVReplicas returns the number of expected virtual replicas
	GetVReplicas() int32

	// GetPlacements returns the current list of placements
	// Do not mutate!
	GetPlacements() []duckv1alpha1.Placement

	GetResourceVersion() string
}

VPod represents virtual replicas placed into real Kubernetes pods The scheduler is responsible for placing VPods

type VPodLister

type VPodLister func() ([]VPod, error)

VPodLister is the function signature for returning a list of VPods

Jump to

Keyboard shortcuts

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