mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #95631 from alculquicondor/enable-default-spreading
Graduate DefaultPodTopologySpread to beta
This commit is contained in:
commit
3fe372c3da
@ -186,7 +186,6 @@ profiles:
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||||
@ -197,7 +196,6 @@ profiles:
|
|||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "PodTopologySpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
@ -316,7 +314,6 @@ profiles:
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||||
@ -327,7 +324,6 @@ profiles:
|
|||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "PodTopologySpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
|
@ -296,7 +296,7 @@ const (
|
|||||||
CSIStorageCapacity featuregate.Feature = "CSIStorageCapacity"
|
CSIStorageCapacity featuregate.Feature = "CSIStorageCapacity"
|
||||||
|
|
||||||
// owner: @alculquicondor
|
// owner: @alculquicondor
|
||||||
// alpha: v1.19
|
// beta: v1.20
|
||||||
//
|
//
|
||||||
// Enables the use of PodTopologySpread scheduling plugin to do default
|
// Enables the use of PodTopologySpread scheduling plugin to do default
|
||||||
// spreading and disables legacy SelectorSpread plugin.
|
// spreading and disables legacy SelectorSpread plugin.
|
||||||
@ -733,7 +733,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
HugePageStorageMediumSize: {Default: true, PreRelease: featuregate.Beta},
|
HugePageStorageMediumSize: {Default: true, PreRelease: featuregate.Beta},
|
||||||
ExternalPolicyForExternalIP: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.22
|
ExternalPolicyForExternalIP: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.22
|
||||||
AnyVolumeDataSource: {Default: false, PreRelease: featuregate.Alpha},
|
AnyVolumeDataSource: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
DefaultPodTopologySpread: {Default: false, PreRelease: featuregate.Alpha},
|
DefaultPodTopologySpread: {Default: true, PreRelease: featuregate.Beta},
|
||||||
SetHostnameAsFQDN: {Default: true, PreRelease: featuregate.Beta},
|
SetHostnameAsFQDN: {Default: true, PreRelease: featuregate.Beta},
|
||||||
WinOverlay: {Default: true, PreRelease: featuregate.Beta},
|
WinOverlay: {Default: true, PreRelease: featuregate.Beta},
|
||||||
WinDSR: {Default: false, PreRelease: featuregate.Alpha},
|
WinDSR: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
@ -69,6 +69,7 @@ go_test(
|
|||||||
"//pkg/scheduler/framework/plugins/nodelabel:go_default_library",
|
"//pkg/scheduler/framework/plugins/nodelabel:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/nodeports:go_default_library",
|
"//pkg/scheduler/framework/plugins/nodeports:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
||||||
|
"//pkg/scheduler/framework/plugins/podtopologyspread:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
|
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/serviceaffinity:go_default_library",
|
"//pkg/scheduler/framework/plugins/serviceaffinity:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/volumebinding:go_default_library",
|
"//pkg/scheduler/framework/plugins/volumebinding:go_default_library",
|
||||||
|
@ -20,14 +20,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
|
"k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/component-base/featuregate"
|
"k8s.io/component-base/featuregate"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
|
|
||||||
|
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/imagelocality"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/imagelocality"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
||||||
@ -91,7 +90,6 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
|||||||
{Name: interpodaffinity.Name},
|
{Name: interpodaffinity.Name},
|
||||||
{Name: podtopologyspread.Name},
|
{Name: podtopologyspread.Name},
|
||||||
{Name: tainttoleration.Name},
|
{Name: tainttoleration.Name},
|
||||||
{Name: selectorspread.Name},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Score: &schedulerapi.PluginSet{
|
Score: &schedulerapi.PluginSet{
|
||||||
@ -104,7 +102,6 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
|||||||
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
||||||
{Name: podtopologyspread.Name, Weight: 2},
|
{Name: podtopologyspread.Name, Weight: 2},
|
||||||
{Name: tainttoleration.Name, Weight: 1},
|
{Name: tainttoleration.Name, Weight: 1},
|
||||||
{Name: selectorspread.Name, Weight: 1},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Reserve: &schedulerapi.PluginSet{
|
Reserve: &schedulerapi.PluginSet{
|
||||||
@ -134,7 +131,7 @@ func TestClusterAutoscalerProvider(t *testing.T) {
|
|||||||
func TestApplyFeatureGates(t *testing.T) {
|
func TestApplyFeatureGates(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
feature featuregate.Feature
|
features map[featuregate.Feature]bool
|
||||||
wantConfig *schedulerapi.Plugins
|
wantConfig *schedulerapi.Plugins
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
@ -183,7 +180,6 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
{Name: interpodaffinity.Name},
|
{Name: interpodaffinity.Name},
|
||||||
{Name: podtopologyspread.Name},
|
{Name: podtopologyspread.Name},
|
||||||
{Name: tainttoleration.Name},
|
{Name: tainttoleration.Name},
|
||||||
{Name: selectorspread.Name},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Score: &schedulerapi.PluginSet{
|
Score: &schedulerapi.PluginSet{
|
||||||
@ -196,7 +192,6 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
||||||
{Name: podtopologyspread.Name, Weight: 2},
|
{Name: podtopologyspread.Name, Weight: 2},
|
||||||
{Name: tainttoleration.Name, Weight: 1},
|
{Name: tainttoleration.Name, Weight: 1},
|
||||||
{Name: selectorspread.Name, Weight: 1},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Reserve: &schedulerapi.PluginSet{
|
Reserve: &schedulerapi.PluginSet{
|
||||||
@ -217,8 +212,10 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "NewDefaultPodTopologySpread enabled",
|
name: "DefaultPodTopologySpread disabled",
|
||||||
feature: features.DefaultPodTopologySpread,
|
features: map[featuregate.Feature]bool{
|
||||||
|
features.DefaultPodTopologySpread: false,
|
||||||
|
},
|
||||||
wantConfig: &schedulerapi.Plugins{
|
wantConfig: &schedulerapi.Plugins{
|
||||||
QueueSort: &schedulerapi.PluginSet{
|
QueueSort: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{
|
Enabled: []schedulerapi.Plugin{
|
||||||
@ -263,6 +260,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
{Name: interpodaffinity.Name},
|
{Name: interpodaffinity.Name},
|
||||||
{Name: podtopologyspread.Name},
|
{Name: podtopologyspread.Name},
|
||||||
{Name: tainttoleration.Name},
|
{Name: tainttoleration.Name},
|
||||||
|
{Name: selectorspread.Name},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Score: &schedulerapi.PluginSet{
|
Score: &schedulerapi.PluginSet{
|
||||||
@ -275,6 +273,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
||||||
{Name: podtopologyspread.Name, Weight: 2},
|
{Name: podtopologyspread.Name, Weight: 2},
|
||||||
{Name: tainttoleration.Name, Weight: 1},
|
{Name: tainttoleration.Name, Weight: 1},
|
||||||
|
{Name: selectorspread.Name, Weight: 1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Reserve: &schedulerapi.PluginSet{
|
Reserve: &schedulerapi.PluginSet{
|
||||||
@ -298,8 +297,8 @@ func TestApplyFeatureGates(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
if test.feature != "" {
|
for k, v := range test.features {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.feature, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, k, v)()
|
||||||
}
|
}
|
||||||
|
|
||||||
r := NewRegistry()
|
r := NewRegistry()
|
||||||
|
@ -38,9 +38,6 @@ go_test(
|
|||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
|
||||||
"//staging/src/k8s.io/component-base/featuregate:go_default_library",
|
|
||||||
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
|
||||||
"//staging/src/k8s.io/kube-scheduler/config/v1beta1:go_default_library",
|
"//staging/src/k8s.io/kube-scheduler/config/v1beta1:go_default_library",
|
||||||
"//vendor/github.com/google/go-cmp/cmp:go_default_library",
|
"//vendor/github.com/google/go-cmp/cmp:go_default_library",
|
||||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||||
|
@ -24,9 +24,6 @@ import (
|
|||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
"k8s.io/component-base/featuregate"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/kube-scheduler/config/v1beta1"
|
"k8s.io/kube-scheduler/config/v1beta1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/pointer"
|
||||||
@ -39,7 +36,6 @@ func TestCodecsDecodePluginConfig(t *testing.T) {
|
|||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
data []byte
|
data []byte
|
||||||
feature featuregate.Feature
|
|
||||||
wantErr string
|
wantErr string
|
||||||
wantProfiles []config.KubeSchedulerProfile
|
wantProfiles []config.KubeSchedulerProfile
|
||||||
}{
|
}{
|
||||||
@ -302,7 +298,7 @@ profiles:
|
|||||||
{
|
{
|
||||||
Name: "PodTopologySpread",
|
Name: "PodTopologySpread",
|
||||||
Args: &config.PodTopologySpreadArgs{
|
Args: &config.PodTopologySpreadArgs{
|
||||||
DefaultingType: config.ListDefaulting,
|
DefaultingType: config.SystemDefaulting,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -313,9 +309,6 @@ profiles:
|
|||||||
decoder := Codecs.UniversalDecoder()
|
decoder := Codecs.UniversalDecoder()
|
||||||
for _, tt := range testCases {
|
for _, tt := range testCases {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if tt.feature != "" {
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, tt.feature, true)()
|
|
||||||
}
|
|
||||||
obj, gvk, err := decoder.Decode(tt.data, nil, nil)
|
obj, gvk, err := decoder.Decode(tt.data, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if tt.wantErr != err.Error() {
|
if tt.wantErr != err.Error() {
|
||||||
|
@ -136,11 +136,11 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeLabel"},
|
{Name: "NodeLabel"},
|
||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "SelectorSpread"}},
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
||||||
{Name: "NodeLabel", Weight: 4},
|
{Name: "NodeLabel", Weight: 4},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "ServiceAffinity", Weight: 3},
|
{Name: "ServiceAffinity", Weight: 3},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -191,12 +191,12 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeLabel"},
|
{Name: "NodeLabel"},
|
||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "SelectorSpread"}},
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
||||||
{Name: "NodeLabel", Weight: 8}, // Weight is 4 * number of LabelPreference priorities
|
{Name: "NodeLabel", Weight: 8}, // Weight is 4 * number of LabelPreference priorities
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "ServiceAffinity", Weight: 6}, // Weight is the 3 * number of custom ServiceAntiAffinity priorities
|
{Name: "ServiceAffinity", Weight: 6}, // Weight is the 3 * number of custom ServiceAntiAffinity priorities
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -254,14 +254,14 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "AzureDiskLimits"},
|
{Name: "AzureDiskLimits"},
|
||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "SelectorSpread"}},
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
||||||
{Name: "ImageLocality", Weight: 2},
|
{Name: "ImageLocality", Weight: 2},
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodeLabel", Weight: 4},
|
{Name: "NodeLabel", Weight: 4},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "ServiceAffinity", Weight: 3},
|
{Name: "ServiceAffinity", Weight: 3},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -326,7 +326,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -335,7 +335,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "InterPodAffinity", Weight: 2},
|
{Name: "InterPodAffinity", Weight: 2},
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -402,7 +402,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -413,7 +413,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -489,7 +489,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -500,7 +500,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -587,7 +587,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -598,7 +598,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -688,7 +688,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -699,7 +699,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -794,7 +794,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -805,7 +805,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
{Name: "NodeResourcesMostAllocated", Weight: 2},
|
||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -912,7 +912,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -924,7 +924,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "RequestedToCapacityRatio", Weight: 2},
|
{Name: "RequestedToCapacityRatio", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -1033,7 +1033,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -1045,7 +1045,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "RequestedToCapacityRatio", Weight: 2},
|
{Name: "RequestedToCapacityRatio", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -1154,7 +1154,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -1166,7 +1166,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "RequestedToCapacityRatio", Weight: 2},
|
{Name: "RequestedToCapacityRatio", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -1279,7 +1279,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -1291,7 +1291,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeAffinity", Weight: 2},
|
{Name: "NodeAffinity", Weight: 2},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 2},
|
{Name: "NodePreferAvoidPods", Weight: 2},
|
||||||
{Name: "RequestedToCapacityRatio", Weight: 2},
|
{Name: "RequestedToCapacityRatio", Weight: 2},
|
||||||
{Name: "SelectorSpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 2},
|
{Name: "TaintToleration", Weight: 2},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
@ -1408,7 +1408,6 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||||
@ -1419,7 +1418,6 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
|
|||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "PodTopologySpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
@ -1478,7 +1476,6 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||||
@ -1489,7 +1486,6 @@ func TestAlgorithmProviderCompatibility(t *testing.T) {
|
|||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "PodTopologySpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
},
|
},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
"PreBindPlugin": {{Name: "VolumeBinding"}},
|
"PreBindPlugin": {{Name: "VolumeBinding"}},
|
||||||
@ -1567,7 +1563,6 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 1},
|
||||||
@ -1578,7 +1573,6 @@ func TestPluginsConfigurationCompatibility(t *testing.T) {
|
|||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "PodTopologySpread", Weight: 2},
|
{Name: "PodTopologySpread", Weight: 2},
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
},
|
},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
"PreBindPlugin": {{Name: "VolumeBinding"}},
|
"PreBindPlugin": {{Name: "VolumeBinding"}},
|
||||||
|
@ -266,7 +266,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
func TestPluginArgsDefaults(t *testing.T) {
|
func TestPluginArgsDefaults(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
feature featuregate.Feature
|
features map[featuregate.Feature]bool
|
||||||
in runtime.Object
|
in runtime.Object
|
||||||
want runtime.Object
|
want runtime.Object
|
||||||
}{
|
}{
|
||||||
@ -368,7 +368,7 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
name: "PodTopologySpreadArgs resources empty",
|
name: "PodTopologySpreadArgs resources empty",
|
||||||
in: &v1beta1.PodTopologySpreadArgs{},
|
in: &v1beta1.PodTopologySpreadArgs{},
|
||||||
want: &v1beta1.PodTopologySpreadArgs{
|
want: &v1beta1.PodTopologySpreadArgs{
|
||||||
DefaultingType: v1beta1.ListDefaulting,
|
DefaultingType: v1beta1.SystemDefaulting,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -390,38 +390,17 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
MaxSkew: 2,
|
MaxSkew: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// TODO(#94008): Make SystemDefaulting in v1beta2.
|
||||||
DefaultingType: v1beta1.ListDefaulting,
|
DefaultingType: v1beta1.ListDefaulting,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PodTopologySpreadArgs empty, DefaultPodTopologySpread feature enabled",
|
name: "PodTopologySpreadArgs empty, DefaultPodTopologySpread feature disabled",
|
||||||
feature: features.DefaultPodTopologySpread,
|
features: map[featuregate.Feature]bool{
|
||||||
|
features.DefaultPodTopologySpread: false,
|
||||||
|
},
|
||||||
in: &v1beta1.PodTopologySpreadArgs{},
|
in: &v1beta1.PodTopologySpreadArgs{},
|
||||||
want: &v1beta1.PodTopologySpreadArgs{
|
want: &v1beta1.PodTopologySpreadArgs{
|
||||||
DefaultingType: v1beta1.SystemDefaulting,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "PodTopologySpreadArgs with constraints, DefaultPodTopologySpread feature enabled",
|
|
||||||
feature: features.DefaultPodTopologySpread,
|
|
||||||
in: &v1beta1.PodTopologySpreadArgs{
|
|
||||||
DefaultConstraints: []v1.TopologySpreadConstraint{
|
|
||||||
{
|
|
||||||
TopologyKey: v1.LabelHostname,
|
|
||||||
WhenUnsatisfiable: v1.ScheduleAnyway,
|
|
||||||
MaxSkew: 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
want: &v1beta1.PodTopologySpreadArgs{
|
|
||||||
DefaultConstraints: []v1.TopologySpreadConstraint{
|
|
||||||
{
|
|
||||||
TopologyKey: v1.LabelHostname,
|
|
||||||
WhenUnsatisfiable: v1.ScheduleAnyway,
|
|
||||||
MaxSkew: 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// TODO(#94008): Make SystemDefaulting in v1beta2.
|
|
||||||
DefaultingType: v1beta1.ListDefaulting,
|
DefaultingType: v1beta1.ListDefaulting,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -430,8 +409,8 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
scheme := runtime.NewScheme()
|
scheme := runtime.NewScheme()
|
||||||
utilruntime.Must(AddToScheme(scheme))
|
utilruntime.Must(AddToScheme(scheme))
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
if tc.feature != "" {
|
for k, v := range tc.features {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, tc.feature, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, k, v)()
|
||||||
}
|
}
|
||||||
scheme.Default(tc.in)
|
scheme.Default(tc.in)
|
||||||
if diff := cmp.Diff(tc.in, tc.want); diff != "" {
|
if diff := cmp.Diff(tc.in, tc.want); diff != "" {
|
||||||
|
@ -43,6 +43,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodelabel"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodelabel"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/serviceaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/serviceaffinity"
|
||||||
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
||||||
@ -239,7 +240,12 @@ func TestCreateFromEmptyConfig(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
prof := factory.profiles[0]
|
prof := factory.profiles[0]
|
||||||
wantConfig := []schedulerapi.PluginConfig{}
|
wantConfig := []schedulerapi.PluginConfig{
|
||||||
|
{
|
||||||
|
Name: podtopologyspread.Name,
|
||||||
|
Args: &schedulerapi.PodTopologySpreadArgs{DefaultingType: schedulerapi.SystemDefaulting},
|
||||||
|
},
|
||||||
|
}
|
||||||
if diff := cmp.Diff(wantConfig, prof.PluginConfig); diff != "" {
|
if diff := cmp.Diff(wantConfig, prof.PluginConfig); diff != "" {
|
||||||
t.Errorf("wrong plugin config (-want, +got): %s", diff)
|
t.Errorf("wrong plugin config (-want, +got): %s", diff)
|
||||||
}
|
}
|
||||||
|
@ -664,10 +664,12 @@ func TestDryRunPreemption(t *testing.T) {
|
|||||||
st.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
st.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||||
)
|
)
|
||||||
registeredPlugins = append(registeredPlugins, tt.registerPlugins...)
|
registeredPlugins = append(registeredPlugins, tt.registerPlugins...)
|
||||||
|
informerFactory := informers.NewSharedInformerFactory(clientsetfake.NewSimpleClientset(), 0)
|
||||||
fwk, err := st.NewFramework(
|
fwk, err := st.NewFramework(
|
||||||
registeredPlugins,
|
registeredPlugins,
|
||||||
frameworkruntime.WithPodNominator(internalqueue.NewPodNominator()),
|
frameworkruntime.WithPodNominator(internalqueue.NewPodNominator()),
|
||||||
frameworkruntime.WithSnapshotSharedLister(snapshot),
|
frameworkruntime.WithSnapshotSharedLister(snapshot),
|
||||||
|
frameworkruntime.WithInformerFactory(informerFactory),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -121,7 +121,6 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
|||||||
Enabled: []config.Plugin{
|
Enabled: []config.Plugin{
|
||||||
{Name: podtopologyspread.Name},
|
{Name: podtopologyspread.Name},
|
||||||
{Name: interpodaffinity.Name},
|
{Name: interpodaffinity.Name},
|
||||||
{Name: selectorspread.Name},
|
|
||||||
{Name: tainttoleration.Name},
|
{Name: tainttoleration.Name},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -134,17 +133,21 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
|||||||
{Name: noderesources.LeastAllocatedName, Weight: 1},
|
{Name: noderesources.LeastAllocatedName, Weight: 1},
|
||||||
{Name: nodeaffinity.Name, Weight: 1},
|
{Name: nodeaffinity.Name, Weight: 1},
|
||||||
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
{Name: nodepreferavoidpods.Name, Weight: 10000},
|
||||||
{Name: selectorspread.Name, Weight: 1},
|
|
||||||
{Name: tainttoleration.Name, Weight: 1},
|
{Name: tainttoleration.Name, Weight: 1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
wantPluginConfig: []config.PluginConfig{
|
||||||
|
{
|
||||||
|
Name: podtopologyspread.Name,
|
||||||
|
Args: &config.PodTopologySpreadArgs{
|
||||||
|
DefaultingType: config.SystemDefaulting,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DefaultPodTopologySpread enabled, SelectorSpreadPriority only",
|
name: "DefaultPodTopologySpread enabled, SelectorSpreadPriority only",
|
||||||
features: map[featuregate.Feature]bool{
|
|
||||||
features.DefaultPodTopologySpread: true,
|
|
||||||
},
|
|
||||||
keys: map[string]int64{
|
keys: map[string]int64{
|
||||||
SelectorSpreadPriority: 3,
|
SelectorSpreadPriority: 3,
|
||||||
},
|
},
|
||||||
@ -171,9 +174,6 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DefaultPodTopologySpread enabled, EvenPodsSpreadPriority only",
|
name: "DefaultPodTopologySpread enabled, EvenPodsSpreadPriority only",
|
||||||
features: map[featuregate.Feature]bool{
|
|
||||||
features.DefaultPodTopologySpread: true,
|
|
||||||
},
|
|
||||||
keys: map[string]int64{
|
keys: map[string]int64{
|
||||||
EvenPodsSpreadPriority: 4,
|
EvenPodsSpreadPriority: 4,
|
||||||
},
|
},
|
||||||
@ -199,9 +199,9 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DefaultPodTopologySpread enabled, SelectorSpreadPriority+EvenPodsSpreadPriority",
|
name: "DefaultPodTopologySpread disabled, SelectorSpreadPriority+EvenPodsSpreadPriority",
|
||||||
features: map[featuregate.Feature]bool{
|
features: map[featuregate.Feature]bool{
|
||||||
features.DefaultPodTopologySpread: true,
|
features.DefaultPodTopologySpread: false,
|
||||||
},
|
},
|
||||||
keys: map[string]int64{
|
keys: map[string]int64{
|
||||||
SelectorSpreadPriority: 1,
|
SelectorSpreadPriority: 1,
|
||||||
@ -211,19 +211,13 @@ func TestAppendPriorityConfigs(t *testing.T) {
|
|||||||
PreScore: &config.PluginSet{
|
PreScore: &config.PluginSet{
|
||||||
Enabled: []config.Plugin{
|
Enabled: []config.Plugin{
|
||||||
{Name: podtopologyspread.Name},
|
{Name: podtopologyspread.Name},
|
||||||
|
{Name: selectorspread.Name},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Score: &config.PluginSet{
|
Score: &config.PluginSet{
|
||||||
Enabled: []config.Plugin{
|
Enabled: []config.Plugin{
|
||||||
{Name: podtopologyspread.Name, Weight: 2},
|
{Name: podtopologyspread.Name, Weight: 2},
|
||||||
},
|
{Name: selectorspread.Name, Weight: 1},
|
||||||
},
|
|
||||||
},
|
|
||||||
wantPluginConfig: []config.PluginConfig{
|
|
||||||
{
|
|
||||||
Name: podtopologyspread.Name,
|
|
||||||
Args: &config.PodTopologySpreadArgs{
|
|
||||||
DefaultingType: config.SystemDefaulting,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -531,7 +531,7 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
|
|||||||
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
|
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
|
||||||
},
|
},
|
||||||
"PodTopologySpread": &config.PodTopologySpreadArgs{
|
"PodTopologySpread": &config.PodTopologySpreadArgs{
|
||||||
DefaultingType: config.ListDefaulting,
|
DefaultingType: config.SystemDefaulting,
|
||||||
},
|
},
|
||||||
"VolumeBinding": &config.VolumeBindingArgs{
|
"VolumeBinding": &config.VolumeBindingArgs{
|
||||||
BindTimeoutSeconds: 600,
|
BindTimeoutSeconds: 600,
|
||||||
@ -593,7 +593,7 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
|
|||||||
Resources: []config.ResourceSpec{{Name: "resource", Weight: 3}},
|
Resources: []config.ResourceSpec{{Name: "resource", Weight: 3}},
|
||||||
},
|
},
|
||||||
"PodTopologySpread": &config.PodTopologySpreadArgs{
|
"PodTopologySpread": &config.PodTopologySpreadArgs{
|
||||||
DefaultingType: config.ListDefaulting,
|
DefaultingType: config.SystemDefaulting,
|
||||||
},
|
},
|
||||||
"RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{
|
"RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{
|
||||||
Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}},
|
Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}},
|
||||||
|
@ -130,7 +130,6 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -141,7 +140,6 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
||||||
{Name: "NodeAffinity", Weight: 1},
|
{Name: "NodeAffinity", Weight: 1},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
},
|
},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
@ -223,7 +221,6 @@ kind: Policy
|
|||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "SelectorSpread"},
|
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
@ -234,7 +231,6 @@ kind: Policy
|
|||||||
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
||||||
{Name: "NodeAffinity", Weight: 1},
|
{Name: "NodeAffinity", Weight: 1},
|
||||||
{Name: "NodePreferAvoidPods", Weight: 10000},
|
{Name: "NodePreferAvoidPods", Weight: 10000},
|
||||||
{Name: "SelectorSpread", Weight: 1},
|
|
||||||
{Name: "TaintToleration", Weight: 1},
|
{Name: "TaintToleration", Weight: 1},
|
||||||
},
|
},
|
||||||
"ReservePlugin": {{Name: "VolumeBinding"}},
|
"ReservePlugin": {{Name: "VolumeBinding"}},
|
||||||
|
Loading…
Reference in New Issue
Block a user