scheduler

package
v0.0.5-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Name of the scheduling plugin.
	Name = "ConstraintPolicyScheduling"
)

Variables

View Source
var (
	// ErrNotFound returned when specified resource is not found.
	ErrNotFound = errors.New("not-found")

	// ErrNoOffers returned when no offers are returned for pod.
	ErrNoOffers = errors.New("no-offers")

	// ErrNoNodesFound returned when no elible nodes are found for pod.
	ErrNoNodesFound = errors.New("no eligible nodes found")

	// ErrNoCost returned when no cost can be calculated.
	ErrNoCost = errors.New("no-cost")

	// ErrNodeNameNotFound returned when a node name cannot be found for a node.
	ErrNodeNameNotFound = errors.New("no-nodename-found")

	// ErrPodNotAssigned returned when a pod has net yet been assigned to
	// a node.
	ErrPodNotAssigned = errors.New("pod-not-assigned")

	// ErrNilAssignmentState returned when a pod has a nil assignment.
	ErrNilAssignmentState = errors.New("nil-assignment-state")

	// ErrInvalidAssignmentState returned when the assignment is not of a
	// valid type.
	ErrInvalidAssignmentState = errors.New("invalid-assignment-state")
)

Functions

func New

func New(
	obj runtime.Object, handle framework.Handle) (framework.Plugin, error,
)

New create a new framework plugin intance. nolint:ireturn

func ParseDuration

func ParseDuration(durationStrings ...string) ([]time.Duration, error)

ParseDuration parses a list of durations.

Types

type ConstraintPolicyScheduler

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

ConstraintPolicyScheduler defines the runtime information used by the constraint policy scheduler.

func NewScheduler

func NewScheduler(options ConstraintPolicySchedulerOptions,
	clientset kubernetes.Interface,
	pluginFrameworkHandle framework.Handle,
	constraintPolicyClient constraint_policy_client.ConstraintPolicyClient,
	log logr.Logger) *ConstraintPolicyScheduler

NewScheduler create a new instance of the schedule logic with the given set or parameters.

func (*ConstraintPolicyScheduler) FindBestNode

func (s *ConstraintPolicyScheduler) FindBestNode(ctx context.Context,
	pod *v1.Pod,
	feasibleNodes []*v1.Node) (*v1.Node, error,
)

FindBestNode finds the best node for the pod.

func (*ConstraintPolicyScheduler) Start

func (s *ConstraintPolicyScheduler) Start()

Start invokes the constraint policy scheduler as a go routine.

func (*ConstraintPolicyScheduler) Stop

func (s *ConstraintPolicyScheduler) Stop()

Stop halts the constraint policy scheduler.

type ConstraintPolicySchedulerOptions

type ConstraintPolicySchedulerOptions struct {
	Debug                bool
	NumRetriesOnFailure  int
	MinDelayOnFailure    time.Duration
	MaxDelayOnFailure    time.Duration
	FallbackOnNoOffers   bool
	RetryOnNoOffers      bool
	RequeuePeriod        time.Duration
	PlannerNodeQueueSize uint
	CallTimeout          time.Duration
	UpdateWorkerPeriod   time.Duration
}

ConstraintPolicySchedulerOptions defines the configuration options for the constraint policy scheduler.

func DefaultConstraintPolicySchedulerConfig

func DefaultConstraintPolicySchedulerConfig() *ConstraintPolicySchedulerOptions

DefaultConstraintPolicySchedulerConfig returns the default options for scheduler.

type ConstraintPolicySchedulerPlanner

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

ConstraintPolicySchedulerPlanner instance state for planner.

func NewPlanner

NewPlanner creates a new planner with specified callbacks.

func (*ConstraintPolicySchedulerPlanner) AddRateLimited

func (s *ConstraintPolicySchedulerPlanner) AddRateLimited(work func() error)

AddRateLimited add work function to rate limited queue.

func (*ConstraintPolicySchedulerPlanner) FindBestNode

func (s *ConstraintPolicySchedulerPlanner) FindBestNode(
	ctx context.Context,
	pod *v1.Pod,
	feasibleNodes []*v1.Node) (*v1.Node, error,
)

FindBestNode scheduler function to find the best node for the pod.

func (*ConstraintPolicySchedulerPlanner) FindFitRandom

func (s *ConstraintPolicySchedulerPlanner) FindFitRandom(pod *v1.Pod, nodes []*v1.Node) (*v1.Node, error)

FindFitRandom selects a randome node from the given or eligible nodes.

func (*ConstraintPolicySchedulerPlanner) FindNodeLister

func (s *ConstraintPolicySchedulerPlanner) FindNodeLister(node string) (*v1.Node, error)

FindNodeLister looks up the node lister based on the node name.

func (*ConstraintPolicySchedulerPlanner) GetClientset

GetClientset returns the client set for the planner. nolint:ireturn

func (*ConstraintPolicySchedulerPlanner) GetNodeName

func (s *ConstraintPolicySchedulerPlanner) GetNodeName(pod *v1.Pod) (string, error)

GetNodeName look up for the node in the lister cache if pod host ip is not set.

func (*ConstraintPolicySchedulerPlanner) Start

Start runs the constraint policy planner in go routines.

func (*ConstraintPolicySchedulerPlanner) Stop

Stop stops the constraint polucy scheduler planner.

func (*ConstraintPolicySchedulerPlanner) ToNodeName

func (s *ConstraintPolicySchedulerPlanner) ToNodeName(endpoint *types.Reference) (string, error)

ToNodeName lookup the node name for a given endpoint reference.

type ConstraintPolicySchedulerPlannerOptions

type ConstraintPolicySchedulerPlannerOptions struct {
	CallTimeout        time.Duration
	UpdateWorkerPeriod time.Duration
	NodeQueueSize      uint
	AddPodCallback     func(pod *v1.Pod)
	UpdatePodCallback  func(old, update *v1.Pod)
	DeletePodCallback  func(pod *v1.Pod)
}

ConstraintPolicySchedulerPlannerOptions options for the planner.

type ConstraintPolicyScheduling

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

ConstraintPolicyScheduling instance state for the the policy scheduling plugin.

func (*ConstraintPolicyScheduling) Name

Name returns the name of the scheduler.

func (*ConstraintPolicyScheduling) PostFilter

PostFilter is called when no node can be assigned to the pod.

func (*ConstraintPolicyScheduling) PreFilter

func (c *ConstraintPolicyScheduling) PreFilter(
	parentCtx context.Context,
	state *framework.CycleState,
	pod *v1.Pod) *framework.Status

PreFilter pre-filters the pods to be placed.

func (*ConstraintPolicyScheduling) PreFilterExtensions

func (c *ConstraintPolicyScheduling) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns prefilter extensions, pod add and remove. nolint:ireturn

func (*ConstraintPolicyScheduling) Score

func (c *ConstraintPolicyScheduling) Score(
	ctx context.Context,
	state *framework.CycleState,
	pod *v1.Pod, nodeName string) (int64, *framework.Status)

Score scores the eligible nodes.

func (*ConstraintPolicyScheduling) ScoreExtensions

ScoreExtensions calcuates scores for the extensions. nolint:ireturn

type ConstraintPolicySchedulingArgs

type ConstraintPolicySchedulingArgs struct {
	// nolint:tagliatelle
	metav1.TypeMeta      `json:",inline"`
	Debug                bool   `json:"debug,omitempty"`
	MinDelayOnFailure    string `json:"minDelayOnFailure,omitempty"`
	MaxDelayOnFailure    string `json:"maxDelayOnFailure,omitempty"`
	NumRetriesOnFailure  int    `json:"numRetriesOnFailure,omitempty"`
	FallbackOnNoOffers   bool   `json:"fallbackOnNoOffers,omitempty"`
	RetryOnNoOffers      bool   `json:"retryOnNoOffers,omitempty"`
	RequeuePeriod        string `json:"requeuePeriod,omitempty"`
	PlannerNodeQueueSize uint   `json:"plannerNodeQueueSize,omitempty"`
	CallTimeout          string `json:"callTimeout,omitempty"`
	UpdateWorkerPeriod   string `json:"updateWorkerPeriod,omitempty"`
}

ConstraintPolicySchedulingArgs defines the parameters for ConstraintPolicyScheduling plugin. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ConstraintPolicySchedulingArgs) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConstraintPolicySchedulingArgs.

func (*ConstraintPolicySchedulingArgs) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ConstraintPolicySchedulingArgs) DeepCopyObject

func (in *ConstraintPolicySchedulingArgs) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type NodeAndCost

type NodeAndCost struct {
	Node string
	Cost int64
}

NodeAndCost tuple of a node and the cost of using that node.

type RuleProvider

type RuleProvider interface {
	// EndpointCost calculates the cost of use each of the eligible nodes.
	EndpointCost(src *types.Reference, eligibleNodes []string,
		peerNodes []string, request, limit string) ([]NodeAndCost, error)
}

RuleProvider declares the methods that can be called against a rule provider.

type UnderlayController

type UnderlayController interface {
	Discover(eligibleNodes []string, peerNodes []string, rules []*constraintv1alpha1.ConstraintPolicyRule) ([]*nodeOffer, error)
	Allocate(pathID string) error
	Release(pathID string) error
}

UnderlayController defines the methods supported by the underlay controller instances. nolint:lll

Jump to

Keyboard shortcuts

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