From 1abca01be5a38799c2b29a5abb1ee0e883e8629b Mon Sep 17 00:00:00 2001
From: lowang-bh <lhui_wang@163.com>
Date: Fri, 23 Jun 2023 13:24:14 +0800
Subject: [PATCH] remove duplicate code of add task spec annotation

Signed-off-by: lowang-bh <lhui_wang@163.com>
---
 pkg/controller.v1/mpi/mpijob.go                  | 3 ---
 pkg/controller.v1/mpi/mpijob_controller.go       | 6 ------
 pkg/controller.v1/tensorflow/tfjob_controller.go | 6 ------
 3 files changed, 15 deletions(-)

diff --git a/pkg/controller.v1/mpi/mpijob.go b/pkg/controller.v1/mpi/mpijob.go
index f51f68d9a7..c3cb459b81 100644
--- a/pkg/controller.v1/mpi/mpijob.go
+++ b/pkg/controller.v1/mpi/mpijob.go
@@ -73,9 +73,6 @@ const (
 	// podTemplateSchedulerNameReason is the warning reason when other scheduler name is set
 	// in pod templates with gang-scheduling enabled
 	podTemplateSchedulerNameReason = "SettedPodTemplateSchedulerName"
-
-	// volcanoTaskSpecKey task spec key used in pod annotation when EnableGangScheduling is true
-	volcanoTaskSpecKey = "volcano.sh/task-spec"
 )
 
 const (
diff --git a/pkg/controller.v1/mpi/mpijob_controller.go b/pkg/controller.v1/mpi/mpijob_controller.go
index 6108c644ec..b3af1baeb9 100644
--- a/pkg/controller.v1/mpi/mpijob_controller.go
+++ b/pkg/controller.v1/mpi/mpijob_controller.go
@@ -1024,9 +1024,6 @@ func (jc *MPIJobReconciler) newWorker(mpiJob *kubeflowv1.MPIJob, name string) *c
 
 		rtWorker := strings.ToLower(string(kubeflowv1.MPIJobReplicaTypeWorker))
 		jc.PodGroupControl.DecoratePodTemplateSpec(podSpec, mpiJob, rtWorker)
-		if jc.PodGroupControl.GetSchedulerName() == "volcano" {
-			podSpec.Annotations[volcanoTaskSpecKey] = rtWorker
-		}
 	}
 
 	return &corev1.Pod{
@@ -1076,9 +1073,6 @@ func (jc *MPIJobReconciler) newLauncher(mpiJob *kubeflowv1.MPIJob, kubectlDelive
 
 		rt := strings.ToLower(string(kubeflowv1.MPIJobReplicaTypeLauncher))
 		jc.PodGroupControl.DecoratePodTemplateSpec(podSpec, mpiJob, rt)
-		if jc.PodGroupControl.GetSchedulerName() == "volcano" {
-			podSpec.Annotations[volcanoTaskSpecKey] = rt
-		}
 	}
 
 	podSpec.Spec.ServiceAccountName = launcherName
diff --git a/pkg/controller.v1/tensorflow/tfjob_controller.go b/pkg/controller.v1/tensorflow/tfjob_controller.go
index 78565ed2a0..13b90f9cad 100644
--- a/pkg/controller.v1/tensorflow/tfjob_controller.go
+++ b/pkg/controller.v1/tensorflow/tfjob_controller.go
@@ -72,9 +72,6 @@ const (
 
 	controllerName = "tfjob-controller"
 
-	// volcanoTaskSpecKey task spec key used in pod annotation when EnableGangScheduling is true
-	volcanoTaskSpecKey = "volcano.sh/task-spec"
-
 	// tfConfig is the environment variable name of TensorFlow cluster spec.
 	tfConfig = "TF_CONFIG"
 	// exitedWithCodeReason is the normal reason when the pod is exited because of the exit code.
@@ -900,9 +897,6 @@ func (r *TFJobReconciler) createNewPod(tfjob *kubeflowv1.TFJob, rt, index string
 		}
 
 		r.PodGroupControl.DecoratePodTemplateSpec(podTemplate, tfjob, rt)
-		if gangSchedulerName == "volcano" {
-			podTemplate.Annotations[volcanoTaskSpecKey] = rt
-		}
 	}
 
 	err = r.PodControl.CreatePodsWithControllerRef(tfjob.Namespace, podTemplate, tfjob, controllerRef)