Skip to content

Commit

Permalink
Merge pull request #67 from qianjun1993/controllerRef
Browse files Browse the repository at this point in the history
bug fix for get pods for Tapp with different controllerRef
  • Loading branch information
hex108 authored Feb 24, 2021
2 parents 3436287 + 1e4b2e2 commit 2727f83
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/tapp/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,16 @@ func (c *Controller) getPodsForTApp(tapp *tappv1.TApp) ([]*corev1.Pod, error) {
result := make([]*corev1.Pod, 0, len(pods))
for i := range pods {
// TODO: does it impact performance?
result = append(result, pods[i].DeepCopy())
controllerRef := metav1.GetControllerOf(pods[i])
if controllerRef == nil {
continue
}
if controllerRef.UID == tapp.UID {
result = append(result, pods[i].DeepCopy())
} else {
klog.V(4).Infof("pod %s in namespace %s matches the selector of tapp %s, but has different controllerRef",
pods[i].Name, pods[i].Namespace, util.GetTAppFullName(tapp))
}
}
return result, nil
}
Expand Down

0 comments on commit 2727f83

Please sign in to comment.