From 88eff9c16c4c4a4756a439d6a719305bb80d3359 Mon Sep 17 00:00:00 2001 From: Daniel Vega-Myhre Date: Thu, 9 May 2024 02:11:40 +0000 Subject: [PATCH] don't reconcile jobsets with deletion timestamp set --- pkg/controllers/jobset_controller.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/controllers/jobset_controller.go b/pkg/controllers/jobset_controller.go index e9b2020b..36b54187 100644 --- a/pkg/controllers/jobset_controller.go +++ b/pkg/controllers/jobset_controller.go @@ -103,6 +103,11 @@ func (r *JobSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr return ctrl.Result{}, client.IgnoreNotFound(err) } + // Don't reconcile JobSets marked for deletion. + if jobSetMarkedForDeletion(&js) { + return ctrl.Result{}, nil + } + // Track JobSet status updates that should be performed at the end of the reconciliation attempt. updateStatusOpts := statusUpdateOpts{} @@ -816,6 +821,10 @@ func jobSetFinished(js *jobset.JobSet) bool { return false } +func jobSetMarkedForDeletion(js *jobset.JobSet) bool { + return js.DeletionTimestamp != nil +} + func dnsHostnamesEnabled(js *jobset.JobSet) bool { return js.Spec.Network.EnableDNSHostnames != nil && *js.Spec.Network.EnableDNSHostnames }