From ce82602697d6d4e45d8ac88b50e0d22a6aa39b63 Mon Sep 17 00:00:00 2001 From: Cheimu Date: Sun, 1 May 2022 09:44:24 +0800 Subject: [PATCH] Remove uncalled mpi-controller DeletePodsAndServices() (#1558) --- pkg/controller.v1/mpi/mpijob_controller.go | 25 ---------------------- 1 file changed, 25 deletions(-) diff --git a/pkg/controller.v1/mpi/mpijob_controller.go b/pkg/controller.v1/mpi/mpijob_controller.go index 355e480cc7..9fef70e989 100644 --- a/pkg/controller.v1/mpi/mpijob_controller.go +++ b/pkg/controller.v1/mpi/mpijob_controller.go @@ -237,31 +237,6 @@ func (jc *MPIJobReconciler) SetupWithManager(mgr ctrl.Manager) error { return nil } -// DeletePodsAndServices is overridden because mpi-reconciler.v1 needs not deleting services -func (jc *MPIJobReconciler) DeletePodsAndServices(runPolicy *commonv1.RunPolicy, job interface{}, pods []*corev1.Pod) error { - if len(pods) == 0 { - return nil - } - - // Delete nothing when the cleanPodPolicy is None. - if *runPolicy.CleanPodPolicy == commonv1.CleanPodPolicyNone { - return nil - } - - for _, pod := range pods { - // Note that pending pod will turn into running once schedulable, - // not cleaning it may leave orphan running pod in the future, - // we should treat it equivalent to running phase here. - if *runPolicy.CleanPodPolicy == commonv1.CleanPodPolicyRunning && pod.Status.Phase != corev1.PodRunning && pod.Status.Phase != corev1.PodPending { - continue - } - if err := jc.PodControl.DeletePod(pod.Namespace, pod.Name, job.(runtime.Object)); err != nil { - return err - } - } - return nil -} - // ReconcileServices is overridden because mpi-reconciler.v1 does not need to reconcile services func (jc *MPIJobReconciler) ReconcileServices( job metav1.Object,