Skip to content

Commit

Permalink
fix issue 890
Browse files Browse the repository at this point in the history
Signed-off-by: Thor <[email protected]>
  • Loading branch information
Thor-wl committed Jul 3, 2020
1 parent 99f934b commit a16f5b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/controllers/job/job_controller_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"sync"
"sync/atomic"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
Expand Down Expand Up @@ -149,8 +149,10 @@ func (cc *Controller) initiateJob(job *batch.Job) (*batch.Job, error) {
klog.Infof("Current Version is: %d of job: %s/%s", job.Status.Version, job.Namespace, job.Name)
job, err := cc.initJobStatus(job)
if err != nil {
cc.recorder.Event(job, v1.EventTypeWarning, string(batch.JobStatusError),
fmt.Sprintf("Failed to initialize job status, err: %v", err))
if job != nil {
cc.recorder.Event(job, v1.EventTypeWarning, string(batch.JobStatusError),
fmt.Sprintf("Failed to initialize job status, err: %v", err))
}
return nil, err
}

Expand Down

0 comments on commit a16f5b3

Please sign in to comment.