From af4dfb7e5818909c84dbd8719d0f4bb10ddf6bf5 Mon Sep 17 00:00:00 2001 From: Anik Bhattacharjee Date: Wed, 25 Oct 2023 15:24:50 -0400 Subject: [PATCH] debug: get pods' spec Signed-off-by: Anik Bhattacharjee --- test/e2e/install_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/e2e/install_test.go b/test/e2e/install_test.go index a4d57d109..262d8da33 100644 --- a/test/e2e/install_test.go +++ b/test/e2e/install_test.go @@ -380,9 +380,18 @@ func getArtifactsOutput(ctx context.Context, basePath string) { GinkgoWriter.Printf("Failed to list pods %w in namespace: %q", err, namespace.Name) } for _, pod := range pods.Items { + // Save pod to artifact path + podYaml, err := yaml.Marshal(pod) + if err != nil { + GinkgoWriter.Printf("Failed to marshal deployment %w", err) + continue + } if pod.Status.Phase != corev1.PodRunning && pod.Status.Phase != corev1.PodSucceeded && pod.Status.Phase != corev1.PodFailed { continue } + if err := os.WriteFile(filepath.Join(namespacedArtifactPath, pod.Name+"-pod.yaml"), podYaml, 0600); err != nil { + GinkgoWriter.Printf("Failed to write pod to file %w", err) + } for _, container := range pod.Spec.Containers { logs, err := kubeClient.CoreV1().Pods(namespace.Name).GetLogs(pod.Name, &corev1.PodLogOptions{Container: container.Name}).Stream(ctx) if err != nil {