Merge pull request #61487 from gmarek/condition

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix condition for using network unavailable taint in cloud_cidr_allocator

Ref. #61481

The 'networkUnavailable' condition has, in a sense reverse logic. I.e. we should be trying to allocate CIRD when the condition is "true", i.e. when the taint exists.

```release-note
NONE
```

@shyamjvs @agabet @bowei
This commit is contained in:
Kubernetes Submit Queue 2018-03-21 13:40:33 -07:00 committed by GitHub
commit 4f0ec7b199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,7 +112,7 @@ func NewCloudCIDRAllocator(client clientset.Interface, cloud cloudprovider.Inter
// set to true, we need to process the node to set the condition.
networkUnavailableTaint := &v1.Taint{Key: algorithm.TaintNodeNetworkUnavailable, Effect: v1.TaintEffectNoSchedule}
_, cond := v1node.GetNodeCondition(&newNode.Status, v1.NodeNetworkUnavailable)
if cond == nil || cond.Status != v1.ConditionFalse || !utiltaints.TaintExists(newNode.Spec.Taints, networkUnavailableTaint) {
if cond == nil || cond.Status != v1.ConditionFalse || utiltaints.TaintExists(newNode.Spec.Taints, networkUnavailableTaint) {
return ca.AllocateOrOccupyCIDR(newNode)
}
return nil