Skip to content

Commit

Permalink
fix: Handle nil pod in logsReader.GetLogsByJobAndContainerName method (
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaudinho authored Sep 7, 2021
1 parent ab3e839 commit 1700a32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/kube/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func (r *logsReader) GetLogsByJobAndContainerName(ctx context.Context, job *batc
if err != nil {
return nil, fmt.Errorf("getting pod controllered by job: %q: %w", job.Namespace+"/"+job.Name, err)
}
if pod == nil {
return nil, fmt.Errorf("getting pod controlled by job: %q: pod not found", job.Namespace+"/"+job.Name)
}

return r.clientset.CoreV1().Pods(pod.Namespace).
GetLogs(pod.Name, &corev1.PodLogOptions{
Expand Down

0 comments on commit 1700a32

Please sign in to comment.