diff --git a/pkg/apis/mpi/v1/default.go b/pkg/apis/mpi/v1/default.go index 81abf4ab4a..0eb97af615 100644 --- a/pkg/apis/mpi/v1/default.go +++ b/pkg/apis/mpi/v1/default.go @@ -50,6 +50,11 @@ func SetDefaults_MPIJob(mpiJob *MPIJob) { mpiJob.Spec.CleanPodPolicy = &none } + if mpiJob.Spec.RunPolicy.CleanPodPolicy == nil { + none := common.CleanPodPolicyNone + mpiJob.Spec.RunPolicy.CleanPodPolicy = &none + } + // set default to Launcher setDefaultsTypeLauncher(mpiJob.Spec.MPIReplicaSpecs[MPIReplicaTypeLauncher]) diff --git a/pkg/controller.v1/mpi/mpijob_controller_test.go b/pkg/controller.v1/mpi/mpijob_controller_test.go index cb427e091a..52726020a6 100644 --- a/pkg/controller.v1/mpi/mpijob_controller_test.go +++ b/pkg/controller.v1/mpi/mpijob_controller_test.go @@ -47,7 +47,9 @@ func newMPIJobCommon(name string, startTime, completionTime *metav1.Time) *kubef Namespace: metav1.NamespaceDefault, }, Spec: kubeflow.MPIJobSpec{ - CleanPodPolicy: &cleanPodPolicyAll, + RunPolicy: common.RunPolicy{ + CleanPodPolicy: &cleanPodPolicyAll, + }, MPIReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ kubeflow.MPIReplicaTypeWorker: { Template: corev1.PodTemplateSpec{