mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-01 22:03:54 +00:00
Merge pull request #102745 from ahg-g/ahg-provider
Remove SchedulerAlgorithmSource from scheduler's internal CC API
This commit is contained in:
@@ -1365,14 +1365,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
Data: map[string]string{config.SchedulerPolicyConfigMapKey: tc.JSON},
|
||||
}
|
||||
client := fake.NewSimpleClientset(&policyConfigMap)
|
||||
algorithmSrc := config.SchedulerAlgorithmSource{
|
||||
Policy: &config.SchedulerPolicySource{
|
||||
ConfigMap: &config.SchedulerPolicyConfigMapSource{
|
||||
Namespace: policyConfigMap.Namespace,
|
||||
Name: policyConfigMap.Name,
|
||||
},
|
||||
},
|
||||
}
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||
recorderFactory := profile.NewRecorderFactory(events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1()}))
|
||||
|
||||
@@ -1381,7 +1373,12 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
informerFactory,
|
||||
recorderFactory,
|
||||
make(chan struct{}),
|
||||
scheduler.WithAlgorithmSource(algorithmSrc),
|
||||
scheduler.WithLegacyPolicySource(&config.SchedulerPolicySource{
|
||||
ConfigMap: &config.SchedulerPolicyConfigMapSource{
|
||||
Namespace: policyConfigMap.Namespace,
|
||||
Name: policyConfigMap.Name,
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
@@ -1412,110 +1409,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAlgorithmProviderCompatibility(t *testing.T) {
|
||||
// Add serialized versions of scheduler config that exercise available options to ensure compatibility between releases
|
||||
defaultPlugins := map[string][]config.Plugin{
|
||||
"QueueSortPlugin": {
|
||||
{Name: "PrioritySort"},
|
||||
},
|
||||
"PreFilterPlugin": {
|
||||
{Name: "NodeResourcesFit"},
|
||||
{Name: "NodePorts"},
|
||||
{Name: "PodTopologySpread"},
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "VolumeBinding"},
|
||||
{Name: "NodeAffinity"},
|
||||
},
|
||||
"FilterPlugin": {
|
||||
{Name: "NodeUnschedulable"},
|
||||
{Name: "NodeName"},
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "NodeAffinity"},
|
||||
{Name: "NodePorts"},
|
||||
{Name: "NodeResourcesFit"},
|
||||
{Name: "VolumeRestrictions"},
|
||||
{Name: "EBSLimits"},
|
||||
{Name: "GCEPDLimits"},
|
||||
{Name: "NodeVolumeLimits"},
|
||||
{Name: "AzureDiskLimits"},
|
||||
{Name: "VolumeBinding"},
|
||||
{Name: "VolumeZone"},
|
||||
{Name: "PodTopologySpread"},
|
||||
{Name: "InterPodAffinity"},
|
||||
},
|
||||
"PostFilterPlugin": {
|
||||
{Name: "DefaultPreemption"},
|
||||
},
|
||||
"PreScorePlugin": {
|
||||
{Name: "InterPodAffinity"},
|
||||
{Name: "PodTopologySpread"},
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "NodeAffinity"},
|
||||
},
|
||||
"ScorePlugin": {
|
||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||
{Name: "ImageLocality", Weight: 1},
|
||||
{Name: "InterPodAffinity", Weight: 1},
|
||||
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
||||
{Name: "NodeAffinity", Weight: 1},
|
||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||
{Name: "PodTopologySpread", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 1},
|
||||
},
|
||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||
"PreBindPlugin": {{Name: "VolumeBinding"}},
|
||||
}
|
||||
|
||||
testcases := []struct {
|
||||
name string
|
||||
provider string
|
||||
wantPlugins map[string][]config.Plugin
|
||||
}{
|
||||
{
|
||||
name: "No Provider specified",
|
||||
wantPlugins: defaultPlugins,
|
||||
},
|
||||
{
|
||||
name: "DefaultProvider",
|
||||
provider: config.SchedulerDefaultProviderName,
|
||||
wantPlugins: defaultPlugins,
|
||||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
var opts []scheduler.Option
|
||||
if len(tc.provider) != 0 {
|
||||
opts = append(opts, scheduler.WithAlgorithmSource(config.SchedulerAlgorithmSource{
|
||||
Provider: &tc.provider,
|
||||
}))
|
||||
}
|
||||
|
||||
client := fake.NewSimpleClientset()
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||
recorderFactory := profile.NewRecorderFactory(events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1()}))
|
||||
|
||||
sched, err := scheduler.New(
|
||||
client,
|
||||
informerFactory,
|
||||
recorderFactory,
|
||||
make(chan struct{}),
|
||||
opts...,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error constructing: %v", err)
|
||||
}
|
||||
|
||||
defProf := sched.Profiles["default-scheduler"]
|
||||
gotPlugins := defProf.ListPlugins()
|
||||
if diff := cmp.Diff(tc.wantPlugins, gotPlugins); diff != "" {
|
||||
t.Errorf("unexpected plugins diff (-want, +got): %s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPluginsConfigurationCompatibility(t *testing.T) {
|
||||
defaultPlugins := map[string][]config.Plugin{
|
||||
"QueueSortPlugin": {
|
||||
|
||||
Reference in New Issue
Block a user