k8s.io/kubernetes@v1.29.3/pkg/scheduler/apis/config/testing/defaults/defaults.go (about) 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.PrioritySort}, 29 {Name: names.NodeUnschedulable}, 30 {Name: names.NodeName}, 31 {Name: names.TaintToleration, Weight: 3}, 32 {Name: names.NodeAffinity, Weight: 2}, 33 {Name: names.NodePorts}, 34 {Name: names.NodeResourcesFit, Weight: 1}, 35 {Name: names.VolumeRestrictions}, 36 {Name: names.EBSLimits}, 37 {Name: names.GCEPDLimits}, 38 {Name: names.NodeVolumeLimits}, 39 {Name: names.AzureDiskLimits}, 40 {Name: names.VolumeBinding}, 41 {Name: names.VolumeZone}, 42 {Name: names.PodTopologySpread, Weight: 2}, 43 {Name: names.InterPodAffinity, Weight: 2}, 44 {Name: names.DefaultPreemption}, 45 {Name: names.NodeResourcesBalancedAllocation, Weight: 1}, 46 {Name: names.ImageLocality, Weight: 1}, 47 {Name: names.DefaultBinder}, 48 {Name: names.SchedulingGates}, 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.PodTopologySpread}, 111 {Name: names.InterPodAffinity}, 112 {Name: names.NodeResourcesBalancedAllocation}, 113 }, 114 }, 115 Score: config.PluginSet{ 116 Enabled: []config.Plugin{ 117 // Weight is tripled because: 118 // - This is a score coming from user preference. 119 // - Usage of node tainting to group nodes in the cluster is increasing becoming a use-case 120 // for many user workloads 121 {Name: names.TaintToleration, Weight: 3}, 122 // Weight is doubled because: 123 // - This is a score coming from user preference. 124 {Name: names.NodeAffinity, Weight: 2}, 125 {Name: names.NodeResourcesFit, Weight: 1}, 126 // Weight is tripled because: 127 // - This is a score coming from user preference. 128 // - Usage of node tainting to group nodes in the cluster is increasing becoming a use-case 129 // for many user workloads 130 {Name: names.VolumeBinding, Weight: 1}, 131 // Weight is doubled because: 132 // - This is a score coming from user preference. 133 // - It makes its signal comparable to NodeResourcesLeastAllocated. 134 {Name: names.PodTopologySpread, Weight: 2}, 135 // Weight is doubled because: 136 // - This is a score coming from user preference. 137 {Name: names.InterPodAffinity, Weight: 2}, 138 {Name: names.NodeResourcesBalancedAllocation, Weight: 1}, 139 {Name: names.ImageLocality, Weight: 1}, 140 }, 141 }, 142 Reserve: config.PluginSet{ 143 Enabled: []config.Plugin{ 144 {Name: names.VolumeBinding}, 145 }, 146 }, 147 PreBind: config.PluginSet{ 148 Enabled: []config.Plugin{ 149 {Name: names.VolumeBinding}, 150 }, 151 }, 152 Bind: config.PluginSet{ 153 Enabled: []config.Plugin{ 154 {Name: names.DefaultBinder}, 155 }, 156 }, 157 } 158 159 // PluginConfigsV1 default plugin configurations. 160 var PluginConfigsV1 = []config.PluginConfig{ 161 { 162 Name: "DefaultPreemption", 163 Args: &config.DefaultPreemptionArgs{ 164 MinCandidateNodesPercentage: 10, 165 MinCandidateNodesAbsolute: 100, 166 }, 167 }, 168 { 169 Name: "InterPodAffinity", 170 Args: &config.InterPodAffinityArgs{ 171 HardPodAffinityWeight: 1, 172 }, 173 }, 174 { 175 Name: "NodeAffinity", 176 Args: &config.NodeAffinityArgs{}, 177 }, 178 { 179 Name: "NodeResourcesBalancedAllocation", 180 Args: &config.NodeResourcesBalancedAllocationArgs{ 181 Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, 182 }, 183 }, 184 { 185 Name: "NodeResourcesFit", 186 Args: &config.NodeResourcesFitArgs{ 187 ScoringStrategy: &config.ScoringStrategy{ 188 Type: config.LeastAllocated, 189 Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, 190 }, 191 }, 192 }, 193 { 194 Name: "PodTopologySpread", 195 Args: &config.PodTopologySpreadArgs{ 196 DefaultingType: config.SystemDefaulting, 197 }, 198 }, 199 { 200 Name: "VolumeBinding", 201 Args: &config.VolumeBindingArgs{ 202 BindTimeoutSeconds: 600, 203 }, 204 }, 205 }