@@ -88,7 +88,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
8888 }
8989
9090 // Append the create-cert Init Container
91- rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers = upsert (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , w . rayHeadInitContainer (rayCluster ), withContainerName (initContainerName ))
91+ rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers = upsert (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , w ), withContainerName (initContainerName ))
9292
9393 // Append the CA volumes
9494 for _ , caVol := range caVolumes (rayCluster ) {
@@ -151,7 +151,7 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
151151
152152 // Init Container related errors
153153 if ptr .Deref (w .Config .MTLSEnabled , true ) {
154- allErrors = append (allErrors , w . validateHeadInitContainer (rayCluster )... )
154+ allErrors = append (allErrors , validateHeadInitContainer (rayCluster , w )... )
155155 allErrors = append (allErrors , validateWorkerInitContainer (rayCluster )... )
156156 allErrors = append (allErrors , validateHeadEnvVars (rayCluster )... )
157157 allErrors = append (allErrors , validateWorkerEnvVars (rayCluster )... )
@@ -333,7 +333,7 @@ func caVolumes(rayCluster *rayv1.RayCluster) []corev1.Volume {
333333 return caVolumes
334334}
335335
336- func ( w * rayClusterWebhook ) rayHeadInitContainer (rayCluster * rayv1.RayCluster ) corev1.Container {
336+ func rayHeadInitContainer (rayCluster * rayv1.RayCluster , w * rayClusterWebhook ) corev1.Container {
337337 rayClientRoute := "rayclient-" + rayCluster .Name + "-" + rayCluster .Namespace + "." + w .Config .IngressDomain
338338 // Service name for basic interactive
339339 svcDomain := rayCluster .Name + "-head-svc." + rayCluster .Namespace + ".svc"
@@ -365,10 +365,10 @@ func rayWorkerInitContainer() corev1.Container {
365365 return initContainerWorker
366366}
367367
368- func ( w * rayClusterWebhook ) validateHeadInitContainer (rayCluster * rayv1.RayCluster ) field.ErrorList {
368+ func validateHeadInitContainer (rayCluster * rayv1.RayCluster , w * rayClusterWebhook ) field.ErrorList {
369369 var allErrors field.ErrorList
370370
371- if err := contains (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , w . rayHeadInitContainer (rayCluster ), byContainerName ,
371+ if err := contains (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , w ), byContainerName ,
372372 field .NewPath ("spec" , "headGroupSpec" , "template" , "spec" , "initContainers" ),
373373 "create-cert Init Container is immutable" ); err != nil {
374374 allErrors = append (allErrors , err )
0 commit comments