Skip to content

Commit

Permalink
debug: get pods' spec
Browse files Browse the repository at this point in the history
Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
  • Loading branch information
anik120 committed Oct 25, 2023
1 parent 409fae2 commit af4dfb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit af4dfb7

Please sign in to comment.