Skip to content

Commit

Permalink
PB-4396 Added code to capture pod's description incase of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
shkumari-px committed Sep 25, 2023
1 parent 41d953c commit 4d8954e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 4d8954e

Please sign in to comment.