Comment out NodeAffinity.RequiredDuringSchedulingRequiredDuringExecution

because it is not yet implemented.
This commit is contained in:
David Oppenheimer
2016-02-10 23:06:33 -08:00
parent c30bffacc8
commit 66368efad5
11 changed files with 161 additions and 276 deletions

View File

@@ -513,18 +513,21 @@ func PodMatchesNodeLabels(pod *api.Pod, node *api.Node) bool {
if affinity.NodeAffinity != nil {
nodeAffinity := affinity.NodeAffinity
// if no required NodeAffinity requirements, will do no-op, means select all nodes.
if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution == nil && nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil {
// TODO: Replace next line with subsequent commented-out line when implement RequiredDuringSchedulingRequiredDuringExecution.
if nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil {
// if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution == nil && nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil {
return true
}
// Match node selector for requiredDuringSchedulingRequiredDuringExecution.
if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil {
nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms
glog.V(10).Infof("Match for RequiredDuringSchedulingRequiredDuringExecution node selector terms %+v", nodeSelectorTerms)
nodeAffinityMatches = NodeMatchesNodeSelectorTerms(node, nodeSelectorTerms)
}
// TODO: Uncomment this block when implement RequiredDuringSchedulingRequiredDuringExecution.
// if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil {
// nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms
// glog.V(10).Infof("Match for RequiredDuringSchedulingRequiredDuringExecution node selector terms %+v", nodeSelectorTerms)
// nodeAffinityMatches = NodeMatchesNodeSelectorTerms(node, nodeSelectorTerms)
// }
// Match node selector for requiredDuringSchedulingRequiredDuringExecution.
// Match node selector for requiredDuringSchedulingIgnoredDuringExecution.
if nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil {
nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms
glog.V(10).Infof("Match for RequiredDuringSchedulingIgnoredDuringExecution node selector terms %+v", nodeSelectorTerms)

View File

@@ -881,41 +881,42 @@ func TestPodFitsSelector(t *testing.T) {
fits: true,
test: "Pod with multiple NodeSelectorTerms ORed in affinity, matches the node's labels and will schedule onto the node",
},
{
pod: &api.Pod{
ObjectMeta: api.ObjectMeta{
Annotations: map[string]string{
api.AffinityAnnotationKey: `
{"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": {
"nodeSelectorTerms": [{
"matchExpressions": [{
"key": "foo",
"operator": "In",
"values": ["bar", "value2"]
}]
}]
},
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{
"matchExpressions": [{
"key": "foo",
"operator": "NotIn",
"values": ["bar", "value2"]
}]
}]
}
}}`,
},
},
},
labels: map[string]string{
"foo": "bar",
},
fits: false,
test: "Pod with an Affinity both requiredDuringSchedulingRequiredDuringExecution and " +
"requiredDuringSchedulingIgnoredDuringExecution indicated that don't match node's labels and won't schedule onto the node",
},
// TODO: Uncomment this test when implement RequiredDuringSchedulingRequiredDuringExecution
// {
// pod: &api.Pod{
// ObjectMeta: api.ObjectMeta{
// Annotations: map[string]string{
// api.AffinityAnnotationKey: `
// {"nodeAffinity": {
// "requiredDuringSchedulingRequiredDuringExecution": {
// "nodeSelectorTerms": [{
// "matchExpressions": [{
// "key": "foo",
// "operator": "In",
// "values": ["bar", "value2"]
// }]
// }]
// },
// "requiredDuringSchedulingIgnoredDuringExecution": {
// "nodeSelectorTerms": [{
// "matchExpressions": [{
// "key": "foo",
// "operator": "NotIn",
// "values": ["bar", "value2"]
// }]
// }]
// }
// }}`,
// },
// },
// },
// labels: map[string]string{
// "foo": "bar",
// },
// fits: false,
// test: "Pod with an Affinity both requiredDuringSchedulingRequiredDuringExecution and " +
// "requiredDuringSchedulingIgnoredDuringExecution indicated that don't match node's labels and won't schedule onto the node",
// },
{
pod: &api.Pod{
ObjectMeta: api.ObjectMeta{