Skip to content

Commit 1e4b2e2

Browse files
committed
bug fix for pods with different controllerRef
1 parent 9ccd7a7 commit 1e4b2e2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/tapp/controller.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,16 @@ func (c *Controller) getPodsForTApp(tapp *tappv1.TApp) ([]*corev1.Pod, error) {
308308
result := make([]*corev1.Pod, 0, len(pods))
309309
for i := range pods {
310310
// TODO: does it impact performance?
311-
result = append(result, pods[i].DeepCopy())
311+
controllerRef := metav1.GetControllerOf(pods[i])
312+
if controllerRef == nil {
313+
continue
314+
}
315+
if controllerRef.UID == tapp.UID {
316+
result = append(result, pods[i].DeepCopy())
317+
} else {
318+
klog.V(4).Infof("pod %s in namespace %s matches the selector of tapp %s, but has different controllerRef",
319+
pods[i].Name, pods[i].Namespace, util.GetTAppFullName(tapp))
320+
}
312321
}
313322
return result, nil
314323
}

0 commit comments

Comments
 (0)