From 4d8954e0b4c351e1b9f8581fb6fd1cf44ab6c6dd Mon Sep 17 00:00:00 2001 From: shkumari-px Date: Mon, 25 Sep 2023 17:10:27 +0000 Subject: [PATCH] PB-4396 Added code to capture pod's description incase of failure --- pkg/controllers/dataexport/reconcile.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/dataexport/reconcile.go b/pkg/controllers/dataexport/reconcile.go index 45e45e791..dc8117b3a 100644 --- a/pkg/controllers/dataexport/reconcile.go +++ b/pkg/controllers/dataexport/reconcile.go @@ -507,7 +507,7 @@ func appendPodLogToStork(jobName string, namespace string) { // Get job and check whether it has live pod attaced to it job, err := batch.Instance().GetJob(jobName, namespace) if err != nil && !k8sErrors.IsNotFound(err) { - logrus.Infof("failed in getting job %v/%v with err: %v", namespace, jobName, err) + logrus.Infof("failed in getting job %v/%v with err: %v and reason: %v", namespace, jobName, err, job.Status.Conditions[0].Reason) } pods, err := core.Instance().GetPods( job.Namespace, @@ -523,6 +523,13 @@ func appendPodLogToStork(jobName string, namespace string) { podLog, err := core.Instance().GetPodLog(pod.Name, pod.Namespace, &corev1.PodLogOptions{TailLines: &numLogLines}) if err != nil { logrus.Infof("error fetching log of job-pod %s: %v", pod.Name, err) + podDescribe, err := core.Instance().GetPodByName(pod.Name, pod.Namespace) + if err != nil { + logrus.Infof("Error fetching description of job-pod[%s] :%v", pod.Name, err) + } + logrus.Infof("start of job-pod[%s]'s description", pod.Name) + logrus.Infof("Describe%v", podDescribe) + logrus.Infof("end of job-pod[%s]'s description", pod.Name) } else { logrus.Infof("start of job-pod [%s]'s log...", pod.Name) logrus.Infof(podLog)