controller: sync deployments once they don't overlap anymore

This commit is contained in:
Michail Kargakis
2016-12-05 03:34:51 +01:00
parent 2b0a1f2b11
commit d19a1109e2
2 changed files with 136 additions and 37 deletions

View File

@@ -1041,9 +1041,7 @@ func OverlapsWith(current, other *extensions.Deployment) (bool, error) {
}
otherSelector, err := metav1.LabelSelectorAsSelector(other.Spec.Selector)
if err != nil {
// Broken selectors from other deployments shouldn't block current deployment. Just log the error and continue.
glog.V(2).Infof("Skip overlapping check: deployment %s/%s has invalid label selector: %v", other.Namespace, other.Name, err)
return false, nil
return false, fmt.Errorf("deployment %s/%s has invalid label selector: %v", other.Namespace, other.Name, err)
}
return (!currentSelector.Empty() && currentSelector.Matches(labels.Set(other.Spec.Template.Labels))) ||
(!otherSelector.Empty() && otherSelector.Matches(labels.Set(current.Spec.Template.Labels))), nil