fix: filter condition for getting pod is incorrect (#1562)

This commit is contained in:
张启航 2023-02-19 16:19:58 +08:00 committed by GitHub
parent 9b65f87cc7
commit 02b26ce69f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1305,8 +1305,7 @@ func (a *appRuntimeStore) HandleOperatorManagedDeployment(app *v1.OperatorManage
deploys := app.GetDeployment()
var deployList []*pb.ManagedDeployment
if deploys != nil {
label := fmt.Sprintf("app_id=%v", app.AppID)
operatorPods, err := a.clientset.CoreV1().Pods(deploys[0].GetNamespace()).List(context.Background(), metav1.ListOptions{LabelSelector: label})
operatorPods, err := a.clientset.CoreV1().Pods(deploys[0].GetNamespace()).List(context.Background(), metav1.ListOptions{})
if err != nil {
logrus.Errorf("get pod by label appid failure: %v", err)
} else {
@ -1329,8 +1328,7 @@ func (a *appRuntimeStore) HandleOperatorManagedStatefulSet(app *v1.OperatorManag
statefulSets := app.GetStatefulSet()
var stsList []*pb.ManagedStatefulSet
if statefulSets != nil {
label := fmt.Sprintf("app_id=%v", app.AppID)
operatorPods, err := a.clientset.CoreV1().Pods(statefulSets[0].GetNamespace()).List(context.Background(), metav1.ListOptions{LabelSelector: label})
operatorPods, err := a.clientset.CoreV1().Pods(statefulSets[0].GetNamespace()).List(context.Background(), metav1.ListOptions{})
if err != nil {
logrus.Errorf("sts get pod by label appid failure: %v", err)
} else {