mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #98663 from gavinfish/sched-remove-plugin-pt
Scheduler: change config.Plugins from pointers to objects
This commit is contained in:
commit
838bb6a567
@ -534,7 +534,7 @@ profiles:
|
||||
{
|
||||
SchedulerName: "default-scheduler",
|
||||
Plugins: &kubeschedulerconfig.Plugins{
|
||||
Reserve: &kubeschedulerconfig.PluginSet{
|
||||
Reserve: kubeschedulerconfig.PluginSet{
|
||||
Enabled: []kubeschedulerconfig.Plugin{
|
||||
{Name: "foo"},
|
||||
{Name: "bar"},
|
||||
@ -543,7 +543,7 @@ profiles:
|
||||
{Name: "baz"},
|
||||
},
|
||||
},
|
||||
PreBind: &kubeschedulerconfig.PluginSet{
|
||||
PreBind: kubeschedulerconfig.PluginSet{
|
||||
Enabled: []kubeschedulerconfig.Plugin{
|
||||
{Name: "foo"},
|
||||
},
|
||||
@ -609,7 +609,7 @@ profiles:
|
||||
{
|
||||
SchedulerName: "foo-profile",
|
||||
Plugins: &kubeschedulerconfig.Plugins{
|
||||
Reserve: &kubeschedulerconfig.PluginSet{
|
||||
Reserve: kubeschedulerconfig.PluginSet{
|
||||
Enabled: []kubeschedulerconfig.Plugin{
|
||||
{Name: "foo"},
|
||||
},
|
||||
@ -619,7 +619,7 @@ profiles:
|
||||
{
|
||||
SchedulerName: "bar-profile",
|
||||
Plugins: &kubeschedulerconfig.Plugins{
|
||||
PreBind: &kubeschedulerconfig.PluginSet{
|
||||
PreBind: kubeschedulerconfig.PluginSet{
|
||||
Disabled: []kubeschedulerconfig.Plugin{
|
||||
{Name: "baz"},
|
||||
},
|
||||
|
@ -70,12 +70,12 @@ func ListAlgorithmProviders() string {
|
||||
|
||||
func getDefaultConfig() *schedulerapi.Plugins {
|
||||
return &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: queuesort.Name},
|
||||
},
|
||||
},
|
||||
PreFilter: &schedulerapi.PluginSet{
|
||||
PreFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.FitName},
|
||||
{Name: nodeports.Name},
|
||||
@ -84,7 +84,7 @@ func getDefaultConfig() *schedulerapi.Plugins {
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: nodeunschedulable.Name},
|
||||
{Name: nodename.Name},
|
||||
@ -103,12 +103,12 @@ func getDefaultConfig() *schedulerapi.Plugins {
|
||||
{Name: interpodaffinity.Name},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultpreemption.Name},
|
||||
},
|
||||
},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: interpodaffinity.Name},
|
||||
{Name: podtopologyspread.Name},
|
||||
@ -116,7 +116,7 @@ func getDefaultConfig() *schedulerapi.Plugins {
|
||||
{Name: nodeaffinity.Name},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.BalancedAllocationName, Weight: 1},
|
||||
{Name: imagelocality.Name, Weight: 1},
|
||||
@ -131,17 +131,17 @@ func getDefaultConfig() *schedulerapi.Plugins {
|
||||
{Name: tainttoleration.Name, Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{
|
||||
Reserve: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
PreBind: &schedulerapi.PluginSet{
|
||||
PreBind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Bind: &schedulerapi.PluginSet{
|
||||
Bind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultbinder.Name},
|
||||
},
|
||||
|
@ -47,12 +47,12 @@ import (
|
||||
|
||||
func TestClusterAutoscalerProvider(t *testing.T) {
|
||||
wantConfig := &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: queuesort.Name},
|
||||
},
|
||||
},
|
||||
PreFilter: &schedulerapi.PluginSet{
|
||||
PreFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.FitName},
|
||||
{Name: nodeports.Name},
|
||||
@ -61,7 +61,7 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: nodeunschedulable.Name},
|
||||
{Name: nodename.Name},
|
||||
@ -80,12 +80,12 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
||||
{Name: interpodaffinity.Name},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultpreemption.Name},
|
||||
},
|
||||
},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: interpodaffinity.Name},
|
||||
{Name: podtopologyspread.Name},
|
||||
@ -93,7 +93,7 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
||||
{Name: nodeaffinity.Name},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.BalancedAllocationName, Weight: 1},
|
||||
{Name: imagelocality.Name, Weight: 1},
|
||||
@ -105,17 +105,17 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
||||
{Name: tainttoleration.Name, Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{
|
||||
Reserve: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
PreBind: &schedulerapi.PluginSet{
|
||||
PreBind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Bind: &schedulerapi.PluginSet{
|
||||
Bind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultbinder.Name},
|
||||
},
|
||||
@ -138,12 +138,12 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{
|
||||
name: "Feature gates disabled",
|
||||
wantConfig: &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: queuesort.Name},
|
||||
},
|
||||
},
|
||||
PreFilter: &schedulerapi.PluginSet{
|
||||
PreFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.FitName},
|
||||
{Name: nodeports.Name},
|
||||
@ -152,7 +152,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: nodeunschedulable.Name},
|
||||
{Name: nodename.Name},
|
||||
@ -171,12 +171,12 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: interpodaffinity.Name},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultpreemption.Name},
|
||||
},
|
||||
},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: interpodaffinity.Name},
|
||||
{Name: podtopologyspread.Name},
|
||||
@ -184,7 +184,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: nodeaffinity.Name},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.BalancedAllocationName, Weight: 1},
|
||||
{Name: imagelocality.Name, Weight: 1},
|
||||
@ -196,17 +196,17 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: tainttoleration.Name, Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{
|
||||
Reserve: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
PreBind: &schedulerapi.PluginSet{
|
||||
PreBind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Bind: &schedulerapi.PluginSet{
|
||||
Bind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultbinder.Name},
|
||||
},
|
||||
@ -219,12 +219,12 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
features.DefaultPodTopologySpread: false,
|
||||
},
|
||||
wantConfig: &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: queuesort.Name},
|
||||
},
|
||||
},
|
||||
PreFilter: &schedulerapi.PluginSet{
|
||||
PreFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.FitName},
|
||||
{Name: nodeports.Name},
|
||||
@ -233,7 +233,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: nodeunschedulable.Name},
|
||||
{Name: nodename.Name},
|
||||
@ -252,12 +252,12 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: interpodaffinity.Name},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultpreemption.Name},
|
||||
},
|
||||
},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: interpodaffinity.Name},
|
||||
{Name: podtopologyspread.Name},
|
||||
@ -266,7 +266,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: selectorspread.Name},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: noderesources.BalancedAllocationName, Weight: 1},
|
||||
{Name: imagelocality.Name, Weight: 1},
|
||||
@ -279,17 +279,17 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
{Name: selectorspread.Name, Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{
|
||||
Reserve: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
PreBind: &schedulerapi.PluginSet{
|
||||
PreBind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: volumebinding.Name},
|
||||
},
|
||||
},
|
||||
Bind: &schedulerapi.PluginSet{
|
||||
Bind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: defaultbinder.Name},
|
||||
},
|
||||
|
@ -1667,13 +1667,13 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{
|
||||
name: "in-tree plugins with customized plugin config",
|
||||
plugins: config.Plugins{
|
||||
Filter: &config.PluginSet{
|
||||
Filter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "NodeLabel"},
|
||||
{Name: "ServiceAffinity"},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "RequestedToCapacityRatio"},
|
||||
},
|
||||
@ -1887,7 +1887,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{
|
||||
name: "disable some default plugins",
|
||||
plugins: config.Plugins{
|
||||
PreFilter: &config.PluginSet{
|
||||
PreFilter: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "NodeResourcesFit"},
|
||||
{Name: "NodePorts"},
|
||||
@ -1896,7 +1896,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
},
|
||||
Filter: &config.PluginSet{
|
||||
Filter: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "NodeUnschedulable"},
|
||||
{Name: "NodeResourcesFit"},
|
||||
@ -1915,12 +1915,12 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "PodTopologySpread"},
|
||||
},
|
||||
},
|
||||
PostFilter: &config.PluginSet{
|
||||
PostFilter: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "DefaultPreemption"},
|
||||
},
|
||||
},
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "NodeAffinity"},
|
||||
@ -1929,7 +1929,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "PodTopologySpread"},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "NodeResourcesBalancedAllocation"},
|
||||
{Name: "ImageLocality"},
|
||||
@ -1942,17 +1942,17 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "PodTopologySpread"},
|
||||
},
|
||||
},
|
||||
PreBind: &config.PluginSet{
|
||||
PreBind: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
},
|
||||
PostBind: &config.PluginSet{
|
||||
PostBind: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
},
|
||||
Reserve: &config.PluginSet{
|
||||
Reserve: config.PluginSet{
|
||||
Disabled: []config.Plugin{
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
@ -1968,7 +1968,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{
|
||||
name: "reverse default plugins order with changing score weight",
|
||||
plugins: config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "PrioritySort"},
|
||||
},
|
||||
@ -1976,7 +1976,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
PreFilter: &config.PluginSet{
|
||||
PreFilter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "NodePorts"},
|
||||
@ -1986,7 +1986,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
Filter: &config.PluginSet{
|
||||
Filter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "VolumeZone"},
|
||||
@ -2007,7 +2007,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "PodTopologySpread"},
|
||||
{Name: "TaintToleration"},
|
||||
@ -2018,7 +2018,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "PodTopologySpread", Weight: 24},
|
||||
{Name: "TaintToleration", Weight: 24},
|
||||
@ -2034,7 +2034,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: "DefaultBinder"}},
|
||||
Disabled: []config.Plugin{{Name: "*"}},
|
||||
},
|
||||
|
@ -169,39 +169,39 @@ type SchedulerPolicyConfigMapSource struct {
|
||||
// be invoked before default plugins, default plugins must be disabled and re-enabled here in desired order.
|
||||
type Plugins struct {
|
||||
// QueueSort is a list of plugins that should be invoked when sorting pods in the scheduling queue.
|
||||
QueueSort *PluginSet
|
||||
QueueSort PluginSet
|
||||
|
||||
// PreFilter is a list of plugins that should be invoked at "PreFilter" extension point of the scheduling framework.
|
||||
PreFilter *PluginSet
|
||||
PreFilter PluginSet
|
||||
|
||||
// Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod.
|
||||
Filter *PluginSet
|
||||
Filter PluginSet
|
||||
|
||||
// PostFilter is a list of plugins that are invoked after filtering phase, no matter whether filtering succeeds or not.
|
||||
PostFilter *PluginSet
|
||||
PostFilter PluginSet
|
||||
|
||||
// PreScore is a list of plugins that are invoked before scoring.
|
||||
PreScore *PluginSet
|
||||
PreScore PluginSet
|
||||
|
||||
// Score is a list of plugins that should be invoked when ranking nodes that have passed the filtering phase.
|
||||
Score *PluginSet
|
||||
Score PluginSet
|
||||
|
||||
// Reserve is a list of plugins invoked when reserving/unreserving resources
|
||||
// after a node is assigned to run the pod.
|
||||
Reserve *PluginSet
|
||||
Reserve PluginSet
|
||||
|
||||
// Permit is a list of plugins that control binding of a Pod. These plugins can prevent or delay binding of a Pod.
|
||||
Permit *PluginSet
|
||||
Permit PluginSet
|
||||
|
||||
// PreBind is a list of plugins that should be invoked before a pod is bound.
|
||||
PreBind *PluginSet
|
||||
PreBind PluginSet
|
||||
|
||||
// Bind is a list of plugins that should be invoked at "Bind" extension point of the scheduling framework.
|
||||
// The scheduler call these plugins in order. Scheduler skips the rest of these plugins as soon as one returns success.
|
||||
Bind *PluginSet
|
||||
Bind PluginSet
|
||||
|
||||
// PostBind is a list of plugins that should be invoked after a pod is successfully bound.
|
||||
PostBind *PluginSet
|
||||
PostBind PluginSet
|
||||
}
|
||||
|
||||
// PluginSet specifies enabled and disabled plugins for an extension point.
|
||||
@ -252,14 +252,9 @@ const (
|
||||
MaxWeight = MaxTotalScore / MaxCustomPriorityScore
|
||||
)
|
||||
|
||||
func appendPluginSet(dst *PluginSet, src *PluginSet) *PluginSet {
|
||||
if dst == nil {
|
||||
dst = &PluginSet{}
|
||||
}
|
||||
if src != nil {
|
||||
dst.Enabled = append(dst.Enabled, src.Enabled...)
|
||||
dst.Disabled = append(dst.Disabled, src.Disabled...)
|
||||
}
|
||||
func appendPluginSet(dst PluginSet, src PluginSet) PluginSet {
|
||||
dst.Enabled = append(dst.Enabled, src.Enabled...)
|
||||
dst.Disabled = append(dst.Disabled, src.Disabled...)
|
||||
return dst
|
||||
}
|
||||
|
||||
@ -301,21 +296,14 @@ func (p *Plugins) Apply(customPlugins *Plugins) {
|
||||
p.PostBind = mergePluginSets(p.PostBind, customPlugins.PostBind)
|
||||
}
|
||||
|
||||
func mergePluginSets(defaultPluginSet, customPluginSet *PluginSet) *PluginSet {
|
||||
if customPluginSet == nil {
|
||||
customPluginSet = &PluginSet{}
|
||||
}
|
||||
|
||||
if defaultPluginSet == nil {
|
||||
defaultPluginSet = &PluginSet{}
|
||||
}
|
||||
func mergePluginSets(defaultPluginSet, customPluginSet PluginSet) PluginSet {
|
||||
|
||||
disabledPlugins := sets.NewString()
|
||||
for _, disabledPlugin := range customPluginSet.Disabled {
|
||||
disabledPlugins.Insert(disabledPlugin.Name)
|
||||
}
|
||||
|
||||
enabledPlugins := []Plugin{}
|
||||
var enabledPlugins []Plugin
|
||||
if !disabledPlugins.Has("*") {
|
||||
for _, defaultEnabledPlugin := range defaultPluginSet.Enabled {
|
||||
if disabledPlugins.Has(defaultEnabledPlugin.Name) {
|
||||
@ -328,7 +316,7 @@ func mergePluginSets(defaultPluginSet, customPluginSet *PluginSet) *PluginSet {
|
||||
|
||||
enabledPlugins = append(enabledPlugins, customPluginSet.Enabled...)
|
||||
|
||||
return &PluginSet{Enabled: enabledPlugins}
|
||||
return PluginSet{Enabled: enabledPlugins}
|
||||
}
|
||||
|
||||
// Extender holds the parameters used to communicate with the extender. If a verb is unspecified/empty,
|
||||
|
@ -32,14 +32,14 @@ func TestPluginsAppend(t *testing.T) {
|
||||
{
|
||||
name: "AppendPlugin",
|
||||
customPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
},
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -47,23 +47,13 @@ func TestPluginsAppend(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: &PluginSet{},
|
||||
PreFilter: &PluginSet{},
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
PostFilter: &PluginSet{},
|
||||
PreScore: &PluginSet{},
|
||||
Score: &PluginSet{},
|
||||
Reserve: &PluginSet{},
|
||||
Permit: &PluginSet{},
|
||||
PreBind: &PluginSet{},
|
||||
Bind: &PluginSet{},
|
||||
PostBind: &PluginSet{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -93,14 +83,14 @@ func TestPluginsApply(t *testing.T) {
|
||||
{
|
||||
name: "AppendCustomPlugin",
|
||||
customPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
},
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -108,29 +98,19 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: &PluginSet{Enabled: []Plugin{}},
|
||||
PreFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "InsertAfterDefaultPlugins2",
|
||||
customPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "CustomPlugin"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -141,7 +121,7 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -149,29 +129,19 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: &PluginSet{Enabled: []Plugin{}},
|
||||
PreFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "CustomPlugin"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
},
|
||||
},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "InsertBeforeAllPlugins",
|
||||
customPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "CustomPlugin"},
|
||||
{Name: "DefaultPlugin1"},
|
||||
@ -183,7 +153,7 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -191,29 +161,19 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: &PluginSet{Enabled: []Plugin{}},
|
||||
PreFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "CustomPlugin"},
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
},
|
||||
},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ReorderDefaultPlugins",
|
||||
customPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin2"},
|
||||
{Name: "DefaultPlugin1"},
|
||||
@ -224,7 +184,7 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -232,29 +192,19 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: &PluginSet{Enabled: []Plugin{}},
|
||||
PreFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin2"},
|
||||
{Name: "DefaultPlugin1"},
|
||||
},
|
||||
},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ApplyNilCustomPlugin",
|
||||
customPlugins: nil,
|
||||
defaultPlugins: &Plugins{
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
@ -262,21 +212,12 @@ func TestPluginsApply(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedPlugins: &Plugins{
|
||||
QueueSort: nil,
|
||||
PreFilter: nil,
|
||||
Filter: &PluginSet{
|
||||
Filter: PluginSet{
|
||||
Enabled: []Plugin{
|
||||
{Name: "DefaultPlugin1"},
|
||||
{Name: "DefaultPlugin2"},
|
||||
},
|
||||
},
|
||||
PreScore: nil,
|
||||
Score: nil,
|
||||
Reserve: nil,
|
||||
Permit: nil,
|
||||
PreBind: nil,
|
||||
Bind: nil,
|
||||
PostBind: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -46,6 +46,98 @@ func getPluginArgConversionScheme() *runtime.Scheme {
|
||||
return pluginArgConversionScheme
|
||||
}
|
||||
|
||||
func Convert_v1beta1_Plugins_To_config_Plugins(in *v1beta1.Plugins, out *config.Plugins, s conversion.Scope) error {
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.QueueSort, &out.QueueSort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.PreFilter, &out.PreFilter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Filter, &out.Filter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.PostFilter, &out.PostFilter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.PreScore, &out.PreScore, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Score, &out.Score, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Reserve, &out.Reserve, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Permit, &out.Permit, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.PreBind, &out.PreBind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.Bind, &out.Bind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(in.PostBind, &out.PostBind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_PluginSet_To_config_PluginSet(in *v1beta1.PluginSet, out *config.PluginSet, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
return autoConvert_v1beta1_PluginSet_To_config_PluginSet(in, out, s)
|
||||
}
|
||||
|
||||
func Convert_config_Plugins_To_v1beta1_Plugins(in *config.Plugins, out *v1beta1.Plugins, s conversion.Scope) error {
|
||||
out.QueueSort = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.QueueSort, out.QueueSort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.PreFilter = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.PreFilter, out.PreFilter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Filter = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.Filter, out.Filter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.PostFilter = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.PostFilter, out.PostFilter, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.PreScore = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.PreScore, out.PreScore, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Score = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.Score, out.Score, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Reserve = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.Reserve, out.Reserve, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Permit = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.Permit, out.Permit, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.PreBind = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.PreBind, out.PreBind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Bind = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.Bind, out.Bind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.PostBind = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(&in.PostBind, out.PostBind, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1beta1.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in, out, s); err != nil {
|
||||
return err
|
||||
|
@ -150,26 +150,11 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.PluginSet)(nil), (*config.PluginSet)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_PluginSet_To_config_PluginSet(a.(*v1beta1.PluginSet), b.(*config.PluginSet), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.PluginSet)(nil), (*v1beta1.PluginSet)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_PluginSet_To_v1beta1_PluginSet(a.(*config.PluginSet), b.(*v1beta1.PluginSet), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.Plugins)(nil), (*config.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Plugins_To_config_Plugins(a.(*v1beta1.Plugins), b.(*config.Plugins), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.Plugins)(nil), (*v1beta1.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_Plugins_To_v1beta1_Plugins(a.(*config.Plugins), b.(*v1beta1.Plugins), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.PodTopologySpreadArgs)(nil), (*config.PodTopologySpreadArgs)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_PodTopologySpreadArgs_To_config_PodTopologySpreadArgs(a.(*v1beta1.PodTopologySpreadArgs), b.(*config.PodTopologySpreadArgs), scope)
|
||||
}); err != nil {
|
||||
@ -235,11 +220,26 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*config.Plugins)(nil), (*v1beta1.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_Plugins_To_v1beta1_Plugins(a.(*config.Plugins), b.(*v1beta1.Plugins), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.KubeSchedulerConfiguration)(nil), (*config.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(a.(*v1beta1.KubeSchedulerConfiguration), b.(*config.KubeSchedulerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.PluginSet)(nil), (*config.PluginSet)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_PluginSet_To_config_PluginSet(a.(*v1beta1.PluginSet), b.(*config.PluginSet), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.Plugins)(nil), (*config.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Plugins_To_config_Plugins(a.(*v1beta1.Plugins), b.(*config.Plugins), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -676,11 +676,6 @@ func autoConvert_v1beta1_PluginSet_To_config_PluginSet(in *v1beta1.PluginSet, ou
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_PluginSet_To_config_PluginSet is an autogenerated conversion function.
|
||||
func Convert_v1beta1_PluginSet_To_config_PluginSet(in *v1beta1.PluginSet, out *config.PluginSet, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_PluginSet_To_config_PluginSet(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_PluginSet_To_v1beta1_PluginSet(in *config.PluginSet, out *v1beta1.PluginSet, s conversion.Scope) error {
|
||||
if in.Enabled != nil {
|
||||
in, out := &in.Enabled, &out.Enabled
|
||||
@ -713,221 +708,35 @@ func Convert_config_PluginSet_To_v1beta1_PluginSet(in *config.PluginSet, out *v1
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Plugins_To_config_Plugins(in *v1beta1.Plugins, out *config.Plugins, s conversion.Scope) error {
|
||||
if in.QueueSort != nil {
|
||||
in, out := &in.QueueSort, &out.QueueSort
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.QueueSort = nil
|
||||
}
|
||||
if in.PreFilter != nil {
|
||||
in, out := &in.PreFilter, &out.PreFilter
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreFilter = nil
|
||||
}
|
||||
if in.Filter != nil {
|
||||
in, out := &in.Filter, &out.Filter
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Filter = nil
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostFilter = nil
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreScore = nil
|
||||
}
|
||||
if in.Score != nil {
|
||||
in, out := &in.Score, &out.Score
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Score = nil
|
||||
}
|
||||
if in.Reserve != nil {
|
||||
in, out := &in.Reserve, &out.Reserve
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Reserve = nil
|
||||
}
|
||||
if in.Permit != nil {
|
||||
in, out := &in.Permit, &out.Permit
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Permit = nil
|
||||
}
|
||||
if in.PreBind != nil {
|
||||
in, out := &in.PreBind, &out.PreBind
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreBind = nil
|
||||
}
|
||||
if in.Bind != nil {
|
||||
in, out := &in.Bind, &out.Bind
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Bind = nil
|
||||
}
|
||||
if in.PostBind != nil {
|
||||
in, out := &in.PostBind, &out.PostBind
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostBind = nil
|
||||
}
|
||||
// WARNING: in.QueueSort requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.PreFilter requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.Filter requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.PostFilter requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.PreScore requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.Score requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.Reserve requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.Permit requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.PreBind requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.Bind requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
// WARNING: in.PostBind requires manual conversion: inconvertible types (*k8s.io/kube-scheduler/config/v1beta1.PluginSet vs k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Plugins_To_config_Plugins is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Plugins_To_config_Plugins(in *v1beta1.Plugins, out *config.Plugins, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Plugins_To_config_Plugins(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_Plugins_To_v1beta1_Plugins(in *config.Plugins, out *v1beta1.Plugins, s conversion.Scope) error {
|
||||
if in.QueueSort != nil {
|
||||
in, out := &in.QueueSort, &out.QueueSort
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.QueueSort = nil
|
||||
}
|
||||
if in.PreFilter != nil {
|
||||
in, out := &in.PreFilter, &out.PreFilter
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreFilter = nil
|
||||
}
|
||||
if in.Filter != nil {
|
||||
in, out := &in.Filter, &out.Filter
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Filter = nil
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostFilter = nil
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreScore = nil
|
||||
}
|
||||
if in.Score != nil {
|
||||
in, out := &in.Score, &out.Score
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Score = nil
|
||||
}
|
||||
if in.Reserve != nil {
|
||||
in, out := &in.Reserve, &out.Reserve
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Reserve = nil
|
||||
}
|
||||
if in.Permit != nil {
|
||||
in, out := &in.Permit, &out.Permit
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Permit = nil
|
||||
}
|
||||
if in.PreBind != nil {
|
||||
in, out := &in.PreBind, &out.PreBind
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PreBind = nil
|
||||
}
|
||||
if in.Bind != nil {
|
||||
in, out := &in.Bind, &out.Bind
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Bind = nil
|
||||
}
|
||||
if in.PostBind != nil {
|
||||
in, out := &in.PostBind, &out.PostBind
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostBind = nil
|
||||
}
|
||||
// WARNING: in.QueueSort requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.PreFilter requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.Filter requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.PostFilter requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.PreScore requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.Score requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.Reserve requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.Permit requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.PreBind requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.Bind requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
// WARNING: in.PostBind requires manual conversion: inconvertible types (k8s.io/kubernetes/pkg/scheduler/apis/config.PluginSet vs *k8s.io/kube-scheduler/config/v1beta1.PluginSet)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_config_Plugins_To_v1beta1_Plugins is an autogenerated conversion function.
|
||||
func Convert_config_Plugins_To_v1beta1_Plugins(in *config.Plugins, out *v1beta1.Plugins, s conversion.Scope) error {
|
||||
return autoConvert_config_Plugins_To_v1beta1_Plugins(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_PodTopologySpreadArgs_To_config_PodTopologySpreadArgs(in *v1beta1.PodTopologySpreadArgs, out *config.PodTopologySpreadArgs, s conversion.Scope) error {
|
||||
out.DefaultConstraints = *(*[]corev1.TopologySpreadConstraint)(unsafe.Pointer(&in.DefaultConstraints))
|
||||
out.DefaultingType = config.PodTopologySpreadConstraintsDefaulting(in.DefaultingType)
|
||||
|
@ -90,12 +90,12 @@ func validateKubeSchedulerProfile(path *field.Path, profile *config.KubeSchedule
|
||||
|
||||
func validateCommonQueueSort(path *field.Path, profiles []config.KubeSchedulerProfile) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
var canon *config.PluginSet
|
||||
var canon config.PluginSet
|
||||
if profiles[0].Plugins != nil {
|
||||
canon = profiles[0].Plugins.QueueSort
|
||||
}
|
||||
for i := 1; i < len(profiles); i++ {
|
||||
var curr *config.PluginSet
|
||||
var curr config.PluginSet
|
||||
if profiles[i].Plugins != nil {
|
||||
curr = profiles[i].Plugins.QueueSort
|
||||
}
|
||||
|
@ -64,10 +64,10 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "me",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: "CustomSort"}},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Disabled: []config.Plugin{{Name: "*"}},
|
||||
},
|
||||
},
|
||||
@ -75,10 +75,10 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "other",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: "CustomSort"}},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: "CustomBind"}},
|
||||
},
|
||||
},
|
||||
|
66
pkg/scheduler/apis/config/zz_generated.deepcopy.go
generated
66
pkg/scheduler/apis/config/zz_generated.deepcopy.go
generated
@ -491,61 +491,17 @@ func (in *PluginSet) DeepCopy() *PluginSet {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Plugins) DeepCopyInto(out *Plugins) {
|
||||
*out = *in
|
||||
if in.QueueSort != nil {
|
||||
in, out := &in.QueueSort, &out.QueueSort
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PreFilter != nil {
|
||||
in, out := &in.PreFilter, &out.PreFilter
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Filter != nil {
|
||||
in, out := &in.Filter, &out.Filter
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Score != nil {
|
||||
in, out := &in.Score, &out.Score
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Reserve != nil {
|
||||
in, out := &in.Reserve, &out.Reserve
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Permit != nil {
|
||||
in, out := &in.Permit, &out.Permit
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PreBind != nil {
|
||||
in, out := &in.PreBind, &out.PreBind
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Bind != nil {
|
||||
in, out := &in.Bind, &out.Bind
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PostBind != nil {
|
||||
in, out := &in.PostBind, &out.PostBind
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.QueueSort.DeepCopyInto(&out.QueueSort)
|
||||
in.PreFilter.DeepCopyInto(&out.PreFilter)
|
||||
in.Filter.DeepCopyInto(&out.Filter)
|
||||
in.PostFilter.DeepCopyInto(&out.PostFilter)
|
||||
in.PreScore.DeepCopyInto(&out.PreScore)
|
||||
in.Score.DeepCopyInto(&out.Score)
|
||||
in.Reserve.DeepCopyInto(&out.Reserve)
|
||||
in.Permit.DeepCopyInto(&out.Permit)
|
||||
in.PreBind.DeepCopyInto(&out.PreBind)
|
||||
in.Bind.DeepCopyInto(&out.Bind)
|
||||
in.PostBind.DeepCopyInto(&out.PostBind)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -263,13 +262,13 @@ func (c *Configurator) createFromConfig(policy schedulerapi.Policy) (*Scheduler,
|
||||
// "PrioritySort", "DefaultPreemption" and "DefaultBinder" were neither predicates nor priorities
|
||||
// before. We add them by default.
|
||||
plugins := schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{{Name: queuesort.Name}},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{{Name: defaultpreemption.Name}},
|
||||
},
|
||||
Bind: &schedulerapi.PluginSet{
|
||||
Bind: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{{Name: defaultbinder.Name}},
|
||||
},
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
wantPlugins: &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodeResourcesFit"},
|
||||
{Name: "NodePorts"},
|
||||
@ -161,7 +161,7 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "InterPodAffinity"},
|
||||
},
|
||||
},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodeUnschedulable"},
|
||||
{Name: "NodeResourcesFit"},
|
||||
@ -180,8 +180,8 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "InterPodAffinity"},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "PodTopologySpread"},
|
||||
{Name: "InterPodAffinity"},
|
||||
@ -189,7 +189,7 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||
{Name: "PodTopologySpread", Weight: 2},
|
||||
@ -201,11 +201,9 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "TaintToleration", Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "VolumeBinding"}}},
|
||||
Permit: &schedulerapi.PluginSet{},
|
||||
PreBind: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "VolumeBinding"}}},
|
||||
Bind: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
PostBind: &schedulerapi.PluginSet{},
|
||||
Reserve: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "VolumeBinding"}}},
|
||||
PreBind: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "VolumeBinding"}}},
|
||||
Bind: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -286,9 +284,9 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
wantPlugins: &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "ServiceAffinity"}}},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
QueueSort: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "ServiceAffinity"}}},
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodeUnschedulable"},
|
||||
{Name: "TaintToleration"},
|
||||
@ -296,14 +294,14 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "ServiceAffinity"},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "NodeAffinity"},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "InterPodAffinity", Weight: 1},
|
||||
{Name: "NodeAffinity", Weight: 2},
|
||||
@ -312,11 +310,7 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "ServiceAffinity", Weight: 6},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{},
|
||||
Permit: &schedulerapi.PluginSet{},
|
||||
PreBind: &schedulerapi.PluginSet{},
|
||||
Bind: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
PostBind: &schedulerapi.PluginSet{},
|
||||
Bind: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -353,12 +347,12 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
wantPlugins: &schedulerapi.Plugins{
|
||||
QueueSort: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{
|
||||
QueueSort: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "PrioritySort"}}},
|
||||
PreFilter: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodePorts"},
|
||||
{Name: "NodeResourcesFit"},
|
||||
}},
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "NodeUnschedulable"},
|
||||
{Name: "NodePorts"},
|
||||
@ -366,22 +360,18 @@ func TestCreateFromConfig(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: &schedulerapi.PluginSet{
|
||||
PostFilter: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||
PreScore: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "InterPodAffinity"},
|
||||
},
|
||||
},
|
||||
Score: &schedulerapi.PluginSet{
|
||||
Score: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{
|
||||
{Name: "InterPodAffinity", Weight: 1},
|
||||
},
|
||||
},
|
||||
Reserve: &schedulerapi.PluginSet{},
|
||||
Permit: &schedulerapi.PluginSet{},
|
||||
PreBind: &schedulerapi.PluginSet{},
|
||||
Bind: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
PostBind: &schedulerapi.PluginSet{},
|
||||
Bind: schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultBinder"}}},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -524,10 +524,7 @@ func (lr *LegacyRegistry) registerPriorityConfigProducer(name string, producer c
|
||||
lr.priorityToConfigProducer[name] = producer
|
||||
}
|
||||
|
||||
func appendToPluginSet(set *config.PluginSet, name string, weight *int32) *config.PluginSet {
|
||||
if set == nil {
|
||||
set = &config.PluginSet{}
|
||||
}
|
||||
func appendToPluginSet(set config.PluginSet, name string, weight *int32) config.PluginSet {
|
||||
for _, e := range set.Enabled {
|
||||
if e.Name == name {
|
||||
// Keep the max weight.
|
||||
|
@ -84,7 +84,7 @@ func TestRegisterConfigProducers(t *testing.T) {
|
||||
}
|
||||
|
||||
wantPlugins := config.Plugins{
|
||||
Filter: &config.PluginSet{
|
||||
Filter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: nodeunschedulable.Name},
|
||||
{Name: tainttoleration.Name},
|
||||
@ -92,7 +92,7 @@ func TestRegisterConfigProducers(t *testing.T) {
|
||||
{Name: testFilterName2},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: testScoreName1, Weight: 1},
|
||||
{Name: testScoreName2, Weight: 1},
|
||||
@ -117,7 +117,7 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
||||
{
|
||||
name: "default priorities",
|
||||
wantPlugins: config.Plugins{
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name},
|
||||
{Name: interpodaffinity.Name},
|
||||
@ -125,7 +125,7 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
||||
{Name: tainttoleration.Name},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: noderesources.BalancedAllocationName, Weight: 1},
|
||||
{Name: podtopologyspread.Name, Weight: 2},
|
||||
@ -153,12 +153,12 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
||||
SelectorSpreadPriority: 3,
|
||||
},
|
||||
wantPlugins: config.Plugins{
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name, Weight: 3},
|
||||
},
|
||||
@ -179,12 +179,12 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
||||
EvenPodsSpreadPriority: 4,
|
||||
},
|
||||
wantPlugins: config.Plugins{
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name, Weight: 4},
|
||||
},
|
||||
@ -209,13 +209,13 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
||||
EvenPodsSpreadPriority: 2,
|
||||
},
|
||||
wantPlugins: config.Plugins{
|
||||
PreScore: &config.PluginSet{
|
||||
PreScore: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name},
|
||||
{Name: selectorspread.Name},
|
||||
},
|
||||
},
|
||||
Score: &config.PluginSet{
|
||||
Score: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: podtopologyspread.Name, Weight: 2},
|
||||
{Name: selectorspread.Name, Weight: 1},
|
||||
|
@ -100,7 +100,7 @@ type frameworkImpl struct {
|
||||
// frameworkImpl.
|
||||
type extensionPoint struct {
|
||||
// the set of plugins to be configured at this extension point.
|
||||
plugins *config.PluginSet
|
||||
plugins config.PluginSet
|
||||
// a pointer to the slice storing plugins implementations that will run at this
|
||||
// extension point.
|
||||
slicePtr interface{}
|
||||
@ -373,11 +373,7 @@ func getPluginArgsOrDefault(pluginConfig map[string]runtime.Object, name string)
|
||||
return obj, err
|
||||
}
|
||||
|
||||
func updatePluginList(pluginList interface{}, pluginSet *config.PluginSet, pluginsMap map[string]framework.Plugin) error {
|
||||
if pluginSet == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func updatePluginList(pluginList interface{}, pluginSet config.PluginSet, pluginsMap map[string]framework.Plugin) error {
|
||||
plugins := reflect.ValueOf(pluginList).Elem()
|
||||
pluginType := plugins.Type().Elem()
|
||||
set := sets.NewString()
|
||||
@ -1128,10 +1124,7 @@ func (f *frameworkImpl) pluginsNeeded(plugins *config.Plugins) map[string]config
|
||||
return pgMap
|
||||
}
|
||||
|
||||
find := func(pgs *config.PluginSet) {
|
||||
if pgs == nil {
|
||||
return
|
||||
}
|
||||
find := func(pgs config.PluginSet) {
|
||||
for _, pg := range pgs.Enabled {
|
||||
pgMap[pg.Name] = pg
|
||||
}
|
||||
|
@ -375,16 +375,16 @@ func newFrameworkWithQueueSortAndBind(r Registry, pl *config.Plugins, plc []conf
|
||||
}
|
||||
plugins := &config.Plugins{}
|
||||
plugins.Append(pl)
|
||||
if plugins.QueueSort == nil || len(plugins.QueueSort.Enabled) == 0 {
|
||||
if len(plugins.QueueSort.Enabled) == 0 {
|
||||
plugins.Append(&config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: queueSortPlugin}},
|
||||
},
|
||||
})
|
||||
}
|
||||
if plugins.Bind == nil || len(plugins.Bind.Enabled) == 0 {
|
||||
if len(plugins.Bind.Enabled) == 0 {
|
||||
plugins.Append(&config.Plugins{
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: bindPlugin}},
|
||||
},
|
||||
})
|
||||
@ -411,7 +411,7 @@ func TestInitFrameworkWithScorePlugins(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Score plugins are nil",
|
||||
plugins: &config.Plugins{Score: nil},
|
||||
plugins: &config.Plugins{},
|
||||
},
|
||||
{
|
||||
name: "enabled Score plugin list is empty",
|
||||
@ -450,7 +450,7 @@ func TestNewFrameworkErrors(t *testing.T) {
|
||||
{
|
||||
name: "duplicate plugin name",
|
||||
plugins: &config.Plugins{
|
||||
PreFilter: &config.PluginSet{
|
||||
PreFilter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: duplicatePluginName, Weight: 1},
|
||||
{Name: duplicatePluginName, Weight: 1},
|
||||
@ -465,7 +465,7 @@ func TestNewFrameworkErrors(t *testing.T) {
|
||||
{
|
||||
name: "duplicate plugin config",
|
||||
plugins: &config.Plugins{
|
||||
PreFilter: &config.PluginSet{
|
||||
PreFilter: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: duplicatePluginName, Weight: 1},
|
||||
},
|
||||
@ -510,9 +510,7 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
|
||||
"RequestedToCapacityRatio",
|
||||
"VolumeBinding",
|
||||
}
|
||||
plugins := config.Plugins{
|
||||
Filter: &config.PluginSet{},
|
||||
}
|
||||
plugins := config.Plugins{}
|
||||
// Use all plugins in Filter.
|
||||
// NOTE: This does not mean those plugins implemented `Filter` interfaces.
|
||||
// `TestPlugin` is created in this test to fake the behavior for test purpose.
|
||||
@ -520,7 +518,7 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
|
||||
plugins.Filter.Enabled = append(plugins.Filter.Enabled, config.Plugin{Name: name})
|
||||
}
|
||||
// Set required extension points.
|
||||
onePlugin := &config.PluginSet{
|
||||
onePlugin := config.PluginSet{
|
||||
Enabled: []config.Plugin{{Name: pluginsWithArgs[0]}},
|
||||
}
|
||||
plugins.QueueSort = onePlugin
|
||||
@ -840,7 +838,7 @@ func TestPreFilterPlugins(t *testing.T) {
|
||||
func(_ runtime.Object, fh framework.Handle) (framework.Plugin, error) {
|
||||
return preFilter2, nil
|
||||
})
|
||||
plugins := &config.Plugins{PreFilter: &config.PluginSet{Enabled: []config.Plugin{{Name: preFilterWithExtensionsPluginName}, {Name: preFilterPluginName}}}}
|
||||
plugins := &config.Plugins{PreFilter: config.PluginSet{Enabled: []config.Plugin{{Name: preFilterWithExtensionsPluginName}, {Name: preFilterPluginName}}}}
|
||||
t.Run("TestPreFilterPlugin", func(t *testing.T) {
|
||||
f, err := newFrameworkWithQueueSortAndBind(r, plugins, emptyArgs)
|
||||
if err != nil {
|
||||
@ -1067,7 +1065,7 @@ func TestFilterPlugins(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
cfgPls := &config.Plugins{Filter: &config.PluginSet{}}
|
||||
cfgPls := &config.Plugins{}
|
||||
for _, pl := range tt.plugins {
|
||||
// register all plugins
|
||||
tmpPl := pl
|
||||
@ -1148,7 +1146,7 @@ func TestPostFilterPlugins(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
cfgPls := &config.Plugins{PostFilter: &config.PluginSet{}}
|
||||
cfgPls := &config.Plugins{}
|
||||
for _, pl := range tt.plugins {
|
||||
// register all plugins
|
||||
tmpPl := pl
|
||||
@ -1278,10 +1276,7 @@ func TestFilterPluginsWithNominatedPods(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
cfgPls := &config.Plugins{
|
||||
PreFilter: &config.PluginSet{},
|
||||
Filter: &config.PluginSet{},
|
||||
}
|
||||
cfgPls := &config.Plugins{}
|
||||
|
||||
if tt.preFilterPlugin != nil {
|
||||
if err := registry.Register(tt.preFilterPlugin.name,
|
||||
@ -1451,7 +1446,7 @@ func TestPreBindPlugins(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
configPlugins := &config.Plugins{PreBind: &config.PluginSet{}}
|
||||
configPlugins := &config.Plugins{}
|
||||
|
||||
for _, pl := range tt.plugins {
|
||||
tmpPl := pl
|
||||
@ -1607,7 +1602,7 @@ func TestReservePlugins(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
configPlugins := &config.Plugins{Reserve: &config.PluginSet{}}
|
||||
configPlugins := &config.Plugins{}
|
||||
|
||||
for _, pl := range tt.plugins {
|
||||
tmpPl := pl
|
||||
@ -1731,7 +1726,7 @@ func TestPermitPlugins(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
registry := Registry{}
|
||||
configPlugins := &config.Plugins{Permit: &config.PluginSet{}}
|
||||
configPlugins := &config.Plugins{}
|
||||
|
||||
for _, pl := range tt.plugins {
|
||||
tmpPl := pl
|
||||
@ -1897,7 +1892,7 @@ func TestRecordingMetrics(t *testing.T) {
|
||||
func(_ runtime.Object, fh framework.Handle) (framework.Plugin, error) {
|
||||
return plugin, nil
|
||||
})
|
||||
pluginSet := &config.PluginSet{Enabled: []config.Plugin{{Name: testPlugin, Weight: 1}}}
|
||||
pluginSet := config.PluginSet{Enabled: []config.Plugin{{Name: testPlugin, Weight: 1}}}
|
||||
plugins := &config.Plugins{
|
||||
Score: pluginSet,
|
||||
PreFilter: pluginSet,
|
||||
@ -2002,7 +1997,7 @@ func TestRunBindPlugins(t *testing.T) {
|
||||
metrics.FrameworkExtensionPointDuration.Reset()
|
||||
metrics.PluginExecutionDuration.Reset()
|
||||
|
||||
pluginSet := &config.PluginSet{}
|
||||
pluginSet := config.PluginSet{}
|
||||
r := make(Registry)
|
||||
for i, inj := range tt.injects {
|
||||
name := fmt.Sprintf("bind-%d", i)
|
||||
@ -2066,7 +2061,7 @@ func TestPermitWaitDurationMetric(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
plugins := &config.Plugins{
|
||||
Permit: &config.PluginSet{Enabled: []config.Plugin{{Name: testPlugin, Weight: 1}}},
|
||||
Permit: config.PluginSet{Enabled: []config.Plugin{{Name: testPlugin, Weight: 1}}},
|
||||
}
|
||||
f, err := newFrameworkWithQueueSortAndBind(r, plugins, emptyArgs)
|
||||
if err != nil {
|
||||
@ -2119,7 +2114,7 @@ func TestWaitOnPermit(t *testing.T) {
|
||||
return testPermitPlugin, nil
|
||||
})
|
||||
plugins := &config.Plugins{
|
||||
Permit: &config.PluginSet{Enabled: []config.Plugin{{Name: permitPlugin, Weight: 1}}},
|
||||
Permit: config.PluginSet{Enabled: []config.Plugin{{Name: permitPlugin, Weight: 1}}},
|
||||
}
|
||||
|
||||
f, err := newFrameworkWithQueueSortAndBind(r, plugins, emptyArgs)
|
||||
@ -2158,7 +2153,7 @@ func TestListPlugins(t *testing.T) {
|
||||
{
|
||||
name: "Add multiple plugins",
|
||||
plugins: &config.Plugins{
|
||||
Score: &config.PluginSet{Enabled: []config.Plugin{{Name: scorePlugin1}, {Name: scoreWithNormalizePlugin1}}},
|
||||
Score: config.PluginSet{Enabled: []config.Plugin{{Name: scorePlugin1}, {Name: scoreWithNormalizePlugin1}}},
|
||||
},
|
||||
pluginSetCount: 3,
|
||||
},
|
||||
@ -2187,7 +2182,7 @@ func buildScoreConfigWithWeights(weights map[string]int32, ps ...string) *config
|
||||
for _, p := range ps {
|
||||
plugins = append(plugins, config.Plugin{Name: p, Weight: weights[p]})
|
||||
}
|
||||
return &config.Plugins{Score: &config.PluginSet{Enabled: plugins}}
|
||||
return &config.Plugins{Score: config.PluginSet{Enabled: plugins}}
|
||||
}
|
||||
|
||||
type injectedResult struct {
|
||||
|
@ -96,7 +96,7 @@ func (v *cfgValidator) validate(cfg config.KubeSchedulerProfile) error {
|
||||
if v.m[cfg.SchedulerName] != nil {
|
||||
return fmt.Errorf("duplicate profile with scheduler name %q", cfg.SchedulerName)
|
||||
}
|
||||
if cfg.Plugins.QueueSort == nil || len(cfg.Plugins.QueueSort.Enabled) != 1 {
|
||||
if len(cfg.Plugins.QueueSort.Enabled) != 1 {
|
||||
return fmt.Errorf("one queue sort plugin required for profile with scheduler name %q", cfg.SchedulerName)
|
||||
}
|
||||
queueSort := cfg.Plugins.QueueSort.Enabled[0].Name
|
||||
|
@ -49,12 +49,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-1",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind1"},
|
||||
},
|
||||
@ -64,12 +64,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-2",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind2"},
|
||||
},
|
||||
@ -90,12 +90,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-1",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind1"},
|
||||
},
|
||||
@ -105,12 +105,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-2",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Another"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind2"},
|
||||
},
|
||||
@ -126,12 +126,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-1",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind1"},
|
||||
},
|
||||
@ -147,12 +147,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-2",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind2"},
|
||||
},
|
||||
@ -168,12 +168,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-1",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind1"},
|
||||
},
|
||||
@ -183,12 +183,12 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "profile-1",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind2"},
|
||||
},
|
||||
@ -203,12 +203,12 @@ func TestNewMap(t *testing.T) {
|
||||
cfgs: []config.KubeSchedulerProfile{
|
||||
{
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
},
|
||||
Bind: &config.PluginSet{
|
||||
Bind: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "Bind1"},
|
||||
},
|
||||
@ -233,7 +233,7 @@ func TestNewMap(t *testing.T) {
|
||||
{
|
||||
SchedulerName: "invalid-profile",
|
||||
Plugins: &config.Plugins{
|
||||
QueueSort: &config.PluginSet{
|
||||
QueueSort: config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{Name: "QueueSort"},
|
||||
},
|
||||
|
@ -461,7 +461,7 @@ func TestSchedulerMultipleProfilesScheduling(t *testing.T) {
|
||||
WithProfiles(
|
||||
schedulerapi.KubeSchedulerProfile{SchedulerName: "match-machine2",
|
||||
Plugins: &schedulerapi.Plugins{
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{{Name: "FakeNodeSelector"}},
|
||||
Disabled: []schedulerapi.Plugin{{Name: "*"}},
|
||||
}},
|
||||
@ -474,7 +474,7 @@ func TestSchedulerMultipleProfilesScheduling(t *testing.T) {
|
||||
schedulerapi.KubeSchedulerProfile{
|
||||
SchedulerName: "match-machine3",
|
||||
Plugins: &schedulerapi.Plugins{
|
||||
Filter: &schedulerapi.PluginSet{
|
||||
Filter: schedulerapi.PluginSet{
|
||||
Enabled: []schedulerapi.Plugin{{Name: "FakeNodeSelector"}},
|
||||
Disabled: []schedulerapi.Plugin{{Name: "*"}},
|
||||
}},
|
||||
|
@ -107,33 +107,26 @@ func RegisterPluginAsExtensionsWithWeight(pluginName string, weight int32, plugi
|
||||
func getPluginSetByExtension(plugins *schedulerapi.Plugins, extension string) *schedulerapi.PluginSet {
|
||||
switch extension {
|
||||
case "QueueSort":
|
||||
return initializeIfNeeded(&plugins.QueueSort)
|
||||
return &plugins.QueueSort
|
||||
case "Filter":
|
||||
return initializeIfNeeded(&plugins.Filter)
|
||||
return &plugins.Filter
|
||||
case "PreFilter":
|
||||
return initializeIfNeeded(&plugins.PreFilter)
|
||||
return &plugins.PreFilter
|
||||
case "PreScore":
|
||||
return initializeIfNeeded(&plugins.PreScore)
|
||||
return &plugins.PreScore
|
||||
case "Score":
|
||||
return initializeIfNeeded(&plugins.Score)
|
||||
return &plugins.Score
|
||||
case "Bind":
|
||||
return initializeIfNeeded(&plugins.Bind)
|
||||
return &plugins.Bind
|
||||
case "Reserve":
|
||||
return initializeIfNeeded(&plugins.Reserve)
|
||||
return &plugins.Reserve
|
||||
case "Permit":
|
||||
return initializeIfNeeded(&plugins.Permit)
|
||||
return &plugins.Permit
|
||||
case "PreBind":
|
||||
return initializeIfNeeded(&plugins.PreBind)
|
||||
return &plugins.PreBind
|
||||
case "PostBind":
|
||||
return initializeIfNeeded(&plugins.PostBind)
|
||||
return &plugins.PostBind
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func initializeIfNeeded(s **schedulerapi.PluginSet) *schedulerapi.PluginSet {
|
||||
if *s == nil {
|
||||
*s = &schedulerapi.PluginSet{}
|
||||
}
|
||||
return *s
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ func TestPreFilterPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
PreFilter: &schedulerconfig.PluginSet{
|
||||
PreFilter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: prefilterPluginName},
|
||||
},
|
||||
@ -657,12 +657,12 @@ func TestPostFilterPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Filter: &schedulerconfig.PluginSet{
|
||||
Filter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: filterPluginName},
|
||||
},
|
||||
},
|
||||
Score: &schedulerconfig.PluginSet{
|
||||
Score: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: scorePluginName},
|
||||
},
|
||||
@ -672,7 +672,7 @@ func TestPostFilterPlugin(t *testing.T) {
|
||||
{Name: "*"},
|
||||
},
|
||||
},
|
||||
PostFilter: &schedulerconfig.PluginSet{
|
||||
PostFilter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: postfilterPluginName},
|
||||
},
|
||||
@ -744,7 +744,7 @@ func TestScorePlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Score: &schedulerconfig.PluginSet{
|
||||
Score: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: scorePluginName},
|
||||
},
|
||||
@ -820,7 +820,7 @@ func TestNormalizeScorePlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Score: &schedulerconfig.PluginSet{
|
||||
Score: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: scoreWithNormalizePluginName},
|
||||
},
|
||||
@ -864,7 +864,7 @@ func TestReservePluginReserve(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Reserve: &schedulerconfig.PluginSet{
|
||||
Reserve: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: reservePluginName,
|
||||
@ -935,7 +935,7 @@ func TestPrebindPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
PreBind: &schedulerconfig.PluginSet{
|
||||
PreBind: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: preBindPluginName,
|
||||
@ -1061,10 +1061,10 @@ func TestReservePluginUnreserve(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Reserve: &schedulerconfig.PluginSet{
|
||||
Reserve: schedulerconfig.PluginSet{
|
||||
// filled by looping over reservePlugins
|
||||
},
|
||||
PreBind: &schedulerconfig.PluginSet{
|
||||
PreBind: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: preBindPluginName,
|
||||
@ -1159,15 +1159,15 @@ func TestBindPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Reserve: &schedulerconfig.PluginSet{
|
||||
Reserve: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{{Name: reservePlugin.Name()}},
|
||||
},
|
||||
Bind: &schedulerconfig.PluginSet{
|
||||
Bind: schedulerconfig.PluginSet{
|
||||
// Put DefaultBinder last.
|
||||
Enabled: []schedulerconfig.Plugin{{Name: bindPlugin1.Name()}, {Name: bindPlugin2.Name()}, {Name: defaultbinder.Name}},
|
||||
Disabled: []schedulerconfig.Plugin{{Name: defaultbinder.Name}},
|
||||
},
|
||||
PostBind: &schedulerconfig.PluginSet{
|
||||
PostBind: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{{Name: postBindPlugin.Name()}},
|
||||
},
|
||||
},
|
||||
@ -1345,14 +1345,14 @@ func TestPostBindPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
PreBind: &schedulerconfig.PluginSet{
|
||||
PreBind: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: preBindPluginName,
|
||||
},
|
||||
},
|
||||
},
|
||||
PostBind: &schedulerconfig.PluginSet{
|
||||
PostBind: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: postBindPluginName,
|
||||
@ -1691,7 +1691,7 @@ func TestFilterPlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Filter: &schedulerconfig.PluginSet{
|
||||
Filter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: filterPluginName,
|
||||
@ -1763,7 +1763,7 @@ func TestPreScorePlugin(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
PreScore: &schedulerconfig.PluginSet{
|
||||
PreScore: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{
|
||||
Name: preScorePluginName,
|
||||
@ -1929,7 +1929,7 @@ func initRegistryAndConfig(pp ...*PermitPlugin) (registry frameworkruntime.Regis
|
||||
|
||||
prof.SchedulerName = v1.DefaultSchedulerName
|
||||
prof.Plugins = &schedulerconfig.Plugins{
|
||||
Permit: &schedulerconfig.PluginSet{
|
||||
Permit: schedulerconfig.PluginSet{
|
||||
Enabled: plugins,
|
||||
},
|
||||
}
|
||||
|
@ -135,12 +135,12 @@ func TestPreemption(t *testing.T) {
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Filter: &schedulerconfig.PluginSet{
|
||||
Filter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: filterPluginName},
|
||||
},
|
||||
},
|
||||
PreFilter: &schedulerconfig.PluginSet{
|
||||
PreFilter: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: filterPluginName},
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *tes
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
Score: &schedulerconfig.PluginSet{
|
||||
Score: schedulerconfig.PluginSet{
|
||||
Enabled: []schedulerconfig.Plugin{
|
||||
{Name: scorePluginName, Weight: 1},
|
||||
},
|
||||
|
@ -92,7 +92,7 @@ func initTestDisablePreemption(t *testing.T, nsPrefix string) *testutils.TestCon
|
||||
prof := schedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
Plugins: &schedulerconfig.Plugins{
|
||||
PostFilter: &schedulerconfig.PluginSet{
|
||||
PostFilter: schedulerconfig.PluginSet{
|
||||
Disabled: []schedulerconfig.Plugin{
|
||||
{Name: defaultpreemption.Name},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user