diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 97d9befe..a790b9fc 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -113,6 +113,14 @@ func checkAddonStatus() { return err } if d.Status.AvailableReplicas < 1 { + podlist, err := kubeClient.CoreV1().Pods(hubInstallNamespace).List(context.Background(), metav1.ListOptions{}) + if err != nil { + return err + } + fmt.Println("podlist on hub:") + for _, pod := range podlist.Items { + fmt.Println(pod.Name) + } return fmt.Errorf("available replicas for %s should >= 1, but get %d", deployment, d.Status.AvailableReplicas) } } @@ -126,7 +134,23 @@ func checkAddonStatus() { // deployment on managedcluster is running anpAgent, err := kubeClient.AppsV1().Deployments(managedClusterInstallNamespace).Get(context.Background(), "cluster-proxy-proxy-agent", metav1.GetOptions{}) if err != nil { - return err + // log pod log of cluster-proxy-addon-manager + podlist, err := kubeClient.CoreV1().Pods(hubInstallNamespace).List(context.Background(), metav1.ListOptions{}) + if err != nil { + return err + } + podlog := "" + for _, pod := range podlist.Items { + if strings.Contains(pod.Name, "cluster-proxy-addon-manager") { + podLog, err := kubeClient.CoreV1().Pods(hubInstallNamespace).GetLogs(pod.Name, &corev1.PodLogOptions{}).DoRaw(context.Background()) + if err != nil { + return err + } + podlog += string(podLog) + } + } + fmt.Println("cluster-proxy-addon-manager podlog: ", podlog) + return fmt.Errorf("deployment %s is not running, %v", "cluster-proxy-proxy-agent", err) } if anpAgent.Status.AvailableReplicas < 1 { return fmt.Errorf("available replicas for %s should be more than 1, but get %d", "anp-agent", anpAgent.Status.AvailableReplicas)