mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #91580 from cofyc/fix90958
Remove KubeSchedulerConfiguration.BindTimeoutSeconds
This commit is contained in:
commit
4e3dea81c1
@ -247,7 +247,6 @@ profiles:
|
||||
}
|
||||
|
||||
defaultSource := "DefaultProvider"
|
||||
defaultBindTimeoutSeconds := int64(600)
|
||||
defaultPodInitialBackoffSeconds := int64(1)
|
||||
defaultPodMaxBackoffSeconds := int64(10)
|
||||
defaultPercentageOfNodesToScore := int32(0)
|
||||
@ -320,7 +319,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -410,7 +408,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -474,7 +471,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -513,7 +509,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -587,7 +582,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -659,7 +653,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
@ -711,7 +704,6 @@ profiles:
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
},
|
||||
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||
Profiles: []kubeschedulerconfig.KubeSchedulerProfile{
|
||||
|
@ -337,7 +337,6 @@ func Setup(ctx context.Context, opts *options.Options, outOfTreeRegistryOptions
|
||||
scheduler.WithAlgorithmSource(cc.ComponentConfig.AlgorithmSource),
|
||||
scheduler.WithPreemptionDisabled(cc.ComponentConfig.DisablePreemption),
|
||||
scheduler.WithPercentageOfNodesToScore(cc.ComponentConfig.PercentageOfNodesToScore),
|
||||
scheduler.WithBindTimeoutSeconds(cc.ComponentConfig.BindTimeoutSeconds),
|
||||
scheduler.WithFrameworkOutOfTreeRegistry(outOfTreeRegistry),
|
||||
scheduler.WithPodMaxBackoffSeconds(cc.ComponentConfig.PodMaxBackoffSeconds),
|
||||
scheduler.WithPodInitialBackoffSeconds(cc.ComponentConfig.PodInitialBackoffSeconds),
|
||||
|
@ -21,7 +21,6 @@ go_library(
|
||||
"//pkg/scheduler/framework/plugins/defaultbinder:go_default_library",
|
||||
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
||||
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
|
||||
"//pkg/scheduler/framework/plugins/volumebinding:go_default_library",
|
||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||
"//pkg/scheduler/internal/cache:go_default_library",
|
||||
"//pkg/scheduler/internal/cache/debugger:go_default_library",
|
||||
|
@ -478,7 +478,6 @@ profiles:
|
||||
},
|
||||
},
|
||||
want: `apiVersion: kubescheduler.config.k8s.io/v1beta1
|
||||
bindTimeoutSeconds: 0
|
||||
clientConnection:
|
||||
acceptContentTypes: ""
|
||||
burst: 0
|
||||
|
@ -1616,15 +1616,6 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
"PostBindPlugin": {{Name: "VolumeBinding"}},
|
||||
}
|
||||
|
||||
defaultPluginConfigs := []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 600,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
testcases := []struct {
|
||||
name string
|
||||
plugins config.Plugins
|
||||
@ -1635,7 +1626,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
{
|
||||
name: "default plugins",
|
||||
wantPlugins: defaultPlugins,
|
||||
wantPluginConfig: defaultPluginConfigs,
|
||||
wantPluginConfig: nil,
|
||||
},
|
||||
{
|
||||
name: "default plugins with customized plugin config",
|
||||
@ -1966,7 +1957,7 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||
"PostBindPlugin": {{Name: "VolumeBinding"}},
|
||||
},
|
||||
wantPluginConfig: defaultPluginConfigs,
|
||||
wantPluginConfig: nil,
|
||||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
|
@ -90,13 +90,6 @@ type KubeSchedulerConfiguration struct {
|
||||
// nodes will be scored.
|
||||
PercentageOfNodesToScore int32
|
||||
|
||||
// BindTimeoutSeconds is the timeout in seconds in volume binding operation.
|
||||
// Value must be non-negative integer. The value zero indicates no waiting.
|
||||
// If this value is nil, the default value will be used.
|
||||
// DEPRECATED: BindTimeoutSeconds in deprecated.
|
||||
// TODO(#90958) Remove this and the versioned counterparts in future API versions.
|
||||
BindTimeoutSeconds int64
|
||||
|
||||
// PodInitialBackoffSeconds is the initial backoff for unschedulable pods.
|
||||
// If specified, it must be greater than 0. If this value is null, the default value (1s)
|
||||
// will be used.
|
||||
|
@ -135,11 +135,6 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta1.KubeSchedulerConfigurat
|
||||
// Use the default LeaderElectionConfiguration options
|
||||
componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
|
||||
|
||||
if obj.BindTimeoutSeconds == nil {
|
||||
val := int64(600)
|
||||
obj.BindTimeoutSeconds = &val
|
||||
}
|
||||
|
||||
if obj.PodInitialBackoffSeconds == nil {
|
||||
val := int64(1)
|
||||
obj.PodInitialBackoffSeconds = &val
|
||||
|
@ -62,7 +62,6 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
DisablePreemption: pointer.BoolPtr(false),
|
||||
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||
Profiles: []v1beta1.KubeSchedulerProfile{
|
||||
@ -104,7 +103,6 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
DisablePreemption: pointer.BoolPtr(false),
|
||||
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||
Profiles: []v1beta1.KubeSchedulerProfile{
|
||||
@ -161,7 +159,6 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
DisablePreemption: pointer.BoolPtr(false),
|
||||
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||
Profiles: []v1beta1.KubeSchedulerProfile{
|
||||
@ -212,7 +209,6 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
DisablePreemption: pointer.BoolPtr(false),
|
||||
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||
Profiles: []v1beta1.KubeSchedulerProfile{
|
||||
@ -249,7 +245,6 @@ func TestSchedulerDefaults(t *testing.T) {
|
||||
},
|
||||
DisablePreemption: pointer.BoolPtr(false),
|
||||
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||
Profiles: []v1beta1.KubeSchedulerProfile{
|
||||
|
@ -259,9 +259,6 @@ func autoConvert_v1beta1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfi
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.PercentageOfNodesToScore, &out.PercentageOfNodesToScore, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_Pointer_int64_To_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_Pointer_int64_To_int64(&in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -306,9 +303,6 @@ func autoConvert_config_KubeSchedulerConfiguration_To_v1beta1_KubeSchedulerConfi
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.PercentageOfNodesToScore, &out.PercentageOfNodesToScore, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_int64_To_Pointer_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v1.Convert_int64_To_Pointer_int64(&in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import (
|
||||
)
|
||||
|
||||
func TestValidateKubeSchedulerConfiguration(t *testing.T) {
|
||||
testTimeout := int64(0)
|
||||
podInitialBackoffSeconds := int64(1)
|
||||
podMaxBackoffSeconds := int64(1)
|
||||
validConfig := &config.KubeSchedulerConfiguration{
|
||||
@ -59,7 +58,6 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) {
|
||||
},
|
||||
PodInitialBackoffSeconds: podInitialBackoffSeconds,
|
||||
PodMaxBackoffSeconds: podMaxBackoffSeconds,
|
||||
BindTimeoutSeconds: testTimeout,
|
||||
PercentageOfNodesToScore: 35,
|
||||
Profiles: []config.KubeSchedulerProfile{
|
||||
{
|
||||
|
@ -48,7 +48,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
||||
cachedebugger "k8s.io/kubernetes/pkg/scheduler/internal/cache/debugger"
|
||||
@ -86,8 +85,6 @@ type Configurator struct {
|
||||
// percentageOfNodesToScore specifies percentage of all nodes to score in each scheduling cycle.
|
||||
percentageOfNodesToScore int32
|
||||
|
||||
bindTimeoutSeconds int64
|
||||
|
||||
podInitialBackoffSeconds int64
|
||||
|
||||
podMaxBackoffSeconds int64
|
||||
@ -212,26 +209,6 @@ func (c *Configurator) create() (*Scheduler, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func maybeAppendVolumeBindingArgs(plugins *schedulerapi.Plugins, pcs []schedulerapi.PluginConfig, config schedulerapi.PluginConfig) []schedulerapi.PluginConfig {
|
||||
enabled := false
|
||||
for _, p := range plugins.PreBind.Enabled {
|
||||
if p.Name == volumebinding.Name {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
if !enabled {
|
||||
// skip if VolumeBinding is not enabled
|
||||
return pcs
|
||||
}
|
||||
// append if not exist
|
||||
for _, pc := range pcs {
|
||||
if pc.Name == config.Name {
|
||||
return pcs
|
||||
}
|
||||
}
|
||||
return append(pcs, config)
|
||||
}
|
||||
|
||||
// createFromProvider creates a scheduler from the name of a registered algorithm provider.
|
||||
func (c *Configurator) createFromProvider(providerName string) (*Scheduler, error) {
|
||||
klog.V(2).Infof("Creating scheduler from algorithm provider '%v'", providerName)
|
||||
@ -247,12 +224,6 @@ func (c *Configurator) createFromProvider(providerName string) (*Scheduler, erro
|
||||
plugins.Append(defaultPlugins)
|
||||
plugins.Apply(prof.Plugins)
|
||||
prof.Plugins = plugins
|
||||
prof.PluginConfig = maybeAppendVolumeBindingArgs(prof.Plugins, prof.PluginConfig, schedulerapi.PluginConfig{
|
||||
Name: volumebinding.Name,
|
||||
Args: &schedulerapi.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: c.bindTimeoutSeconds,
|
||||
},
|
||||
})
|
||||
}
|
||||
return c.create()
|
||||
}
|
||||
@ -348,12 +319,6 @@ func (c *Configurator) createFromConfig(policy schedulerapi.Policy) (*Scheduler,
|
||||
|
||||
// PluginConfig is ignored when using Policy.
|
||||
prof.PluginConfig = defPluginConfig
|
||||
prof.PluginConfig = maybeAppendVolumeBindingArgs(prof.Plugins, prof.PluginConfig, schedulerapi.PluginConfig{
|
||||
Name: volumebinding.Name,
|
||||
Args: &schedulerapi.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: c.bindTimeoutSeconds,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return c.create()
|
||||
|
@ -36,7 +36,6 @@ import (
|
||||
"k8s.io/client-go/tools/events"
|
||||
extenderv1 "k8s.io/kube-scheduler/extender/v1"
|
||||
apicore "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
|
||||
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
||||
@ -45,7 +44,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodelabel"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/serviceaffinity"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
||||
internalqueue "k8s.io/kubernetes/pkg/scheduler/internal/queue"
|
||||
@ -54,7 +52,6 @@ import (
|
||||
|
||||
const (
|
||||
disablePodPreemption = false
|
||||
bindTimeoutSeconds = 600
|
||||
podInitialBackoffDurationSeconds = 1
|
||||
podMaxBackoffDurationSeconds = 10
|
||||
testSchedulerName = "test-scheduler"
|
||||
@ -242,14 +239,7 @@ func TestCreateFromEmptyConfig(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
prof := factory.profiles[0]
|
||||
wantConfig := []schedulerapi.PluginConfig{
|
||||
{
|
||||
Name: volumebinding.Name,
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: bindTimeoutSeconds,
|
||||
},
|
||||
},
|
||||
}
|
||||
wantConfig := []schedulerapi.PluginConfig{}
|
||||
if diff := cmp.Diff(wantConfig, prof.PluginConfig); diff != "" {
|
||||
t.Errorf("wrong plugin config (-want, +got): %s", diff)
|
||||
}
|
||||
@ -465,7 +455,6 @@ func newConfigFactoryWithFrameworkRegistry(
|
||||
podInformer: informerFactory.Core().V1().Pods(),
|
||||
disablePreemption: disablePodPreemption,
|
||||
percentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
||||
bindTimeoutSeconds: bindTimeoutSeconds,
|
||||
podInitialBackoffSeconds: podInitialBackoffDurationSeconds,
|
||||
podMaxBackoffSeconds: podMaxBackoffDurationSeconds,
|
||||
StopEverything: stopCh,
|
||||
|
@ -41,7 +41,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
|
||||
"k8s.io/kubernetes/pkg/scheduler/core"
|
||||
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
||||
internalqueue "k8s.io/kubernetes/pkg/scheduler/internal/queue"
|
||||
@ -113,7 +112,6 @@ type schedulerOptions struct {
|
||||
schedulerAlgorithmSource schedulerapi.SchedulerAlgorithmSource
|
||||
disablePreemption bool
|
||||
percentageOfNodesToScore int32
|
||||
bindTimeoutSeconds int64
|
||||
podInitialBackoffSeconds int64
|
||||
podMaxBackoffSeconds int64
|
||||
// Contains out-of-tree plugins to be merged with the in-tree registry.
|
||||
@ -155,13 +153,6 @@ func WithPercentageOfNodesToScore(percentageOfNodesToScore int32) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithBindTimeoutSeconds sets bindTimeoutSeconds for Scheduler, the default value is 100
|
||||
func WithBindTimeoutSeconds(bindTimeoutSeconds int64) Option {
|
||||
return func(o *schedulerOptions) {
|
||||
o.bindTimeoutSeconds = bindTimeoutSeconds
|
||||
}
|
||||
}
|
||||
|
||||
// WithFrameworkOutOfTreeRegistry sets the registry for out-of-tree plugins. Those plugins
|
||||
// will be appended to the default registry.
|
||||
func WithFrameworkOutOfTreeRegistry(registry framework.Registry) Option {
|
||||
@ -211,7 +202,6 @@ var defaultSchedulerOptions = schedulerOptions{
|
||||
},
|
||||
disablePreemption: false,
|
||||
percentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
||||
bindTimeoutSeconds: volumebinding.DefaultBindTimeoutSeconds,
|
||||
podInitialBackoffSeconds: int64(internalqueue.DefaultPodInitialBackoffDuration.Seconds()),
|
||||
podMaxBackoffSeconds: int64(internalqueue.DefaultPodMaxBackoffDuration.Seconds()),
|
||||
}
|
||||
@ -252,7 +242,6 @@ func New(client clientset.Interface,
|
||||
StopEverything: stopEverything,
|
||||
disablePreemption: options.disablePreemption,
|
||||
percentageOfNodesToScore: options.percentageOfNodesToScore,
|
||||
bindTimeoutSeconds: options.bindTimeoutSeconds,
|
||||
podInitialBackoffSeconds: options.podInitialBackoffSeconds,
|
||||
podMaxBackoffSeconds: options.podMaxBackoffSeconds,
|
||||
profiles: append([]schedulerapi.KubeSchedulerProfile(nil), options.profiles...),
|
||||
|
@ -42,14 +42,12 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
clientsetfake "k8s.io/client-go/kubernetes/fake"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
clienttesting "k8s.io/client-go/testing"
|
||||
clientcache "k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/events"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/scheduling"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
"k8s.io/kubernetes/pkg/scheduler/core"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
||||
@ -1187,125 +1185,6 @@ func TestSchedulerBinding(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestInjectingPluginConfigForVolumeBinding tests injecting
|
||||
// KubeSchedulerConfiguration.BindTimeoutSeconds as args for VolumeBinding if
|
||||
// no plugin args is configured for it.
|
||||
// TODO remove when KubeSchedulerConfiguration.BindTimeoutSeconds is eliminated
|
||||
func TestInjectingPluginConfigForVolumeBinding(t *testing.T) {
|
||||
defaultPluginConfigs := []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 600,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
opts []Option
|
||||
wantPluginConfig []config.PluginConfig
|
||||
}{
|
||||
{
|
||||
name: "default with provider",
|
||||
wantPluginConfig: defaultPluginConfigs,
|
||||
},
|
||||
{
|
||||
name: "default with policy",
|
||||
opts: []Option{
|
||||
WithAlgorithmSource(schedulerapi.SchedulerAlgorithmSource{
|
||||
Policy: &config.SchedulerPolicySource{},
|
||||
}),
|
||||
},
|
||||
wantPluginConfig: defaultPluginConfigs,
|
||||
},
|
||||
{
|
||||
name: "customize BindTimeoutSeconds with provider",
|
||||
opts: []Option{
|
||||
WithBindTimeoutSeconds(100),
|
||||
},
|
||||
wantPluginConfig: []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "customize BindTimeoutSeconds with policy",
|
||||
opts: []Option{
|
||||
WithAlgorithmSource(schedulerapi.SchedulerAlgorithmSource{
|
||||
Policy: &config.SchedulerPolicySource{},
|
||||
}),
|
||||
WithBindTimeoutSeconds(100),
|
||||
},
|
||||
wantPluginConfig: []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PluginConfig is preferred",
|
||||
opts: []Option{
|
||||
WithBindTimeoutSeconds(100),
|
||||
WithProfiles(config.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
PluginConfig: []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
wantPluginConfig: []config.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &config.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
client := fake.NewSimpleClientset()
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||
recorderFactory := profile.NewRecorderFactory(events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1beta1().Events("")}))
|
||||
|
||||
opts := append(tt.opts, WithBuildFrameworkCapturer(func(p config.KubeSchedulerProfile) {
|
||||
if p.SchedulerName != v1.DefaultSchedulerName {
|
||||
t.Errorf("unexpected scheduler name (want %q, got %q)", v1.DefaultSchedulerName, p.SchedulerName)
|
||||
}
|
||||
if diff := cmp.Diff(tt.wantPluginConfig, p.PluginConfig); diff != "" {
|
||||
t.Errorf("unexpected plugins diff (-want, +got): %s", diff)
|
||||
}
|
||||
}))
|
||||
|
||||
_, err := New(
|
||||
client,
|
||||
informerFactory,
|
||||
informerFactory.Core().V1().Pods(),
|
||||
recorderFactory,
|
||||
make(chan struct{}),
|
||||
opts...,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error constructing: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveNominatedNodeName(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -74,13 +74,6 @@ type KubeSchedulerConfiguration struct {
|
||||
// nodes will be scored.
|
||||
PercentageOfNodesToScore *int32 `json:"percentageOfNodesToScore,omitempty"`
|
||||
|
||||
// Duration to wait for a binding operation to complete before timing out
|
||||
// Value must be non-negative integer. The value zero indicates no waiting.
|
||||
// If this value is nil, the default value will be used.
|
||||
// DEPRECATED: BindTimeoutSeconds is deprecated. To change volume bind
|
||||
// timeout, configure via plugin args for VolumeBinding.
|
||||
BindTimeoutSeconds *int64 `json:"bindTimeoutSeconds,omitempty"`
|
||||
|
||||
// PodInitialBackoffSeconds is the initial backoff for unschedulable pods.
|
||||
// If specified, it must be greater than 0. If this value is null, the default value (1s)
|
||||
// will be used.
|
||||
|
@ -83,11 +83,6 @@ func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfigurati
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.BindTimeoutSeconds != nil {
|
||||
in, out := &in.BindTimeoutSeconds, &out.BindTimeoutSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.PodInitialBackoffSeconds != nil {
|
||||
in, out := &in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds
|
||||
*out = new(int64)
|
||||
|
@ -274,8 +274,6 @@ priorities: []
|
||||
stopCh := make(chan struct{})
|
||||
eventBroadcaster.StartRecordingToSink(stopCh)
|
||||
|
||||
defaultBindTimeout := int64(30)
|
||||
|
||||
sched, err := scheduler.New(clientSet,
|
||||
informerFactory,
|
||||
scheduler.NewPodInformer(clientSet, 0),
|
||||
@ -289,7 +287,17 @@ priorities: []
|
||||
},
|
||||
},
|
||||
}),
|
||||
scheduler.WithBindTimeoutSeconds(defaultBindTimeout),
|
||||
scheduler.WithProfiles(kubeschedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
PluginConfig: []kubeschedulerconfig.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &kubeschedulerconfig.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 30,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't make scheduler config for test %d: %v", i, err)
|
||||
@ -320,8 +328,6 @@ func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) {
|
||||
stopCh := make(chan struct{})
|
||||
eventBroadcaster.StartRecordingToSink(stopCh)
|
||||
|
||||
defaultBindTimeout := int64(30)
|
||||
|
||||
_, err := scheduler.New(clientSet,
|
||||
informerFactory,
|
||||
scheduler.NewPodInformer(clientSet, 0),
|
||||
@ -335,7 +341,18 @@ func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
scheduler.WithBindTimeoutSeconds(defaultBindTimeout))
|
||||
scheduler.WithProfiles(kubeschedulerconfig.KubeSchedulerProfile{
|
||||
SchedulerName: v1.DefaultSchedulerName,
|
||||
PluginConfig: []kubeschedulerconfig.PluginConfig{
|
||||
{
|
||||
Name: "VolumeBinding",
|
||||
Args: &kubeschedulerconfig.VolumeBindingArgs{
|
||||
BindTimeoutSeconds: 30,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("Creation of scheduler didn't fail while the policy ConfigMap didn't exist.")
|
||||
|
@ -407,7 +407,6 @@ func InitTestSchedulerWithOptions(
|
||||
if policy != nil {
|
||||
opts = append(opts, scheduler.WithAlgorithmSource(CreateAlgorithmSourceFromPolicy(policy, testCtx.ClientSet)))
|
||||
}
|
||||
opts = append([]scheduler.Option{scheduler.WithBindTimeoutSeconds(600)}, opts...)
|
||||
testCtx.Scheduler, err = scheduler.New(
|
||||
testCtx.ClientSet,
|
||||
testCtx.InformerFactory,
|
||||
|
Loading…
Reference in New Issue
Block a user