diff --git a/pkg/apis/common/v1/interface.go b/pkg/apis/common/v1/interface.go index 7108463a..c897f625 100644 --- a/pkg/apis/common/v1/interface.go +++ b/pkg/apis/common/v1/interface.go @@ -63,7 +63,7 @@ type ControllerInterface interface { // ReconcilePods checks and updates pods for each given ReplicaSpec. // It will requeue the job in case of an error while creating/deleting pods. // Common implementation will be provided and User can still override this to implement their own reconcile logic - ReconcilePods(job interface{}, jobStatus *JobStatus, pods []*v1.Pod, rtype string, spec *ReplicaSpec, + ReconcilePods(job interface{}, jobStatus *JobStatus, pods []*v1.Pod, rtype ReplicaType, spec *ReplicaSpec, replicas map[ReplicaType]*ReplicaSpec) error // ReconcileServices checks and updates services for each given ReplicaSpec. diff --git a/pkg/controller.v1/common/job.go b/pkg/controller.v1/common/job.go index 0662b31b..ae692329 100644 --- a/pkg/controller.v1/common/job.go +++ b/pkg/controller.v1/common/job.go @@ -270,7 +270,7 @@ func (jc *JobController) ReconcileJobs( // Diff current active pods/services with replicas. for rtype, spec := range replicas { - err := jc.Controller.ReconcilePods(metaObject, &jobStatus, pods, string(rtype), spec, replicas) + err := jc.Controller.ReconcilePods(metaObject, &jobStatus, pods, rtype, spec, replicas) if err != nil { log.Warnf("ReconcilePods error %v", err) return err diff --git a/pkg/controller.v1/common/pod.go b/pkg/controller.v1/common/pod.go index 23baf812..920e1038 100644 --- a/pkg/controller.v1/common/pod.go +++ b/pkg/controller.v1/common/pod.go @@ -271,10 +271,11 @@ func (jc *JobController) ReconcilePods( job interface{}, jobStatus *apiv1.JobStatus, pods []*v1.Pod, - rtype string, + rType apiv1.ReplicaType, spec *apiv1.ReplicaSpec, replicas map[apiv1.ReplicaType]*apiv1.ReplicaSpec) error { + rtype := string(rType) metaObject, ok := job.(metav1.Object) if !ok { return fmt.Errorf("job is not a metav1.Object type") diff --git a/pkg/reconciler.v1/common/interface.go b/pkg/reconciler.v1/common/interface.go index 62379f7e..edaad53f 100644 --- a/pkg/reconciler.v1/common/interface.go +++ b/pkg/reconciler.v1/common/interface.go @@ -108,7 +108,7 @@ type PodInterface interface { job client.Object, jobStatus *commonv1.JobStatus, pods []*corev1.Pod, - rtype string, + rtype commonv1.ReplicaType, spec *commonv1.ReplicaSpec, replicas map[commonv1.ReplicaType]*commonv1.ReplicaSpec) error diff --git a/pkg/reconciler.v1/common/job.go b/pkg/reconciler.v1/common/job.go index c5ed6823..2779bb31 100644 --- a/pkg/reconciler.v1/common/job.go +++ b/pkg/reconciler.v1/common/job.go @@ -236,7 +236,7 @@ func (r *KubeflowJobReconciler) ReconcileJob( for rtype, spec := range replicas { core.InitializeReplicaStatuses(status, string(rtype)) - err = r.ReconcilePods(ctx, job, status, pods, string(rtype), spec, replicas) + err = r.ReconcilePods(ctx, job, status, pods, rtype, spec, replicas) if err != nil { logrus.Warnf(ErrReconcilePodsTemplate, err) return err diff --git a/pkg/reconciler.v1/common/pod.go b/pkg/reconciler.v1/common/pod.go index 3f7965db..2c0299e1 100644 --- a/pkg/reconciler.v1/common/pod.go +++ b/pkg/reconciler.v1/common/pod.go @@ -120,10 +120,11 @@ func (r *KubeflowPodReconciler) ReconcilePods( job client.Object, jobStatus *commonv1.JobStatus, pods []*corev1.Pod, - rtype string, + rType commonv1.ReplicaType, spec *commonv1.ReplicaSpec, replicas map[commonv1.ReplicaType]*commonv1.ReplicaSpec) error { + rtype := string(rType) // Convert ReplicaType to lower string. logger := commonutil.LoggerForReplica(job, rtype) // Get all pods for the type rt.