Skip to content

Commit

Permalink
Remove uncalled mpi-controller DeletePodsAndServices() (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheimu committed May 1, 2022
1 parent c4b57f1 commit ce82602
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions pkg/controller.v1/mpi/mpijob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ce82602

Please sign in to comment.