mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #112784 from kerthcet/cleanup/word-typo
typo fixed with NodeInclusionPolicy
This commit is contained in:
commit
77bf2d1ade
@ -77,7 +77,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
defaultConstraints []v1.TopologySpreadConstraint
|
||||
want *preFilterState
|
||||
enableMinDomains bool
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
enableMatchLabelKeys bool
|
||||
}{
|
||||
{
|
||||
@ -672,7 +672,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-b"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy honored with labelSelectors",
|
||||
@ -710,7 +710,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-b"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with labelSelectors",
|
||||
@ -749,7 +749,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-c"}: 0,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy honored with nodeAffinity",
|
||||
@ -787,7 +787,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-b"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with nodeAffinity",
|
||||
@ -826,7 +826,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-c"}: 0,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "feature gate disabled with NodeTaintsPolicy",
|
||||
@ -864,7 +864,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-c"}: 0,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy ignored",
|
||||
@ -902,7 +902,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-c"}: 0,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy honored",
|
||||
@ -939,7 +939,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-b"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy honored with tolerated taints",
|
||||
@ -978,7 +978,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-c"}: 0,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "two node inclusion Constraints, zone: honor/ignore, node: ignore/ignore",
|
||||
@ -1028,7 +1028,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-x"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "two node inclusion Constraints, zone: honor/honor, node: honor/ignore",
|
||||
@ -1077,7 +1077,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-x"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "two node inclusion Constraints, zone: honor/ignore, node: honor/ignore",
|
||||
@ -1128,7 +1128,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-x"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "two node inclusion Constraints, zone: ignore/ignore, node: honor/honor",
|
||||
@ -1180,7 +1180,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
{key: "node", value: "node-y"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "matchLabelKeys ignored when feature gate disabled",
|
||||
@ -1350,7 +1350,7 @@ func TestPreFilterState(t *testing.T) {
|
||||
|
||||
p := plugintesting.SetupPluginWithInformers(ctx, t, topologySpreadFunc, args, cache.NewSnapshot(tt.existingPods, tt.nodes), tt.objs)
|
||||
p.(*PodTopologySpread).enableMinDomainsInPodTopologySpread = tt.enableMinDomains
|
||||
p.(*PodTopologySpread).enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.(*PodTopologySpread).enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
p.(*PodTopologySpread).enableMatchLabelKeysInPodTopologySpread = tt.enableMatchLabelKeys
|
||||
|
||||
cs := framework.NewCycleState()
|
||||
@ -1387,7 +1387,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
nodeIdx int // denotes which node 'addedPod' belongs to
|
||||
nodes []*v1.Node
|
||||
want *preFilterState
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
}{
|
||||
{
|
||||
name: "node a and b both impact current min match",
|
||||
@ -1686,7 +1686,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "add a pod when scheduling node affinity unmatched pod with NodeInclusionPolicy enabled",
|
||||
@ -1712,7 +1712,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "add a pod when scheduling node affinity matched pod with NodeInclusionPolicy disabled",
|
||||
@ -1739,7 +1739,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "add a pod when scheduling node affinity matched pod with NodeInclusionPolicy enabled",
|
||||
@ -1766,7 +1766,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 2,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "add a label selector not matched pod when with NodeInclusionPolicy enabled",
|
||||
@ -1793,7 +1793,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "add a pod when scheduling taint untolerated pod with NodeInclusionPolicy disabled",
|
||||
@ -1820,7 +1820,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone1"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "add a pod when scheduling taint tolerated pod with NodeInclusionPolicy enabled",
|
||||
@ -1847,7 +1847,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
{key: "zone", value: "zone1"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@ -1856,7 +1856,7 @@ func TestPreFilterStateAddPod(t *testing.T) {
|
||||
snapshot := cache.NewSnapshot(tt.existingPods, tt.nodes)
|
||||
pl := plugintesting.SetupPlugin(t, topologySpreadFunc, &config.PodTopologySpreadArgs{DefaultingType: config.ListDefaulting}, snapshot)
|
||||
p := pl.(*PodTopologySpread)
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
|
||||
cs := framework.NewCycleState()
|
||||
if _, s := p.PreFilter(ctx, cs, tt.preemptor); !s.IsSuccess() {
|
||||
@ -1900,7 +1900,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
deletedPod *v1.Pod // this field is used only when deletedPodIdx is -1
|
||||
nodeIdx int // denotes which node "deletedPod" belongs to
|
||||
want *preFilterState
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
}{
|
||||
{
|
||||
// A high priority pod may not be scheduled due to node taints or resource shortage.
|
||||
@ -2083,7 +2083,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "remove a pod when scheduling node affinity unmatched pod with NodeInclusionPolicy enabled",
|
||||
@ -2109,7 +2109,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
{key: "zone", value: "zone2"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "remove a pod when scheduling node affinity matched pod with NodeInclusionPolicy disabled",
|
||||
@ -2136,7 +2136,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
{key: "zone", value: "zone1"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
name: "remove a pod when scheduling node affinity matched pod with NodeInclusionPolicy enabled",
|
||||
@ -2163,7 +2163,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
{key: "zone", value: "zone1"}: 1,
|
||||
},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@ -2172,7 +2172,7 @@ func TestPreFilterStateRemovePod(t *testing.T) {
|
||||
snapshot := cache.NewSnapshot(tt.existingPods, tt.nodes)
|
||||
pl := plugintesting.SetupPlugin(t, topologySpreadFunc, &config.PodTopologySpreadArgs{DefaultingType: config.ListDefaulting}, snapshot)
|
||||
p := pl.(*PodTopologySpread)
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
|
||||
cs := framework.NewCycleState()
|
||||
if _, s := p.PreFilter(ctx, cs, tt.preemptor); !s.IsSuccess() {
|
||||
@ -2285,7 +2285,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
existingPods []*v1.Pod
|
||||
wantStatusCode map[string]framework.Code
|
||||
enableMinDomains bool
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
}{
|
||||
{
|
||||
name: "no existing pods",
|
||||
@ -2718,7 +2718,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Success, // in real case, when we disable NodeAffinity Plugin, node-y will be success.
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// pods spread across node as 1/1/0/~1~
|
||||
@ -2744,7 +2744,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// pods spread across node as 1/1/0/~0~
|
||||
@ -2770,7 +2770,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Success, // in real case, when we disable NodeAffinity Plugin, node-y will be success.
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// pods spread across node as 1/1/0/~1~
|
||||
@ -2796,7 +2796,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// pods spread across node as 1/1/0/~0~
|
||||
@ -2821,7 +2821,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Success, // in real case, when we disable TaintToleration Plugin, node-y will be success.
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// pods spread across node as 1/1/0/~1~
|
||||
@ -2846,7 +2846,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@ -2855,7 +2855,7 @@ func TestSingleConstraint(t *testing.T) {
|
||||
pl := plugintesting.SetupPlugin(t, topologySpreadFunc, &config.PodTopologySpreadArgs{DefaultingType: config.ListDefaulting}, snapshot)
|
||||
p := pl.(*PodTopologySpread)
|
||||
p.enableMinDomainsInPodTopologySpread = tt.enableMinDomains
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
state := framework.NewCycleState()
|
||||
if _, s := p.PreFilter(context.Background(), state, tt.pod); !s.IsSuccess() {
|
||||
t.Errorf("preFilter failed with status: %v", s)
|
||||
@ -2879,7 +2879,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
nodes []*v1.Node
|
||||
existingPods []*v1.Pod
|
||||
wantStatusCode map[string]framework.Code
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
}{
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, incoming pod can be placed on any zone (hence any node)
|
||||
@ -3104,7 +3104,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 2/0
|
||||
@ -3132,7 +3132,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 1/~1~
|
||||
@ -3161,7 +3161,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 1/0
|
||||
@ -3190,7 +3190,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
"node-x": framework.Success,
|
||||
"node-y": framework.Unschedulable,
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@ -3198,7 +3198,7 @@ func TestMultipleConstraints(t *testing.T) {
|
||||
snapshot := cache.NewSnapshot(tt.existingPods, tt.nodes)
|
||||
pl := plugintesting.SetupPlugin(t, topologySpreadFunc, &config.PodTopologySpreadArgs{DefaultingType: config.ListDefaulting}, snapshot)
|
||||
p := pl.(*PodTopologySpread)
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
state := framework.NewCycleState()
|
||||
if _, s := p.PreFilter(context.Background(), state, tt.pod); !s.IsSuccess() {
|
||||
t.Errorf("preFilter failed with status: %v", s)
|
||||
|
@ -49,7 +49,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
objs []runtime.Object
|
||||
config config.PodTopologySpreadArgs
|
||||
want *preScoreState
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
}{
|
||||
{
|
||||
name: "normal case",
|
||||
@ -321,7 +321,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with labelSelectors",
|
||||
@ -355,7 +355,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy honored with nodeAffinity",
|
||||
@ -389,7 +389,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with nodeAffinity",
|
||||
@ -423,7 +423,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy honored",
|
||||
@ -456,7 +456,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy ignored",
|
||||
@ -489,7 +489,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@ -503,7 +503,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed creating framework runtime: %v", err)
|
||||
}
|
||||
pl, err := New(&tt.config, f, feature.Features{EnableNodeInclusionPolicyInPodTopologySpread: tt.enableNodeInclustionPolicy})
|
||||
pl, err := New(&tt.config, f, feature.Features{EnableNodeInclusionPolicyInPodTopologySpread: tt.enableNodeInclusionPolicy})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed creating plugin: %v", err)
|
||||
}
|
||||
@ -535,7 +535,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
failedNodes []*v1.Node // nodes + failedNodes = all nodes
|
||||
objs []runtime.Object
|
||||
want framework.NodeScoreList
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
enableMatchLabelKeys bool
|
||||
}{
|
||||
// Explanation on the Legend:
|
||||
@ -1029,7 +1029,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 33},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with labelSelectors",
|
||||
@ -1053,7 +1053,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 100},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy honoed with nodeAffinity",
|
||||
@ -1077,7 +1077,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 33},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with nodeAffinity",
|
||||
@ -1101,7 +1101,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 100},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy honored",
|
||||
@ -1124,7 +1124,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 33},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy ignored",
|
||||
@ -1147,7 +1147,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
{Name: "node-b", Score: 100},
|
||||
{Name: "node-c", Score: 100},
|
||||
},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "matchLabelKeys ignored when feature gate disabled",
|
||||
@ -1238,7 +1238,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
|
||||
state := framework.NewCycleState()
|
||||
pl := plugintesting.SetupPluginWithInformers(ctx, t, podTopologySpreadFunc, &config.PodTopologySpreadArgs{DefaultingType: config.SystemDefaulting}, cache.NewSnapshot(tt.existingPods, allNodes), tt.objs)
|
||||
p := pl.(*PodTopologySpread)
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclustionPolicy
|
||||
p.enableNodeInclusionPolicyInPodTopologySpread = tt.enableNodeInclusionPolicy
|
||||
p.enableMatchLabelKeysInPodTopologySpread = tt.enableMatchLabelKeys
|
||||
|
||||
status := p.PreScore(context.Background(), state, tt.pod, tt.nodes)
|
||||
|
@ -1075,7 +1075,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
nodes []*v1.Node
|
||||
candidateNodes []string // nodes expected to schedule onto
|
||||
enableMinDomains bool
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
enableMatchLabelKeys bool
|
||||
}{
|
||||
// note: naming starts at index 0
|
||||
@ -1292,7 +1292,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-4"}, // node-3 is filtered out by NodeAffinity plugin
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeAffinityPolicy ignored with nodeAffinity, pods spread across zone as 1/~2~",
|
||||
@ -1313,7 +1313,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-1", "node-2"},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy honored, pods spread across zone as 2/1",
|
||||
@ -1334,7 +1334,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-4"}, // node-3 is filtered out by TaintToleration plugin
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "NodeTaintsPolicy ignored, pods spread across zone as 2/2",
|
||||
@ -1355,7 +1355,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-1", "node-2", "node-4"}, // node-3 is filtered out by TaintToleration plugin
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 2/1
|
||||
@ -1381,7 +1381,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-4"},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 2/1
|
||||
@ -1407,7 +1407,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-4"},
|
||||
enableNodeInclustionPolicy: false,
|
||||
enableNodeInclusionPolicy: false,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as 2/2
|
||||
@ -1433,7 +1433,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Label("foo", "").Obj(),
|
||||
},
|
||||
candidateNodes: []string{"node-1", "node-4"},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "matchLabelKeys ignored when feature gate disabled, pods spread across zone as 2/1",
|
||||
@ -1484,7 +1484,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MinDomainsInPodTopologySpread, tt.enableMinDomains)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NodeInclusionPolicyInPodTopologySpread, tt.enableNodeInclustionPolicy)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NodeInclusionPolicyInPodTopologySpread, tt.enableNodeInclusionPolicy)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodTopologySpread, tt.enableMatchLabelKeys)()
|
||||
|
||||
testCtx := initTest(t, "pts-predicate")
|
||||
|
@ -448,7 +448,7 @@ func TestPodTopologySpreadScoring(t *testing.T) {
|
||||
fits bool
|
||||
nodes []*v1.Node
|
||||
want []string // nodes expected to schedule onto
|
||||
enableNodeInclustionPolicy bool
|
||||
enableNodeInclusionPolicy bool
|
||||
enableMatchLabelKeys bool
|
||||
}{
|
||||
// note: naming starts at index 0
|
||||
@ -513,7 +513,7 @@ func TestPodTopologySpreadScoring(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Obj(),
|
||||
},
|
||||
want: []string{"node-3"},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
// 1. to fulfil "zone" constraint, pods spread across zones as ~3~/~1~
|
||||
@ -539,7 +539,7 @@ func TestPodTopologySpreadScoring(t *testing.T) {
|
||||
st.MakeNode().Name("node-4").Label("node", "node-4").Label("zone", "zone-2").Obj(),
|
||||
},
|
||||
want: []string{"node-3"},
|
||||
enableNodeInclustionPolicy: true,
|
||||
enableNodeInclusionPolicy: true,
|
||||
},
|
||||
{
|
||||
name: "matchLabelKeys ignored when feature gate disabled, node-1 is the preferred fit",
|
||||
@ -598,7 +598,7 @@ func TestPodTopologySpreadScoring(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NodeInclusionPolicyInPodTopologySpread, tt.enableNodeInclustionPolicy)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NodeInclusionPolicyInPodTopologySpread, tt.enableNodeInclusionPolicy)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MatchLabelKeysInPodTopologySpread, tt.enableMatchLabelKeys)()
|
||||
|
||||
testCtx := initTestSchedulerForPriorityTest(t, podtopologyspread.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user