@@ -88,7 +88,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
88
88
}
89
89
90
90
// 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 ))
92
92
93
93
// Append the CA volumes
94
94
for _ , caVol := range caVolumes (rayCluster ) {
@@ -151,7 +151,7 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
151
151
152
152
// Init Container related errors
153
153
if ptr .Deref (w .Config .MTLSEnabled , true ) {
154
- allErrors = append (allErrors , w . validateHeadInitContainer (rayCluster )... )
154
+ allErrors = append (allErrors , validateHeadInitContainer (rayCluster , w )... )
155
155
allErrors = append (allErrors , validateWorkerInitContainer (rayCluster )... )
156
156
allErrors = append (allErrors , validateHeadEnvVars (rayCluster )... )
157
157
allErrors = append (allErrors , validateWorkerEnvVars (rayCluster )... )
@@ -333,7 +333,7 @@ func caVolumes(rayCluster *rayv1.RayCluster) []corev1.Volume {
333
333
return caVolumes
334
334
}
335
335
336
- func ( w * rayClusterWebhook ) rayHeadInitContainer (rayCluster * rayv1.RayCluster ) corev1.Container {
336
+ func rayHeadInitContainer (rayCluster * rayv1.RayCluster , w * rayClusterWebhook ) corev1.Container {
337
337
rayClientRoute := "rayclient-" + rayCluster .Name + "-" + rayCluster .Namespace + "." + w .Config .IngressDomain
338
338
// Service name for basic interactive
339
339
svcDomain := rayCluster .Name + "-head-svc." + rayCluster .Namespace + ".svc"
@@ -365,10 +365,10 @@ func rayWorkerInitContainer() corev1.Container {
365
365
return initContainerWorker
366
366
}
367
367
368
- func ( w * rayClusterWebhook ) validateHeadInitContainer (rayCluster * rayv1.RayCluster ) field.ErrorList {
368
+ func validateHeadInitContainer (rayCluster * rayv1.RayCluster , w * rayClusterWebhook ) field.ErrorList {
369
369
var allErrors field.ErrorList
370
370
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 ,
372
372
field .NewPath ("spec" , "headGroupSpec" , "template" , "spec" , "initContainers" ),
373
373
"create-cert Init Container is immutable" ); err != nil {
374
374
allErrors = append (allErrors , err )
0 commit comments