From 6aa39a411eb9fe5e62b54b0a3cf09225abe7d551 Mon Sep 17 00:00:00 2001 From: zlcnju Date: Thu, 27 Jun 2019 11:01:19 +0800 Subject: [PATCH] set annotation automatically when EnableGangScheduling is set to true[1032](https://github.com/kubeflow/tf-operator/pull/1032) (#181) --- pkg/controller.v1/pytorch/pod.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller.v1/pytorch/pod.go b/pkg/controller.v1/pytorch/pod.go index 1d2edc4d4..33a10e94a 100644 --- a/pkg/controller.v1/pytorch/pod.go +++ b/pkg/controller.v1/pytorch/pod.go @@ -222,6 +222,12 @@ func (pc *PyTorchController) createNewPod(job *pyv1.PyTorchJob, rtype pyv1.PyTor } else { podTemplate.Spec.SchedulerName = gangSchedulerName } + + if podTemplate.Annotations == nil { + podTemplate.Annotations = map[string]string{} + } + // we create the podGroup with the same name as the pyTorch job + podTemplate.Annotations["scheduling.k8s.io/group-name"] = job.Name } err = pc.PodControl.CreatePodsWithControllerRef(job.Namespace, podTemplate, job, controllerRef)