@@ -329,6 +329,12 @@ func DefaultWorkerPodTemplate(ctx context.Context, instance rayv1.RayCluster, wo
329329 mergedLabels := mergeLabels (workerSpec .Template .ObjectMeta .Labels , workerSpec .Labels )
330330 podTemplate .Labels = labelPod (rayv1 .WorkerNode , instance .Name , workerSpec .GroupName , mergedLabels )
331331
332+ // Add additional labels for RayMultihostIndexing
333+ multihostIndexingEnabled := features .Enabled (features .RayMultiHostIndexing ) && workerSpec .NumOfHosts > 1
334+ if multihostIndexingEnabled {
335+ podTemplate .Labels [utils .RayWorkerReplicaIndexKey ] = replicaGrpName
336+ podTemplate .Labels [utils .RayHostIndexKey ] = strconv .Itoa (numHostIndex )
337+ }
332338 workerSpec .RayStartParams = setMissingRayStartParams (ctx , workerSpec .RayStartParams , rayv1 .WorkerNode , headPort , fqdnRayIP )
333339
334340 initTemplateAnnotations (instance , & podTemplate )
@@ -642,15 +648,6 @@ func labelPod(rayNodeType rayv1.RayNodeType, rayClusterName string, groupName st
642648 return labels
643649}
644650
645- // addMultihostIndexingPodLabels returns labels that contain RayMultihostIndexing feature labels
646- func addMultihostIndexingPodLabels (currentLabels map [string ]string , replicaGrpName string , numHostIndex int ) map [string ]string {
647- labels := currentLabels
648- labels [utils .RayWorkerReplicaIndexKey ] = replicaGrpName
649- labels [utils .RayHostIndexKey ] = strconv .Itoa (numHostIndex )
650-
651- return labels
652- }
653-
654651func setInitContainerEnvVars (container * corev1.Container , fqdnRayIP string ) {
655652 if len (container .Env ) == 0 {
656653 container .Env = []corev1.EnvVar {}
0 commit comments