From d746bde980e7fbf480a8978cd90856d18b0240f1 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 24 Jun 2019 06:05:54 +0200 Subject: [PATCH] set annotation automatically when EnableGangScheduling is set to true (#1032) --- pkg/controller.v1/tensorflow/pod.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller.v1/tensorflow/pod.go b/pkg/controller.v1/tensorflow/pod.go index dd3757fcb1..219774633c 100644 --- a/pkg/controller.v1/tensorflow/pod.go +++ b/pkg/controller.v1/tensorflow/pod.go @@ -192,6 +192,12 @@ func (tc *TFController) createNewPod(tfjob *tfv1.TFJob, rt, index string, spec * } else { podTemplate.Spec.SchedulerName = gangSchedulerName } + + if podTemplate.Annotations == nil { + podTemplate.Annotations = map[string]string{} + } + // we create the podGroup with the same name as the tfjob + podTemplate.Annotations["scheduling.k8s.io/group-name"] = tfjob.Name } err = tc.PodControl.CreatePodsWithControllerRef(tfjob.Namespace, podTemplate, tfjob, controllerRef)