Skip to content

Commit

Permalink
fix: minioJob should have different ResourceVersion to sync (#2021)
Browse files Browse the repository at this point in the history
minioJob should have different ResourceVersion to sync

Co-authored-by: guozhi.li <guozhi.li@daocloud.io>
  • Loading branch information
jiuker and guozhi.li committed Mar 7, 2024
1 parent 0950410 commit f8831e3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/controller/job-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,15 @@ func NewJobController(

// Set up an event handler for when resources change
jobinformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
controller.enqueueJob(obj)
},
AddFunc: controller.enqueueJob,
UpdateFunc: func(old, new interface{}) {
oldJob := old.(*v1alpha1.MinIOJob)
newJob := new.(*v1alpha1.MinIOJob)
if oldJob.ResourceVersion == newJob.ResourceVersion {
// Periodic resync will send update events for all known Tenants.
// Two different versions of the same Tenant will always have different RVs.
return
}
controller.enqueueJob(new)
},
})
Expand Down

0 comments on commit f8831e3

Please sign in to comment.