mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Remove BindTimeoutSeconds from KubeSchedulerConfiguration
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user