From 037337187afcf871dddd229dc49585be3810b082 Mon Sep 17 00:00:00 2001 From: tenzen-y Date: Fri, 8 Dec 2023 22:46:46 +0900 Subject: [PATCH] Fix a bug that the failed to inject nodeSelectors to KubeflowJobs Signed-off-by: tenzen-y --- .../jobs/kubeflow/kubeflowjob/kubeflowjob_controller.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/controller/jobs/kubeflow/kubeflowjob/kubeflowjob_controller.go b/pkg/controller/jobs/kubeflow/kubeflowjob/kubeflowjob_controller.go index fd6bdcf1df..03648d9f52 100644 --- a/pkg/controller/jobs/kubeflow/kubeflowjob/kubeflowjob_controller.go +++ b/pkg/controller/jobs/kubeflow/kubeflowjob/kubeflowjob_controller.go @@ -62,11 +62,10 @@ func (j *KubeflowJob) RunWithPodSetsInfo(podSetsInfo []podset.PodSetInfo) error for index := range podSetsInfo { replicaType := orderedReplicaTypes[index] info := podSetsInfo[index] - replica := &j.KFJobControl.ReplicaSpecs()[replicaType].Template - if err := podset.Merge(&replica.ObjectMeta, &replica.Spec, info); err != nil { + err := podset.Merge(&j.KFJobControl.ReplicaSpecs()[replicaType].Template.ObjectMeta, &j.KFJobControl.ReplicaSpecs()[replicaType].Template.Spec, info) + if err != nil { return err } - } return nil } @@ -76,8 +75,7 @@ func (j *KubeflowJob) RestorePodSetsInfo(podSetsInfo []podset.PodSetInfo) bool { changed := false for index, info := range podSetsInfo { replicaType := orderedReplicaTypes[index] - replica := &j.KFJobControl.ReplicaSpecs()[replicaType].Template - changed = podset.RestorePodSpec(&replica.ObjectMeta, &replica.Spec, info) || changed + changed = podset.RestorePodSpec(&j.KFJobControl.ReplicaSpecs()[replicaType].Template.ObjectMeta, &j.KFJobControl.ReplicaSpecs()[replicaType].Template.Spec, info) || changed } return changed }