Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pod events to log incase of job failure #332

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,18 +626,36 @@ func appendPodLogToStork(jobName string, namespace string) {
numLogLines := int64(50)
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("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("---")
logrus.Infof("pod describe of job [%s/%s] of namespace [%s]", pod.Name, jobName, pod.Namespace)
logrus.Infof("---")
logrus.Infof("%v", podDescribe)
logrus.Infof("end of job-pod [%s]'s description", pod.Name)
logrus.Infof("---")
logrus.Infof("pod events of job [%s/%s] of namespace [%s]", pod.Name, jobName, pod.Namespace)
logrus.Infof("---")
opts := metav1.ListOptions{
FieldSelector: "involvedObject.name=" + pod.Name,
}
events, err := core.Instance().ListEvents(namespace, opts)
if err != nil {
logrus.Infof("error to fetch events for pod[%s/%s]: %v", namespace, pod.Name, err)
} else {
logrus.Infof("%v", events)
logrus.Infof("---")
}
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)
} else {
logrus.Infof("start of job-pod [%s]'s log...", pod.Name)
logrus.Infof("---")
logrus.Infof("pod log of job [%s/%s]", pod.Name, jobName)
logrus.Infof("---")
logrus.Infof(podLog)
logrus.Infof("end of job-pod [%s]'s log...", pod.Name)
logrus.Infof("---")
}
}
}
Expand Down
Loading