-
Notifications
You must be signed in to change notification settings - Fork 998
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
UpdateJob when Job annotations or labels changed #806
UpdateJob when Job annotations or labels changed #806
Conversation
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: 30c396e0-95c2-11ea-886e-05c348efcea1 |
7c864bf
to
b915353
Compare
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: ffc7ffc0-95c3-11ea-886e-05c348efcea1 |
b915353
to
0fd0bf4
Compare
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: 6ccb1a80-95c4-11ea-886e-05c348efcea1 |
0fd0bf4
to
b3fb4a9
Compare
/assign @hzxuzhonghu |
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: 652eff60-95cb-11ea-886e-05c348efcea1 |
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if other fields changed, like finalizer? You can still meet the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i suggest
// no update at all
if newJob.ResourceVersion == oldJob.ResourceVersion {
return
}
if err := cc.cache.Update(newJob); err != nil {
klog.Errorf("UpdateJob - Failed to update job <%s/%s>: %v in cache",
newJob.Namespace, newJob.Name, err)
}
// 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'.")
return
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx,all done
b3fb4a9
to
20e5753
Compare
Please review again, thanks~ |
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: a0cb39a0-9673-11ea-a89a-bff82cd15392 |
20e5753
to
a7d3a65
Compare
Travis tests have failedHey @silenceli, TravisBuddy Request Identifier: 03d56810-967c-11ea-a89a-bff82cd15392 |
Signed-off-by: lihao04 <[email protected]>
a7d3a65
to
8108eef
Compare
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks for the fix
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu, k82cn, silenceli The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@Thor-wl please help cherry-pick to release 0.4 branch |
bug description: #805