@@ -112,7 +112,7 @@ func (r *DevWorkspacePrunerReconciler) SetupWithManager(mgr ctrl.Manager) error
112
112
return shouldReconcileOnUpdate (e , log )
113
113
},
114
114
CreateFunc : func (e event.CreateEvent ) bool { return true },
115
- DeleteFunc : func (e event.DeleteEvent ) bool { return false },
115
+ DeleteFunc : func (e event.DeleteEvent ) bool { return true },
116
116
GenericFunc : func (e event.GenericEvent ) bool { return false },
117
117
}
118
118
@@ -287,6 +287,7 @@ func (r *DevWorkspacePrunerReconciler) dryRunPruneStrategy(retainTime time.Durat
287
287
log .Info (fmt .Sprintf ("Found %d DevWorkspaces to prune" , len (filteredObjs )))
288
288
289
289
// Return an empty list of DevWorkspaces because this is a dry-run
290
+ log .Info ("Dry run mode: no DevWorkspaces will be pruned" )
290
291
return []client.Object {}, nil
291
292
}
292
293
}
@@ -320,11 +321,9 @@ func canPrune(dw dwv2.DevWorkspace, retainTime time.Duration, log logr.Logger) b
320
321
}
321
322
322
323
var startTime * metav1.Time
323
- for _ , condition := range dw .Status .Conditions {
324
- if condition .Type == conditions .Started {
325
- startTime = & condition .LastTransitionTime
326
- break
327
- }
324
+ startedCondition := conditions .GetConditionByType (dw .Status .Conditions , conditions .Started )
325
+ if startedCondition != nil {
326
+ startTime = & startedCondition .LastTransitionTime
328
327
}
329
328
if startTime == nil {
330
329
log .Info (fmt .Sprintf ("Skipping DevWorkspace '%s/%s': missing 'Started' condition" , dw .Namespace , dw .Name ))
0 commit comments