@@ -220,8 +220,8 @@ users:
220
220
}
221
221
222
222
// plugin config
223
- pluginconfigFile := filepath .Join (tmpDir , "plugin.yaml" )
224
- if err := ioutil .WriteFile (pluginconfigFile , []byte (fmt .Sprintf (`
223
+ pluginConfigFile := filepath .Join (tmpDir , "plugin.yaml" )
224
+ if err := ioutil .WriteFile (pluginConfigFile , []byte (fmt .Sprintf (`
225
225
apiVersion: kubescheduler.config.k8s.io/v1alpha2
226
226
kind: KubeSchedulerConfiguration
227
227
clientConnection:
@@ -244,6 +244,31 @@ profiles:
244
244
` , configKubeconfig )), os .FileMode (0600 )); err != nil {
245
245
t .Fatal (err )
246
246
}
247
+
248
+ // multiple profiles config
249
+ multiProfilesConfig := filepath .Join (tmpDir , "multi-profiles.yaml" )
250
+ if err := ioutil .WriteFile (multiProfilesConfig , []byte (fmt .Sprintf (`
251
+ apiVersion: kubescheduler.config.k8s.io/v1alpha2
252
+ kind: KubeSchedulerConfiguration
253
+ clientConnection:
254
+ kubeconfig: "%s"
255
+ profiles:
256
+ - schedulerName: "foo-profile"
257
+ plugins:
258
+ reserve:
259
+ enabled:
260
+ - name: foo
261
+ - schedulerName: "bar-profile"
262
+ plugins:
263
+ preBind:
264
+ disabled:
265
+ - name: baz
266
+ pluginConfig:
267
+ - name: foo
268
+ ` , configKubeconfig )), os .FileMode (0600 )); err != nil {
269
+ t .Fatal (err )
270
+ }
271
+
247
272
// v1alpha1 postfilter plugin config
248
273
postfilterPluginConfigFile := filepath .Join (tmpDir , "v1alpha1_postfilter_plugin.yaml" )
249
274
if err := ioutil .WriteFile (postfilterPluginConfigFile , []byte (fmt .Sprintf (`
@@ -516,7 +541,7 @@ plugins:
516
541
{
517
542
name : "plugin config" ,
518
543
options : & Options {
519
- ConfigFile : pluginconfigFile ,
544
+ ConfigFile : pluginConfigFile ,
520
545
},
521
546
expectedUsername : "config" ,
522
547
expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
@@ -554,29 +579,84 @@ plugins:
554
579
Plugins : & kubeschedulerconfig.Plugins {
555
580
Reserve : & kubeschedulerconfig.PluginSet {
556
581
Enabled : []kubeschedulerconfig.Plugin {
557
- {
558
- Name : "foo" ,
559
- },
560
- {
561
- Name : "bar" ,
562
- },
582
+ {Name : "foo" },
583
+ {Name : "bar" },
563
584
},
564
585
Disabled : []kubeschedulerconfig.Plugin {
565
- {
566
- Name : "baz" ,
567
- },
586
+ {Name : "baz" },
568
587
},
569
588
},
570
589
PreBind : & kubeschedulerconfig.PluginSet {
571
590
Enabled : []kubeschedulerconfig.Plugin {
572
- {
573
- Name : "foo" ,
574
- },
591
+ {Name : "foo" },
575
592
},
576
593
Disabled : []kubeschedulerconfig.Plugin {
577
- {
578
- Name : "baz" ,
579
- },
594
+ {Name : "baz" },
595
+ },
596
+ },
597
+ },
598
+ PluginConfig : []kubeschedulerconfig.PluginConfig {
599
+ {
600
+ Name : "foo" ,
601
+ Args : runtime.Unknown {},
602
+ },
603
+ },
604
+ },
605
+ },
606
+ },
607
+ },
608
+ {
609
+ name : "multiple profiles" ,
610
+ options : & Options {
611
+ ConfigFile : multiProfilesConfig ,
612
+ },
613
+ expectedUsername : "config" ,
614
+ expectedConfig : kubeschedulerconfig.KubeSchedulerConfiguration {
615
+ AlgorithmSource : kubeschedulerconfig.SchedulerAlgorithmSource {Provider : & defaultSource },
616
+ HealthzBindAddress : "0.0.0.0:10251" ,
617
+ MetricsBindAddress : "0.0.0.0:10251" ,
618
+ DebuggingConfiguration : componentbaseconfig.DebuggingConfiguration {
619
+ EnableProfiling : true ,
620
+ EnableContentionProfiling : true ,
621
+ },
622
+ LeaderElection : kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration {
623
+ LeaderElectionConfiguration : componentbaseconfig.LeaderElectionConfiguration {
624
+ LeaderElect : true ,
625
+ LeaseDuration : metav1.Duration {Duration : 15 * time .Second },
626
+ RenewDeadline : metav1.Duration {Duration : 10 * time .Second },
627
+ RetryPeriod : metav1.Duration {Duration : 2 * time .Second },
628
+ ResourceLock : "endpointsleases" ,
629
+ ResourceNamespace : "kube-system" ,
630
+ ResourceName : "kube-scheduler" ,
631
+ },
632
+ },
633
+ ClientConnection : componentbaseconfig.ClientConnectionConfiguration {
634
+ Kubeconfig : configKubeconfig ,
635
+ QPS : 50 ,
636
+ Burst : 100 ,
637
+ ContentType : "application/vnd.kubernetes.protobuf" ,
638
+ },
639
+ PercentageOfNodesToScore : defaultPercentageOfNodesToScore ,
640
+ BindTimeoutSeconds : defaultBindTimeoutSeconds ,
641
+ PodInitialBackoffSeconds : defaultPodInitialBackoffSeconds ,
642
+ PodMaxBackoffSeconds : defaultPodMaxBackoffSeconds ,
643
+ Profiles : []kubeschedulerconfig.KubeSchedulerProfile {
644
+ {
645
+ SchedulerName : "foo-profile" ,
646
+ Plugins : & kubeschedulerconfig.Plugins {
647
+ Reserve : & kubeschedulerconfig.PluginSet {
648
+ Enabled : []kubeschedulerconfig.Plugin {
649
+ {Name : "foo" },
650
+ },
651
+ },
652
+ },
653
+ },
654
+ {
655
+ SchedulerName : "bar-profile" ,
656
+ Plugins : & kubeschedulerconfig.Plugins {
657
+ PreBind : & kubeschedulerconfig.PluginSet {
658
+ Disabled : []kubeschedulerconfig.Plugin {
659
+ {Name : "baz" },
580
660
},
581
661
},
582
662
},
0 commit comments