Bugfix prevent daemon controller to adopt controller revisions of other namespaces

This commit is contained in:
evertrain
2021-11-01 17:36:15 +08:00
parent 37efc5feec
commit 9ceb226c06
5 changed files with 132 additions and 12 deletions

View File

@@ -107,6 +107,12 @@ func (m *BaseControllerRefManager) ClaimObject(ctx context.Context, obj metav1.O
// Ignore if the object is being deleted
return false, nil
}
if m.Controller.GetNamespace() != obj.GetNamespace() {
// Ignore if namespace not match
return false, nil
}
// Selector matches. Try to adopt.
if err := adopt(ctx, obj); err != nil {
// If the pod no longer exists, ignore the error.