const (
BindingPipelineStopwatchesStateKey = "polaris-internal.stopwatches.binding"
)
const (
SamplingEndpointsPrefix = "samples"
)
A collection of stopwatches for timing various parts of the binding pipeline.
ToDo: find a better way to handle the responsibilities for timing other than this shared struct.
type BindingPipelineStopwatches struct {
QueueTime *util.Stopwatch
NodeLockTime *util.Stopwatch
FetchNodeInfo *util.Stopwatch
BindingPipeline *util.Stopwatch
CommitDecision *util.Stopwatch
}
func NewBindingPipelineStopwatches() *BindingPipelineStopwatches
Default implementation of the BindingPipeline.
type DefaultBindingPipeline struct {
// contains filtered or unexported fields
}
func NewDefaultBindingPipeline(
id int,
plugins *pipeline.BindingPipelinePlugins,
clusterAgentServices pipeline.ClusterAgentServices,
nodesLocker collections.EntityLocker,
) *DefaultBindingPipeline
Creates a new instance of the default implementation of the BindingPipeline.
func (bp *DefaultBindingPipeline) CommitSchedulingDecision(schedCtx pipeline.SchedulingContext, schedDecision *client.ClusterSchedulingDecision, queuedPod client.PodQueuedOnNode) (*client.CommitSchedulingDecisionSuccess, pipeline.Status)
Default implementation of the Polaris DecisionPipeline
type DefaultDecisionPipeline struct {
// contains filtered or unexported fields
}
func NewDefaultDecisionPipeline(id int, plugins *pipeline.DecisionPipelinePlugins, scheduler pipeline.PolarisScheduler) *DefaultDecisionPipeline
Creates a new instance of the DefaultDecisionPipeline.
func (dp *DefaultDecisionPipeline) DecideCommitCandidates(podInfo *pipeline.SampledPodInfo, commitCandidatesCount int) ([]*pipeline.SchedulingDecision, pipeline.Status)
Default implementation of the PolarisNodeSampler.
This implementation relies on Gin for providing a REST interface. Since the Gin engine can be shared among multiple services, it must be started by the owner of this object after calling Start().
type DefaultPolarisNodeSampler struct {
// contains filtered or unexported fields
}
func NewDefaultPolarisNodeSampler(
clusterAgentConfig *config.ClusterAgentConfig,
ginEngine *gin.Engine,
clusterClient client.LocalClusterClient,
nodesCache client.NodesCache,
pluginsRegistry *pipeline.PluginsRegistry[pipeline.ClusterAgentServices],
logger *logr.Logger,
) *DefaultPolarisNodeSampler
func (sampler *DefaultPolarisNodeSampler) ClusterClient() client.LocalClusterClient
func (sampler *DefaultPolarisNodeSampler) Config() *config.ClusterAgentConfig
func (sampler *DefaultPolarisNodeSampler) Logger() *logr.Logger
func (sampler *DefaultPolarisNodeSampler) NodesCache() client.NodesCache
func (sampler *DefaultPolarisNodeSampler) SamplingStrategies() []pipeline.SamplingStrategyPlugin
func (sampler *DefaultPolarisNodeSampler) Start(ctx context.Context) error
The default implementation of the PolarisScheduler.
type DefaultPolarisScheduler struct {
// contains filtered or unexported fields
}
func NewDefaultPolarisScheduler(
conf *config.SchedulerConfig,
pluginsRegistry *pipeline.PluginsRegistry[pipeline.PolarisScheduler],
podSource pipeline.PodSource,
clusterClientsMgr client.ClusterClientsManager,
logger *logr.Logger,
) *DefaultPolarisScheduler
Creates a new instance of the default implementation of the PolarisScheduler.
func (ps *DefaultPolarisScheduler) ClusterClientsManager() client.ClusterClientsManager
Gets the ClusterClientsManager for communicating with the node clusters.
func (ps *DefaultPolarisScheduler) Config() *config.SchedulerConfig
Gets the scheduler configuration.
func (ps *DefaultPolarisScheduler) IsActive() bool
Returns true if the scheduling process has been started.
func (ps *DefaultPolarisScheduler) Logger() *logr.Logger
Gets the logger used by this scheduler.
func (ps *DefaultPolarisScheduler) PodsInDecisionPipelineCount() int
Returns the number of pods currently in the decision pipeline.
func (ps *DefaultPolarisScheduler) PodsInNodeSamplingCount() int
Returns the number of pods, for which nodes are currently being sampled.
func (ps *DefaultPolarisScheduler) PodsInQueueCount() int
Returns the number of queued pods.
func (ps *DefaultPolarisScheduler) PodsWaitingForDecisionPipelineCount() int
Returns the number of pods, for which nodes have been sampled, and which are now waiting to enter the decision pipeline.
func (ps *DefaultPolarisScheduler) Start(ctx context.Context) error
Starts the scheduling goroutines and then returns nil or an error, if any occurred.
func (ps *DefaultPolarisScheduler) Stop() error
Stops the scheduling goroutines.
Default implementation of the Polaris SamplingPipeline
type DefaultSamplingPipeline struct {
// contains filtered or unexported fields
}
func NewDefaultSamplingPipeline(id int, plugins *pipeline.SamplingPipelinePlugins, nodeSampler pipeline.PolarisNodeSampler) *DefaultSamplingPipeline
func (sp *DefaultSamplingPipeline) SampleNodes( ctx pipeline.SchedulingContext, samplingStrategy pipeline.SamplingStrategyPlugin, podInfo *pipeline.PodInfo, nodesToSampleBp int, ) ([]*pipeline.NodeInfo, pipeline.Status)
SampleNodes implements pipeline.SamplingPipeline
Handles functionality that is common to both the scheduling and the sampling pipeline.
type PipelineHelper struct {
}
func NewPipelineHelper() *PipelineHelper
func (ph *PipelineHelper) RunFilterPlugins( ctx pipeline.SchedulingContext, filterPlugins []pipeline.FilterPlugin, podInfo *pipeline.PodInfo, candidateNodes *list.List, ) pipeline.Status
Runs the specified Filter plugins on the candidate nodes list and removes all nodes that are not eligible from that list.
Returns a Success status, if candidate nodes are left after filtering, or an Unschedulable status if no candidate nodes are left after filtering.
func (ph *PipelineHelper) RunPreFilterPlugins(ctx pipeline.SchedulingContext, preFilterPlugins []pipeline.PreFilterPlugin, podInfo *pipeline.PodInfo) pipeline.Status
Runs the specified PreFilter plugins for the specified pod.
func (ph *PipelineHelper) RunPreScorePlugins( ctx pipeline.SchedulingContext, preScorePlugins []pipeline.PreScorePlugin, podInfo *pipeline.PodInfo, eligibleNodes []*pipeline.NodeInfo, ) pipeline.Status
Runs the specified PreScore plugins on the eligible nodes.
func (ph *PipelineHelper) RunScorePlugins( ctx pipeline.SchedulingContext, scorePlugins []*pipeline.ScorePluginWithExtensions, podInfo *pipeline.PodInfo, eligibleNodes []*pipeline.NodeInfo, ) ([][]pipeline.NodeScore, pipeline.Status)
Runs the specified Score plugins and their extensions on the eligible nodes.
Returns a nested array of allScores (type [][]pipeline.NodeScore), where allScores[i] stores the scores for all eligible nodes computed by score plugin i.
| Name | Synopsis |
|---|---|
| .. | |
| pluginfactories | |
| queue | |