k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/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.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.NodeVolumeLimits}, 38 {Name: names.VolumeBinding}, 39 {Name: names.VolumeZone}, 40 {Name: names.PodTopologySpread, Weight: 2}, 41 {Name: names.InterPodAffinity, Weight: 2}, 42 {Name: names.DefaultPreemption}, 43 {Name: names.NodeResourcesBalancedAllocation, Weight: 1}, 44 {Name: names.ImageLocality, Weight: 1}, 45 {Name: names.DefaultBinder}, 46 }, 47 }, 48 } 49 50 // ExpandedPluginsV1 default set of v1 plugins after MultiPoint expansion 51 var ExpandedPluginsV1 = &config.Plugins{ 52 PreEnqueue: config.PluginSet{ 53 Enabled: []config.Plugin{ 54 {Name: names.SchedulingGates}, 55 }, 56 }, 57 QueueSort: config.PluginSet{ 58 Enabled: []config.Plugin{ 59 {Name: names.PrioritySort}, 60 }, 61 }, 62 PreFilter: config.PluginSet{ 63 Enabled: []config.Plugin{ 64 {Name: names.NodeAffinity}, 65 {Name: names.NodePorts}, 66 {Name: names.NodeResourcesFit}, 67 {Name: names.VolumeRestrictions}, 68 {Name: names.NodeVolumeLimits}, 69 {Name: names.VolumeBinding}, 70 {Name: names.VolumeZone}, 71 {Name: names.PodTopologySpread}, 72 {Name: names.InterPodAffinity}, 73 }, 74 }, 75 Filter: config.PluginSet{ 76 Enabled: []config.Plugin{ 77 {Name: names.NodeUnschedulable}, 78 {Name: names.NodeName}, 79 {Name: names.TaintToleration}, 80 {Name: names.NodeAffinity}, 81 {Name: names.NodePorts}, 82 {Name: names.NodeResourcesFit}, 83 {Name: names.VolumeRestrictions}, 84 {Name: names.NodeVolumeLimits}, 85 {Name: names.VolumeBinding}, 86 {Name: names.VolumeZone}, 87 {Name: names.PodTopologySpread}, 88 {Name: names.InterPodAffinity}, 89 }, 90 }, 91 PostFilter: config.PluginSet{ 92 Enabled: []config.Plugin{ 93 {Name: names.DefaultPreemption}, 94 }, 95 }, 96 PreScore: config.PluginSet{ 97 Enabled: []config.Plugin{ 98 {Name: names.TaintToleration}, 99 {Name: names.NodeAffinity}, 100 {Name: names.NodeResourcesFit}, 101 {Name: names.VolumeBinding}, 102 {Name: names.PodTopologySpread}, 103 {Name: names.InterPodAffinity}, 104 {Name: names.NodeResourcesBalancedAllocation}, 105 }, 106 }, 107 Score: config.PluginSet{ 108 Enabled: []config.Plugin{ 109 // Weight is tripled because: 110 // - This is a score coming from user preference. 111 // - Usage of node tainting to group nodes in the cluster is increasing becoming a use-case 112 // for many user workloads 113 {Name: names.TaintToleration, Weight: 3}, 114 // Weight is doubled because: 115 // - This is a score coming from user preference. 116 {Name: names.NodeAffinity, Weight: 2}, 117 {Name: names.NodeResourcesFit, Weight: 1}, 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.VolumeBinding, Weight: 1}, 123 // Weight is doubled because: 124 // - This is a score coming from user preference. 125 // - It makes its signal comparable to NodeResourcesLeastAllocated. 126 {Name: names.PodTopologySpread, Weight: 2}, 127 // Weight is doubled because: 128 // - This is a score coming from user preference. 129 {Name: names.InterPodAffinity, Weight: 2}, 130 {Name: names.NodeResourcesBalancedAllocation, Weight: 1}, 131 {Name: names.ImageLocality, Weight: 1}, 132 }, 133 }, 134 Reserve: config.PluginSet{ 135 Enabled: []config.Plugin{ 136 {Name: names.VolumeBinding}, 137 }, 138 }, 139 PreBind: config.PluginSet{ 140 Enabled: []config.Plugin{ 141 {Name: names.VolumeBinding}, 142 }, 143 }, 144 Bind: config.PluginSet{ 145 Enabled: []config.Plugin{ 146 {Name: names.DefaultBinder}, 147 }, 148 }, 149 } 150 151 // PluginConfigsV1 default plugin configurations. 152 var PluginConfigsV1 = []config.PluginConfig{ 153 { 154 Name: "DefaultPreemption", 155 Args: &config.DefaultPreemptionArgs{ 156 MinCandidateNodesPercentage: 10, 157 MinCandidateNodesAbsolute: 100, 158 }, 159 }, 160 { 161 Name: "InterPodAffinity", 162 Args: &config.InterPodAffinityArgs{ 163 HardPodAffinityWeight: 1, 164 }, 165 }, 166 { 167 Name: "NodeAffinity", 168 Args: &config.NodeAffinityArgs{}, 169 }, 170 { 171 Name: "NodeResourcesBalancedAllocation", 172 Args: &config.NodeResourcesBalancedAllocationArgs{ 173 Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, 174 }, 175 }, 176 { 177 Name: "NodeResourcesFit", 178 Args: &config.NodeResourcesFitArgs{ 179 ScoringStrategy: &config.ScoringStrategy{ 180 Type: config.LeastAllocated, 181 Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, 182 }, 183 }, 184 }, 185 { 186 Name: "PodTopologySpread", 187 Args: &config.PodTopologySpreadArgs{ 188 DefaultingType: config.SystemDefaulting, 189 }, 190 }, 191 { 192 Name: "VolumeBinding", 193 Args: &config.VolumeBindingArgs{ 194 BindTimeoutSeconds: 600, 195 }, 196 }, 197 }