@@ -231,6 +231,78 @@ profiles:
231231 },
232232 },
233233 },
234+ {
235+ name : "v1 NodeMetadata plugin args" ,
236+ data : []byte (`
237+ apiVersion: kubescheduler.config.k8s.io/v1
238+ kind: KubeSchedulerConfiguration
239+ profiles:
240+ - schedulerName: scheduler-plugins
241+ pluginConfig:
242+ - name: NodeMetadata
243+ args:
244+ metadataKey: "priority"
245+ metadataSource: "Label"
246+ metadataType: "Number"
247+ scoringStrategy: "Highest"
248+ ` ),
249+ wantProfiles : []schedconfig.KubeSchedulerProfile {
250+ {
251+ SchedulerName : "scheduler-plugins" ,
252+ Plugins : defaults .PluginsV1 ,
253+ PluginConfig : []schedconfig.PluginConfig {
254+ {
255+ Name : "NodeMetadata" ,
256+ Args : & config.NodeMetadataArgs {
257+ MetadataKey : "priority" ,
258+ MetadataSource : config .MetadataSourceLabel ,
259+ MetadataType : config .MetadataTypeNumber ,
260+ ScoringStrategy : config .ScoringStrategyHighest ,
261+ },
262+ },
263+ {
264+ Name : "DefaultPreemption" ,
265+ Args : & schedconfig.DefaultPreemptionArgs {MinCandidateNodesPercentage : 10 , MinCandidateNodesAbsolute : 100 },
266+ },
267+ {
268+ Name : "DynamicResources" ,
269+ Args : & schedconfig.DynamicResourcesArgs {
270+ FilterTimeout : ptr .To (metav1.Duration {Duration : 10 * time .Second }),
271+ },
272+ },
273+ {
274+ Name : "InterPodAffinity" ,
275+ Args : & schedconfig.InterPodAffinityArgs {HardPodAffinityWeight : 1 },
276+ },
277+ {
278+ Name : "NodeAffinity" ,
279+ Args : & schedconfig.NodeAffinityArgs {},
280+ },
281+ {
282+ Name : "NodeResourcesBalancedAllocation" ,
283+ Args : & schedconfig.NodeResourcesBalancedAllocationArgs {Resources : []schedconfig.ResourceSpec {{Name : "cpu" , Weight : 1 }, {Name : "memory" , Weight : 1 }}},
284+ },
285+ {
286+ Name : "NodeResourcesFit" ,
287+ Args : & schedconfig.NodeResourcesFitArgs {
288+ ScoringStrategy : & schedconfig.ScoringStrategy {
289+ Type : schedconfig .LeastAllocated ,
290+ Resources : []schedconfig.ResourceSpec {{Name : "cpu" , Weight : 1 }, {Name : "memory" , Weight : 1 }},
291+ },
292+ },
293+ },
294+ {
295+ Name : "PodTopologySpread" ,
296+ Args : & schedconfig.PodTopologySpreadArgs {DefaultingType : schedconfig .SystemDefaulting },
297+ },
298+ {
299+ Name : "VolumeBinding" ,
300+ Args : & schedconfig.VolumeBindingArgs {BindTimeoutSeconds : 600 },
301+ },
302+ },
303+ },
304+ },
305+ },
234306 }
235307 decoder := Codecs .UniversalDecoder ()
236308 for _ , tt := range testCases {
@@ -348,6 +420,15 @@ func TestCodecsEncodePluginConfig(t *testing.T) {
348420 NetworkTopologyName : "net-topology-v1" ,
349421 },
350422 },
423+ {
424+ Name : "NodeMetadata" ,
425+ Args : & config.NodeMetadataArgs {
426+ MetadataKey : "priority" ,
427+ MetadataSource : config .MetadataSourceLabel ,
428+ MetadataType : config .MetadataTypeNumber ,
429+ ScoringStrategy : config .ScoringStrategyHighest ,
430+ },
431+ },
351432 },
352433 },
353434 },
@@ -445,6 +526,15 @@ profiles:
445526 networkTopologyName: net-topology-v1
446527 weightsName: netCosts
447528 name: NetworkOverhead
529+ - args:
530+ apiVersion: kubescheduler.config.k8s.io/v1
531+ kind: NodeMetadataArgs
532+ metadataKey: priority
533+ metadataSource: Label
534+ metadataType: Number
535+ scoringStrategy: Highest
536+ timestampFormat: ""
537+ name: NodeMetadata
448538 schedulerName: scheduler-plugins
449539` ,
450540 },
0 commit comments