diff --git a/test/e2e/framework/pv_util.go b/test/e2e/framework/pv_util.go index 8ae253c8d27..423a8f3cd4a 100644 --- a/test/e2e/framework/pv_util.go +++ b/test/e2e/framework/pv_util.go @@ -931,16 +931,8 @@ func SetNodeAffinityRequirement(nodeSelection *NodeSelection, operator v1.NodeSe } nodeSelection.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms = append(nodeSelection.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms, v1.NodeSelectorTerm{ - // https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity warns - // that "the value of kubernetes.io/hostname may be the same as the Node name in some environments and a different value in other environments". - // So this might be cleaner: - // MatchFields: []v1.NodeSelectorRequirement{ - // {Key: "name", Operator: v1.NodeSelectorOpNotIn, Values: []string{nodeName}}, - // }, - // However, "name", "Name", "ObjectMeta.Name" all got rejected with "not a valid field selector key". - - MatchExpressions: []v1.NodeSelectorRequirement{ - {Key: "kubernetes.io/hostname", Operator: operator, Values: []string{nodeName}}, + MatchFields: []v1.NodeSelectorRequirement{ + {Key: "metadata.name", Operator: operator, Values: []string{nodeName}}, }, }) }