Skip to content

Commit

Permalink
Merge pull request #3599 from Wang-Kai/handle-job-not-found
Browse files Browse the repository at this point in the history
handle job not found case
  • Loading branch information
volcano-sh-bot authored Jul 17, 2024
2 parents 85494a9 + ba2f588 commit 33a9eb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controllers/garbagecollector/garbagecollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"volcano.sh/apis/pkg/apis/batch/v1alpha1"
vcclientset "volcano.sh/apis/pkg/client/clientset/versioned"
vcinformer "volcano.sh/apis/pkg/client/informers/externalversions"
Expand Down Expand Up @@ -232,7 +233,12 @@ func (gc *gccontroller) processJob(key string) error {
Preconditions: &metav1.Preconditions{UID: &fresh.UID},
}
klog.V(4).Infof("Cleaning up Job %s/%s", namespace, name)
return gc.vcClient.BatchV1alpha1().Jobs(fresh.Namespace).Delete(context.TODO(), fresh.Name, options)
err = gc.vcClient.BatchV1alpha1().Jobs(fresh.Namespace).Delete(context.TODO(), fresh.Name, options)
if apierrors.IsNotFound(err) {
// if the job had deleted, it will not be added to queue
return nil
}
return err
}

// processTTL checks whether a given Job's TTL has expired, and add it to the queue after the TTL is expected to expire
Expand Down

0 comments on commit 33a9eb5

Please sign in to comment.