Documentation ¶
Index ¶
- Constants
- Variables
- func New(obj runtime.Object, handle framework.Handle) (framework.Plugin, error)
- func ParseDuration(durationStrings ...string) ([]time.Duration, error)
- type ConstraintPolicyScheduler
- type ConstraintPolicySchedulerOptions
- type ConstraintPolicySchedulerPlanner
- func (s *ConstraintPolicySchedulerPlanner) AddRateLimited(work func() error)
- func (s *ConstraintPolicySchedulerPlanner) FindBestNode(ctx context.Context, pod *v1.Pod, feasibleNodes []*v1.Node) (*v1.Node, error)
- func (s *ConstraintPolicySchedulerPlanner) FindFitRandom(pod *v1.Pod, nodes []*v1.Node) (*v1.Node, error)
- func (s *ConstraintPolicySchedulerPlanner) FindNodeLister(node string) (*v1.Node, error)
- func (s *ConstraintPolicySchedulerPlanner) GetClientset() kubernetes.Interface
- func (s *ConstraintPolicySchedulerPlanner) GetNodeName(pod *v1.Pod) (string, error)
- func (s *ConstraintPolicySchedulerPlanner) Start()
- func (s *ConstraintPolicySchedulerPlanner) Stop()
- func (s *ConstraintPolicySchedulerPlanner) ToNodeName(endpoint *types.Reference) (string, error)
- type ConstraintPolicySchedulerPlannerOptions
- type ConstraintPolicyScheduling
- func (c *ConstraintPolicyScheduling) Name() string
- func (c *ConstraintPolicyScheduling) PostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, ...) (*framework.PostFilterResult, *framework.Status)
- func (c *ConstraintPolicyScheduling) PreFilter(parentCtx context.Context, state *framework.CycleState, pod *v1.Pod) *framework.Status
- func (c *ConstraintPolicyScheduling) PreFilterExtensions() framework.PreFilterExtensions
- func (c *ConstraintPolicyScheduling) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)
- func (c *ConstraintPolicyScheduling) ScoreExtensions() framework.ScoreExtensions
- type ConstraintPolicySchedulingArgs
- type NodeAndCost
- type RuleProvider
- type UnderlayController
Constants ¶
const (
// Name of the scheduling plugin.
Name = "ConstraintPolicyScheduling"
)
Variables ¶
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 ¶
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 ¶
func NewPlanner( options ConstraintPolicySchedulerPlannerOptions, clientset kubernetes.Interface, constraintPolicyClient constraint_policy_client.ConstraintPolicyClient, log logr.Logger) *ConstraintPolicySchedulerPlanner
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 ¶
func (s *ConstraintPolicySchedulerPlanner) GetClientset() kubernetes.Interface
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 ¶
func (s *ConstraintPolicySchedulerPlanner) Start()
Start runs the constraint policy planner in go routines.
func (*ConstraintPolicySchedulerPlanner) Stop ¶
func (s *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 ¶
func (c *ConstraintPolicyScheduling) Name() string
Name returns the name of the scheduler.
func (*ConstraintPolicyScheduling) PostFilter ¶
func (c *ConstraintPolicyScheduling) PostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)
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 ¶
func (c *ConstraintPolicyScheduling) ScoreExtensions() framework.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 ¶
func (in *ConstraintPolicySchedulingArgs) DeepCopy() *ConstraintPolicySchedulingArgs
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConstraintPolicySchedulingArgs.
func (*ConstraintPolicySchedulingArgs) DeepCopyInto ¶
func (in *ConstraintPolicySchedulingArgs) DeepCopyInto(out *ConstraintPolicySchedulingArgs)
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 ¶
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