...

Source file src/k8s.io/kubernetes/pkg/scheduler/apis/config/testing/defaults/defaults.go

Documentation: k8s.io/kubernetes/pkg/scheduler/apis/config/testing/defaults

     1  /*
     2  Copyright 2021 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package defaults
    18  
    19  import (
    20  	"k8s.io/kubernetes/pkg/scheduler/apis/config"
    21  	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
    22  )
    23  
    24  // PluginsV1 is the set of default v1 plugins (before MultiPoint expansion)
    25  var PluginsV1 = &config.Plugins{
    26  	MultiPoint: config.PluginSet{
    27  		Enabled: []config.Plugin{
    28  			{Name: names.SchedulingGates},
    29  			{Name: names.PrioritySort},
    30  			{Name: names.NodeUnschedulable},
    31  			{Name: names.NodeName},
    32  			{Name: names.TaintToleration, Weight: 3},
    33  			{Name: names.NodeAffinity, Weight: 2},
    34  			{Name: names.NodePorts},
    35  			{Name: names.NodeResourcesFit, Weight: 1},
    36  			{Name: names.VolumeRestrictions},
    37  			{Name: names.EBSLimits},
    38  			{Name: names.GCEPDLimits},
    39  			{Name: names.NodeVolumeLimits},
    40  			{Name: names.AzureDiskLimits},
    41  			{Name: names.VolumeBinding},
    42  			{Name: names.VolumeZone},
    43  			{Name: names.PodTopologySpread, Weight: 2},
    44  			{Name: names.InterPodAffinity, Weight: 2},
    45  			{Name: names.DefaultPreemption},
    46  			{Name: names.NodeResourcesBalancedAllocation, Weight: 1},
    47  			{Name: names.ImageLocality, Weight: 1},
    48  			{Name: names.DefaultBinder},
    49  		},
    50  	},
    51  }
    52  
    53  // ExpandedPluginsV1 default set of v1 plugins after MultiPoint expansion
    54  var ExpandedPluginsV1 = &config.Plugins{
    55  	PreEnqueue: config.PluginSet{
    56  		Enabled: []config.Plugin{
    57  			{Name: names.SchedulingGates},
    58  		},
    59  	},
    60  	QueueSort: config.PluginSet{
    61  		Enabled: []config.Plugin{
    62  			{Name: names.PrioritySort},
    63  		},
    64  	},
    65  	PreFilter: config.PluginSet{
    66  		Enabled: []config.Plugin{
    67  			{Name: names.NodeAffinity},
    68  			{Name: names.NodePorts},
    69  			{Name: names.NodeResourcesFit},
    70  			{Name: names.VolumeRestrictions},
    71  			{Name: names.EBSLimits},
    72  			{Name: names.GCEPDLimits},
    73  			{Name: names.NodeVolumeLimits},
    74  			{Name: names.AzureDiskLimits},
    75  			{Name: names.VolumeBinding},
    76  			{Name: names.VolumeZone},
    77  			{Name: names.PodTopologySpread},
    78  			{Name: names.InterPodAffinity},
    79  		},
    80  	},
    81  	Filter: config.PluginSet{
    82  		Enabled: []config.Plugin{
    83  			{Name: names.NodeUnschedulable},
    84  			{Name: names.NodeName},
    85  			{Name: names.TaintToleration},
    86  			{Name: names.NodeAffinity},
    87  			{Name: names.NodePorts},
    88  			{Name: names.NodeResourcesFit},
    89  			{Name: names.VolumeRestrictions},
    90  			{Name: names.EBSLimits},
    91  			{Name: names.GCEPDLimits},
    92  			{Name: names.NodeVolumeLimits},
    93  			{Name: names.AzureDiskLimits},
    94  			{Name: names.VolumeBinding},
    95  			{Name: names.VolumeZone},
    96  			{Name: names.PodTopologySpread},
    97  			{Name: names.InterPodAffinity},
    98  		},
    99  	},
   100  	PostFilter: config.PluginSet{
   101  		Enabled: []config.Plugin{
   102  			{Name: names.DefaultPreemption},
   103  		},
   104  	},
   105  	PreScore: config.PluginSet{
   106  		Enabled: []config.Plugin{
   107  			{Name: names.TaintToleration},
   108  			{Name: names.NodeAffinity},
   109  			{Name: names.NodeResourcesFit},
   110  			{Name: names.VolumeBinding},
   111  			{Name: names.PodTopologySpread},
   112  			{Name: names.InterPodAffinity},
   113  			{Name: names.NodeResourcesBalancedAllocation},
   114  		},
   115  	},
   116  	Score: config.PluginSet{
   117  		Enabled: []config.Plugin{
   118  			// Weight is tripled because:
   119  			// - This is a score coming from user preference.
   120  			// - Usage of node tainting to group nodes in the cluster is increasing becoming a use-case
   121  			// for many user workloads
   122  			{Name: names.TaintToleration, Weight: 3},
   123  			// Weight is doubled because:
   124  			// - This is a score coming from user preference.
   125  			{Name: names.NodeAffinity, Weight: 2},
   126  			{Name: names.NodeResourcesFit, Weight: 1},
   127  			// Weight is tripled because:
   128  			// - This is a score coming from user preference.
   129  			// - Usage of node tainting to group nodes in the cluster is increasing becoming a use-case
   130  			//	 for many user workloads
   131  			{Name: names.VolumeBinding, Weight: 1},
   132  			// Weight is doubled because:
   133  			// - This is a score coming from user preference.
   134  			// - It makes its signal comparable to NodeResourcesLeastAllocated.
   135  			{Name: names.PodTopologySpread, Weight: 2},
   136  			// Weight is doubled because:
   137  			// - This is a score coming from user preference.
   138  			{Name: names.InterPodAffinity, Weight: 2},
   139  			{Name: names.NodeResourcesBalancedAllocation, Weight: 1},
   140  			{Name: names.ImageLocality, Weight: 1},
   141  		},
   142  	},
   143  	Reserve: config.PluginSet{
   144  		Enabled: []config.Plugin{
   145  			{Name: names.VolumeBinding},
   146  		},
   147  	},
   148  	PreBind: config.PluginSet{
   149  		Enabled: []config.Plugin{
   150  			{Name: names.VolumeBinding},
   151  		},
   152  	},
   153  	Bind: config.PluginSet{
   154  		Enabled: []config.Plugin{
   155  			{Name: names.DefaultBinder},
   156  		},
   157  	},
   158  }
   159  
   160  // PluginConfigsV1 default plugin configurations.
   161  var PluginConfigsV1 = []config.PluginConfig{
   162  	{
   163  		Name: "DefaultPreemption",
   164  		Args: &config.DefaultPreemptionArgs{
   165  			MinCandidateNodesPercentage: 10,
   166  			MinCandidateNodesAbsolute:   100,
   167  		},
   168  	},
   169  	{
   170  		Name: "InterPodAffinity",
   171  		Args: &config.InterPodAffinityArgs{
   172  			HardPodAffinityWeight: 1,
   173  		},
   174  	},
   175  	{
   176  		Name: "NodeAffinity",
   177  		Args: &config.NodeAffinityArgs{},
   178  	},
   179  	{
   180  		Name: "NodeResourcesBalancedAllocation",
   181  		Args: &config.NodeResourcesBalancedAllocationArgs{
   182  			Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
   183  		},
   184  	},
   185  	{
   186  		Name: "NodeResourcesFit",
   187  		Args: &config.NodeResourcesFitArgs{
   188  			ScoringStrategy: &config.ScoringStrategy{
   189  				Type:      config.LeastAllocated,
   190  				Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
   191  			},
   192  		},
   193  	},
   194  	{
   195  		Name: "PodTopologySpread",
   196  		Args: &config.PodTopologySpreadArgs{
   197  			DefaultingType: config.SystemDefaulting,
   198  		},
   199  	},
   200  	{
   201  		Name: "VolumeBinding",
   202  		Args: &config.VolumeBindingArgs{
   203  			BindTimeoutSeconds: 600,
   204  		},
   205  	},
   206  }
   207  

View as plain text