Skip to content

Commit

Permalink
Add delete condition
Browse files Browse the repository at this point in the history
  • Loading branch information
mvshao committed Sep 18, 2024
1 parent 7da7bbf commit 370ccfc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hack/runtime-cleanup/cmd/cleaner/cleaner.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ func (r RuntimeCleaner) removeOldRuntimes() error {
}

for _, runtimeObj := range runtimes.Items {
if isTimeForCleanup(runtimeObj) && isControlledByKIM(runtimeObj) {
if isTimeForCleanup(runtimeObj) && isControlledByKIM(runtimeObj) && runtimeObj.DeletionTimestamp == nil {
err := r.k8sClient.Delete(context.Background(), &runtimeObj)
if err != nil {
return err
}
r.log.Info("Runtime ", runtimeObj.Name, " was marked to be removed by KIM reconciler")
}
}
return nil
Expand Down

0 comments on commit 370ccfc

Please sign in to comment.