From 5a8561a31f0c2e9243c4e2af687eeaaf732e20ad Mon Sep 17 00:00:00 2001 From: Salah Aldeen Al Saleh Date: Wed, 27 Oct 2021 10:20:55 -0700 Subject: [PATCH] include logs for init containers as well (#467) --- pkg/collect/cluster_resources.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/collect/cluster_resources.go b/pkg/collect/cluster_resources.go index 7b99c93a..f6ab1c87 100644 --- a/pkg/collect/cluster_resources.go +++ b/pkg/collect/cluster_resources.go @@ -74,7 +74,8 @@ func ClusterResources(c *Collector, clusterResourcesCollector *troubleshootv1bet output.SaveResult(c.BundlePath, "cluster-resources/pods-errors.json", marshalErrors(podErrors)) for _, pod := range failedPods { - for _, container := range pod.Spec.Containers { + allContainers := append(pod.Spec.InitContainers, pod.Spec.Containers...) + for _, container := range allContainers { logsRoot := path.Join(c.BundlePath, "cluster-resources", "pods", pod.Namespace, "logs") limits := &troubleshootv1beta2.LogLimits{ MaxLines: 500,