Skip to content

Commit

Permalink
UpdateJob when Job annotations or labels changed
Browse files Browse the repository at this point in the history
  • Loading branch information
lihao04 committed May 14, 2020
1 parent bab40f1 commit b915353
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/controllers/job/job_controller_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ func (cc *Controller) updateJob(oldObj, newObj interface{}) {

// NOTE: Since we only reconcile job based on Spec, we will ignore other attributes
// For Job status, it's used internally and always been updated via our controller.
if reflect.DeepEqual(newJob.Spec, oldJob.Spec) && newJob.Status.State.Phase == oldJob.Status.State.Phase {
klog.V(6).Infof("Job update event is ignored since no update in 'Spec'.")
// NOTE: Maybe we should consider annotations and labels
if reflect.DeepEqual(newJob.Annotations, oldJob.Annotations) &&
reflect.DeepEqual(newJob.Labels, oldJob.Labels) &&
reflect.DeepEqual(newJob.Spec, oldJob.Spec) &&
newJob.Status.State.Phase == oldJob.Status.State.Phase {
klog.V(6).Infof("Job update event is ignored since no update in " +
"'Spec', 'Annotations' and 'Labels'.")
return
}

Expand Down

0 comments on commit b915353

Please sign in to comment.