const ( DefaultClusterAgentListenAddress = "0.0.0.0:8081" DefaultNodesCacheUpdateInterval = 200 DefaultNodesCacheUpdateQueueSize = 1000 )
const ( // Default number of nodes to sample = 2%. DefaultNodesToSampleBp uint32 = 200 // Default size of the incoming pods buffer. DefaultIncomingPodsBufferSize uint32 = 1000 // Default number of commit candidate nodes. DefaultCommitCandidateNodes uint32 = 3 // Default operating mode of the scheduler. DefaultSchedulerOperatingMode SchedulerOperatingMode = MultiCluster // Default listen address for the submit pod API. DefaultSubmitPodListenAddress = "0.0.0.0:8080" )
var ( DefaultParallelSamplingPipelines uint32 = uint32(runtime.NumCPU()) * 10 DefaultParallelBindingPipelines uint32 = uint32(runtime.NumCPU()) * 10 )
var ( // Default number of parallel node samplers = number of CPU cores. DefaultParallelNodeSamplers uint32 = uint32(runtime.NumCPU()) * 10 // Default number of parallel Scheduling Decision Pipelines = number of CPU cores. DefaultParallelDecisionPipelines uint32 = uint32(runtime.NumCPU()) * 10 )
func ReadInt32FromPluginConfig(rawConfig PluginConfig, key string) (int32, error)
Reads an int32 value from the raw plugin config.
func ReadStringFromPluginConfig(rawConfig PluginConfig, key string) (string, error)
Reads a string value from the raw plugin config.
func ReadStringMapFromPluginConfig(rawConfig PluginConfig, key string) (map[string]string, error)
Reads a string map from the raw plugin config.
func SetDefaultsClusterAgentConfig(config *ClusterAgentConfig)
Sets the default values in the ClusterAgentConfig for fields that are not set properly.
func SetDefaultsSchedulerConfig(config *SchedulerConfig)
Sets the default values in the SchedulerConfig for fields that are not set properly.
Used to configure the plugins in the binding pipeline.
type BindingPluginsList struct { CheckConflicts []*PluginListEntry `json:"checkConflicts" yaml:"checkConflicts"` }
Represents the configuration of a polaris-cluster-agent instance.
type ClusterAgentConfig struct { // The list of addresses and ports to listen on in // the format "<IP>:<PORT>" // // Default: [ "0.0.0.0:8081" ] ListenOn []string `json:"listenOn" yaml:"listenOn"` // The update interval for the nodes cache in milliseconds. // // Default: 200 NodesCacheUpdateIntervalMs uint32 `json:"nodesCacheUpdateIntervalMs" yaml:"nodesCacheUpdateIntervalMs"` // The size of the update queue in the nodes cache. // The update queue caches watch events that arrive between the update intervals. // // Default: 1000 NodesCacheUpdateQueueSize uint32 `json:"nodesCacheUpdateQueueSize" yaml:"nodesCacheUpdateQueueSize"` // The number of Sampling Pipelines to run in parallel. // // Default: number of CPUs * 10 ParallelSamplingPipelines uint32 `json:"parallelSamplingPipelines" yaml:"parallelSamplingPipelines"` // The number of Binding Pipelines to run in parallel. // // Default: number of CPUs * 10 ParallelBindingPipelines uint32 `json:"parallelBindingPipelines" yaml:"parallelBindingPipelines"` // If true, a CommitSchedulingDecision request is considered successful and "cut off" after the binding pipeline completes successfully // and before the actual commit operation (creation of the pod and the binding) starts. // The commit operation will be executed asynchronously after the CommitSchedulingDecision response is sent back to the scheduler. // // This should be set to true to allow evaluating the performance of polaris-scheduler without bias from a slow orchestrator. // // Default: false CutoffBeforeCommit bool `json:"cutoffBeforeCommit" yaml:"cutoffBeforeCommit"` // The list of plugins for the sampling pipeline. SamplingPlugins SamplingPluginsList `json:"samplingPlugins" yaml:"samplingPlugins"` // The list of plugins for the binding pipeline. BindingPlugins BindingPluginsList `json:"bindingPlugins" yaml:"bindingPlugins"` // (optional) Allows specifying configuration parameters for each plugin. PluginsConfig []*PluginsConfigListEntry `json:"pluginsConfig" yaml:"pluginsConfig"` }
The base interface for a plugin configuration.
type PluginConfig map[string]interface{}
func ReadNestedObjectFromPluginConfig(rawConfig PluginConfig, key string) (PluginConfig, error)
Reads a nested object from the raw plugin config.
A single entry in the PluginsList.
type PluginListEntry struct { // The name of the Plugin. Name string `json:"name" yaml:"name"` // The weight of the plugin (applies only to Score plugins). // Default: 1 Weight int32 `json:"weight" yaml:"weight"` }
Stores configuration for a specific plugin in the PluginsList.
type PluginsConfigListEntry struct { // The name of the Plugin. Name string `json:"name" yaml:"name"` // Configuration data for the plugin. Config PluginConfig `json:"config" yaml:"config"` }
Contains all the configuration needed to connect to a remote cluster's PolarisClusterAgent.
type RemoteClusterConfig struct { // The base URI of the remote cluster's PolarisClusterAgent. // // Example: "https://cluster-a:8081" BaseURI string `json:"baseUri" yaml:"baseUri"` }
Used to configure the plugins used in the sampling pipeline.
type SamplingPluginsList struct { // Only one sampling strategy is used for a pod in the sampling pipeline. // However, multiple sampling strategy plugins can be configured, which will then be exposed // as different sampling endpoints. SamplingStrategies []*PluginListEntry `json:"samplingStrategies" yaml:"samplingStrategies"` PreFilter []*PluginListEntry `json:"preFilter" yaml:"preFilter"` Filter []*PluginListEntry `json:"filter" yaml:"filter"` PreScore []*PluginListEntry `json:"preScore" yaml:"preScore"` Score []*PluginListEntry `json:"score" yaml:"score"` }
Represents the configuration of a polaris-scheduler instance.
type SchedulerConfig struct { // The name of this scheduler. SchedulerName string `json:"schedulerName" yaml:"schedulerName"` // The number of nodes to sample defined as basis points (bp) of the total number of nodes. // 1 bp = 0.01% // // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=10000 NodesToSampleBp uint32 `json:"nodesToSampleBp" yaml:"nodesToSampleBp"` // The number of node samplers to run in parallel. // // Default: number of CPU cores. ParallelNodeSamplers uint32 `json:"parallelNodeSamplers" yaml:"parallelNodeSamplers"` // The number of Scheduling Decision Pipelines to run in parallel. // // Default: number of CPU cores. ParallelDecisionPipelines uint32 `json:"parallelDecisionPipelines" yaml:"parallelDecisionPipelines"` // The size of the buffer used for incoming pods. // // Default: 1000 IncomingPodsBufferSize uint32 `json:"incomingPodsBufferSize" yaml:"incomingPodsBufferSize"` // The number of candidate nodes that will be picked at the end of the scoring phase. // The scheduler will try to commit the scheduling decision to the highest scored node. // If this fails, it will proceed to the node with the second highest score. // Only after the commit for all these nodes has failed, the pod will be considered as having a scheduling conflict. // // Default: 3 CommitCandidateNodes uint32 `json:"commitCandidateNodes" yaml:"commitCandidateNodes"` // Defines the mode ("singleCluster" or "multiCluster") in which to operate the scheduler. // // - In "singleCluster" mode, the scheduler connects directly interacts with cluster's orchestrator to // get incoming pods and to assign them to nodes. // - In "multiCluster" mode, the scheduler can handle multiple clusters (possibly operated by multiple orchestrators) // In this mode polaris-scheduler accepts pods through an external API and submits scheduling decisions to the polaris-scheduler-agent // running in each cluster. // // Default: "multiCluster" OperatingMode SchedulerOperatingMode `json:"operatingMode" yaml:"operatingMode"` // The list of addresses and ports that the submit pod API should listen on in // the format "<IP>:<PORT>" // This setting applies only if "operatingMode" is set to "multiCluster". // // Default: [ "0.0.0.0:8080" ] SubmitPodListenOn []string `json:"submitPodListenOn" yaml:"submitPodListenOn"` // The map of remote clusters - only needed if "operatingMode" is "multiCluster". // // The key of each item has to be the cluster name. // Example: // { // "clusterA": { "baseUri": "http://sampler.cluster-a:8081/v1" }, // "clusterB": { "baseUri": "https://sampler.cluster-b:8888/v1" } // } RemoteClusters map[string]*RemoteClusterConfig `json:"remoteClusters" yaml:"remoteClusters"` // The list of plugins for the scheduling pipeline. Plugins SchedulingPluginsList `json:"plugins" yaml:"plugins"` // (optional) Allows specifying configuration parameters for each plugin. PluginsConfig []*PluginsConfigListEntry `json:"pluginsConfig" yaml:"pluginsConfig"` }
Defines the mode ("singleCluster" or "multiCluster") in which to operate the scheduler.
type SchedulerOperatingMode string
const ( SingleCluster SchedulerOperatingMode = "singleCluster" MultiCluster SchedulerOperatingMode = "multiCluster" )
Used to configure the plugins used in the scheduling pipeline.
type SchedulingPluginsList struct { Sort *PluginListEntry `json:"sort" yaml:"sort"` SampleNodes *PluginListEntry `json:"sampleNodes" yaml:"sampleNodes"` PreFilter []*PluginListEntry `json:"preFilter" yaml:"preFilter"` Filter []*PluginListEntry `json:"filter" yaml:"filter"` PreScore []*PluginListEntry `json:"preScore" yaml:"preScore"` Score []*PluginListEntry `json:"score" yaml:"score"` Reserve []*PluginListEntry `json:"reserve" yaml:"reserve"` }