From 3d9e7c8a9f18fd3cc6b59065bdfaa083b8520dc9 Mon Sep 17 00:00:00 2001 From: jiangkaihua <54176503+jiangkaihua@users.noreply.github.com> Date: Fri, 2 Apr 2021 18:24:20 +0800 Subject: [PATCH] Add task type annotation for pods when EnableGangScheduling is true. (#1268) Signed-off-by: jiangkaihua --- pkg/controller.v1/tensorflow/controller.go | 2 ++ pkg/controller.v1/tensorflow/pod.go | 1 + 2 files changed, 3 insertions(+) diff --git a/pkg/controller.v1/tensorflow/controller.go b/pkg/controller.v1/tensorflow/controller.go index 344cf4b4cb..6e2d08cb1a 100644 --- a/pkg/controller.v1/tensorflow/controller.go +++ b/pkg/controller.v1/tensorflow/controller.go @@ -55,6 +55,8 @@ const ( labelGroupName = "group-name" // Deprecated label for backwards compatibility. Has to be removed labelTFJobName = "tf-job-name" + // volcanoTaskSpecKey task spec key used in pod annotation when EnableGangScheduling is true + volcanoTaskSpecKey = "volcano.sh/task-spec" ) var ( diff --git a/pkg/controller.v1/tensorflow/pod.go b/pkg/controller.v1/tensorflow/pod.go index 1e69ba398f..4c9e8831d5 100644 --- a/pkg/controller.v1/tensorflow/pod.go +++ b/pkg/controller.v1/tensorflow/pod.go @@ -228,6 +228,7 @@ func (tc *TFController) createNewPod(tfjob *tfv1.TFJob, rt, index string, spec * podTemplate.Annotations = map[string]string{} } podTemplate.Annotations[gangSchedulingPodGroupAnnotation] = tfjob.GetName() + podTemplate.Annotations[volcanoTaskSpecKey] = rt } err = tc.PodControl.CreatePodsWithControllerRef(tfjob.Namespace, podTemplate, tfjob, controllerRef)