Skip to content

Commit d73a006

Browse files
author
GW Cloud Common Services
committed
changed new object
Signed-off-by: GW Cloud Common Services <[email protected]>
1 parent 7bbca7d commit d73a006

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

controllers/backup_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error {
172172
// filter the changes in workflow status
173173
// let workflow handle its reconcile
174174
UpdateFunc: func(e ctrlEvent.UpdateEvent) bool {
175-
new := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
176-
old := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
175+
newObj := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
176+
oldObj := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
177177
// if the workflow is not finished, skip the reconcile
178-
if !new.Status.Finished {
178+
if !newObj.Status.Finished {
179179
return false
180180
}
181181

182-
return !reflect.DeepEqual(old, new)
182+
return !reflect.DeepEqual(oldObj, newObj)
183183
},
184184
CreateFunc: func(e ctrlEvent.CreateEvent) bool {
185185
run := e.Object.DeepCopyObject().(*v1alpha1.WorkflowRun)

controllers/workflowrun_controller.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,35 +216,35 @@ func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error {
216216
// filter the changes in workflow status
217217
// let workflow handle its reconcile
218218
UpdateFunc: func(e ctrlEvent.UpdateEvent) bool {
219-
new, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
220-
old, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
219+
newObj, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
220+
oldObj, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
221221

222222
// if the object is a event listener, reconcile the controller
223223
if !isNewWR || !isOldWR {
224224
return true
225225
}
226226

227227
// if the workflow is finished, skip the reconcile
228-
if new.Status.Finished {
228+
if newObj.Status.Finished {
229229
return false
230230
}
231231

232232
// filter managedFields changes
233-
old.ManagedFields = nil
234-
new.ManagedFields = nil
233+
oldObj.ManagedFields = nil
234+
newObj.ManagedFields = nil
235235

236236
// filter resourceVersion changes
237-
old.ResourceVersion = new.ResourceVersion
237+
oldObj.ResourceVersion = newObj.ResourceVersion
238238

239239
// if the generation is changed, return true to let the controller handle it
240-
if old.Generation != new.Generation {
240+
if oldObj.Generation != newObj.Generation {
241241
return true
242242
}
243243

244244
// ignore the changes in step status
245-
old.Status.Steps = new.Status.Steps
245+
oldObj.Status.Steps = newObj.Status.Steps
246246

247-
return !reflect.DeepEqual(old, new)
247+
return !reflect.DeepEqual(oldObj, newObj)
248248
},
249249
CreateFunc: func(e ctrlEvent.CreateEvent) bool { //nolint:revive,unused
250250
return true

pkg/utils/recycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (r *recycleCronJob) start(ctx context.Context) (*cron.Cron, error) {
6969
Duration: 1 * time.Minute,
7070
Factor: 5.0,
7171
Jitter: 0.1,
72-
}, func(err error) bool {
72+
}, func(err error) bool { //nolint:revive,unused
7373
// always retry
7474
return true
7575
}, func() error {

0 commit comments

Comments
 (0)