Skip to content

Commit

Permalink
Fix pod scheduling in E2E (submariner-io#212)
Browse files Browse the repository at this point in the history
addNodeSelectorRequirement hard-codes the Operator and Values fields
and thus a non-gateway node is always selected for the connectivity check
pods. Use the parameters.

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis authored and mangelajo committed Nov 13, 2019
1 parent 24e0706 commit 8da8298
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/e2e/framework/network_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func nodeAffinity(scheduling NetworkPodScheduling) *v1.Affinity {
nodeSelReqs = addNodeSelectorRequirement(nodeSelReqs, GatewayLabel, v1.NodeSelectorOpNotIn, []string{"true"})
}

affinity := v1.Affinity{
return &v1.Affinity{
NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
Expand All @@ -225,14 +225,13 @@ func nodeAffinity(scheduling NetworkPodScheduling) *v1.Affinity {
},
},
}
return &affinity
}

func addNodeSelectorRequirement(nodeSelReqs []v1.NodeSelectorRequirement, label string,
op v1.NodeSelectorOperator, values []string) []v1.NodeSelectorRequirement {
return append(nodeSelReqs, v1.NodeSelectorRequirement{
Key: label,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"true"},
Operator: op,
Values: values,
})
}

0 comments on commit 8da8298

Please sign in to comment.