Skip to content

Commit dfe4d85

Browse files
continue to match the dependencies, rather than return directly
Signed-off-by: changzhen <[email protected]>
1 parent a6a59d3 commit dfe4d85

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pkg/dependenciesdistributor/dependencies_distributor.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,23 @@ func matchesWithBindingDependencies(resourceTemplateKey *LabelsKey, independentB
235235
resourceTemplateKey.Kind == dependency.Kind &&
236236
resourceTemplateKey.Namespace == dependency.Namespace {
237237
if len(dependency.Name) != 0 {
238-
return dependency.Name == resourceTemplateKey.Name
238+
if dependency.Name == resourceTemplateKey.Name {
239+
return true
240+
}
241+
continue
239242
}
240243
var selector labels.Selector
241244
if selector, err = metav1.LabelSelectorAsSelector(dependency.LabelSelector); err != nil {
242245
klog.Errorf("Failed to converts the LabelSelector of binding(%s/%s) dependencies(%s): %v",
243246
independentBinding.Namespace, independentBinding.Name, dependencies, err)
244-
return false
247+
// If convert LabelSelector failed, retrying with an error return will not solve the problem.
248+
// It will only increase the consumption by repeatedly listing the binding.
249+
// Therefore, it is better to print this error and ignore it.
250+
continue
251+
}
252+
if selector != nil && selector.Matches(labels.Set(resourceTemplateKey.Labels)) {
253+
return true
245254
}
246-
return selector.Matches(labels.Set(resourceTemplateKey.Labels))
247255
}
248256
}
249257
return false

0 commit comments

Comments
 (0)