@@ -681,7 +681,7 @@ func TestBuildPod(t *testing.T) {
681
681
worker := cluster .Spec .WorkerGroupSpecs [0 ]
682
682
podName = cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
683
683
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
684
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
684
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
685
685
pod = BuildPod (ctx , podTemplateSpec , rayv1 .WorkerNode , worker .RayStartParams , "6379" , false , utils .GetCRDType ("" ), fqdnRayIP )
686
686
687
687
// Check resources
@@ -752,7 +752,7 @@ func TestBuildPod_WithNoCPULimits(t *testing.T) {
752
752
worker := cluster .Spec .WorkerGroupSpecs [0 ]
753
753
podName = cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
754
754
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
755
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
755
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
756
756
pod = BuildPod (ctx , podTemplateSpec , rayv1 .WorkerNode , worker .RayStartParams , "6379" , false , utils .GetCRDType ("" ), fqdnRayIP )
757
757
expectedCommandArg = splitAndSort ("ulimit -n 65536; ray start --block --dashboard-agent-listen-port=52365 --memory=1073741824 --num-cpus=2 --num-gpus=3 --address=raycluster-sample-head-svc.default.svc.cluster.local:6379 --port=6379 --metrics-export-port=8080" )
758
758
actualCommandArg = splitAndSort (pod .Spec .Containers [0 ].Args [0 ])
@@ -783,7 +783,7 @@ func TestBuildPod_WithOverwriteCommand(t *testing.T) {
783
783
worker := cluster .Spec .WorkerGroupSpecs [0 ]
784
784
podName = cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
785
785
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
786
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
786
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
787
787
workerPod := BuildPod (ctx , podTemplateSpec , rayv1 .WorkerNode , worker .RayStartParams , "6379" , false , utils .GetCRDType ("" ), fqdnRayIP )
788
788
workerContainer := workerPod .Spec .Containers [utils .RayContainerIndex ]
789
789
assert .Equal (t , []string {"I am worker" }, workerContainer .Command )
@@ -838,7 +838,7 @@ func TestBuildPod_WithCreatedByRayService(t *testing.T) {
838
838
worker := cluster .Spec .WorkerGroupSpecs [0 ]
839
839
podName = cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
840
840
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
841
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
841
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
842
842
pod = BuildPod (ctx , podTemplateSpec , rayv1 .WorkerNode , worker .RayStartParams , "6379" , false , utils .RayServiceCRD , fqdnRayIP )
843
843
844
844
val , ok = pod .Labels [utils .RayClusterServingServiceLabelKey ]
@@ -894,7 +894,7 @@ func TestBuildPod_WithLoginBash(t *testing.T) {
894
894
worker := cluster .Spec .WorkerGroupSpecs [0 ]
895
895
podName = cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
896
896
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
897
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
897
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
898
898
workerPod := BuildPod (ctx , podTemplateSpec , rayv1 .WorkerNode , worker .RayStartParams , "6379" , false , utils .RayServiceCRD , fqdnRayIP )
899
899
900
900
// Verify worker container command
@@ -1157,7 +1157,7 @@ func TestDefaultWorkerPodTemplateWithName(t *testing.T) {
1157
1157
expectedWorker := * worker .DeepCopy ()
1158
1158
1159
1159
// Pass a deep copy of worker (*worker.DeepCopy()) to prevent "worker" from updating.
1160
- podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" )
1160
+ podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" , "" , 0 )
1161
1161
assert .Empty (t , podTemplateSpec .ObjectMeta .Name )
1162
1162
assert .Equal (t , expectedWorker , worker )
1163
1163
}
@@ -1204,7 +1204,7 @@ func TestDefaultWorkerPodTemplateWithConfigurablePorts(t *testing.T) {
1204
1204
worker := cluster .Spec .WorkerGroupSpecs [0 ]
1205
1205
podName := cluster .Name + utils .DashSymbol + string (rayv1 .WorkerNode ) + utils .DashSymbol + worker .GroupName + utils .DashSymbol + utils .FormatInt32 (0 )
1206
1206
fqdnRayIP := utils .GenerateFQDNServiceName (ctx , * cluster , cluster .Namespace )
1207
- podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
1207
+ podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
1208
1208
// DefaultWorkerPodTemplate will add the default metrics port if user doesn't specify it.
1209
1209
// Verify the default metrics port exists.
1210
1210
require .NoError (t , containerPortExists (podTemplateSpec .Spec .Containers [0 ].Ports , int32 (utils .DefaultMetricsPort )))
@@ -1214,7 +1214,7 @@ func TestDefaultWorkerPodTemplateWithConfigurablePorts(t *testing.T) {
1214
1214
ContainerPort : customMetricsPort ,
1215
1215
}
1216
1216
cluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .Containers [0 ].Ports = []corev1.ContainerPort {metricsPort }
1217
- podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" )
1217
+ podTemplateSpec = DefaultWorkerPodTemplate (ctx , * cluster , worker , podName , fqdnRayIP , "6379" , "" , 0 )
1218
1218
// Verify the custom metrics port exists.
1219
1219
require .NoError (t , containerPortExists (podTemplateSpec .Spec .Containers [0 ].Ports , customMetricsPort ))
1220
1220
}
@@ -1253,7 +1253,7 @@ func TestDefaultWorkerPodTemplate_Autoscaling(t *testing.T) {
1253
1253
1254
1254
for name , tc := range tests {
1255
1255
t .Run (name , func (t * testing.T ) {
1256
- podTemplateSpec := DefaultWorkerPodTemplate (ctx , tc .cluster , tc .cluster .Spec .WorkerGroupSpecs [0 ], podName , fqdnRayIP , "6379" )
1256
+ podTemplateSpec := DefaultWorkerPodTemplate (ctx , tc .cluster , tc .cluster .Spec .WorkerGroupSpecs [0 ], podName , fqdnRayIP , "6379" , "" , 0 )
1257
1257
assert .Equal (t , tc .expectedRestartPolicy , podTemplateSpec .Spec .RestartPolicy )
1258
1258
})
1259
1259
}
@@ -1269,7 +1269,7 @@ func TestDefaultInitContainer(t *testing.T) {
1269
1269
expectedResult := len (cluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers ) + 1
1270
1270
1271
1271
// Pass a deep copy of worker (*worker.DeepCopy()) to prevent "worker" from updating.
1272
- podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" )
1272
+ podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" , "" , 0 )
1273
1273
numInitContainers := len (podTemplateSpec .Spec .InitContainers )
1274
1274
assert .Equal (t , expectedResult , numInitContainers , "A default init container is expected to be added." )
1275
1275
@@ -1328,7 +1328,7 @@ func TestDefaultInitContainerImagePullPolicy(t *testing.T) {
1328
1328
// set ray container imagePullPolicy
1329
1329
worker .Template .Spec .Containers [utils .RayContainerIndex ].ImagePullPolicy = tc .imagePullPolicy
1330
1330
1331
- podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" )
1331
+ podTemplateSpec := DefaultWorkerPodTemplate (ctx , * cluster , * worker .DeepCopy (), podName , fqdnRayIP , "6379" , "" , 0 )
1332
1332
1333
1333
healthCheckContainer := podTemplateSpec .Spec .InitContainers [len (podTemplateSpec .Spec .InitContainers )- 1 ]
1334
1334
assert .Equal (t , tc .expectedPullPolicy , healthCheckContainer .ImagePullPolicy , "The ImagePullPolicy of the init container should be the same as the Ray container." )
0 commit comments