only apply this check if the controller is actually namespaced

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
This commit is contained in:
Carl 2021-11-04 13:08:47 +08:00 committed by GitHub
parent 9ceb226c06
commit b3e4fed844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,7 @@ func (m *BaseControllerRefManager) ClaimObject(ctx context.Context, obj metav1.O
return false, nil
}
if m.Controller.GetNamespace() != obj.GetNamespace() {
if len(m.Controller.GetNamespace()) > 0 && m.Controller.GetNamespace() != obj.GetNamespace() {
// Ignore if namespace not match
return false, nil
}