@@ -106,7 +106,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
106
106
rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .Volumes = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .Volumes , caVol , withVolumeName (caVol .Name ))
107
107
}
108
108
// Append the create-cert Init Container
109
- rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (rayCluster ), withContainerName (initContainerName ))
109
+ rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), withContainerName (initContainerName ))
110
110
111
111
}
112
112
@@ -149,6 +149,13 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
149
149
allErrors = append (allErrors , validateHeadGroupServiceAccountName (rayCluster )... )
150
150
}
151
151
152
+ // Init Container related errors
153
+ if ptr .Deref (w .Config .MTLSEnabled , true ) {
154
+ allErrors = append (allErrors , w .validateHeadInitContainer (rayCluster )... )
155
+ allErrors = append (allErrors , w .validateWorkerInitContainer (rayCluster )... )
156
+ allErrors = append (allErrors , validateEnvVars (rayCluster )... )
157
+ allErrors = append (allErrors , validateCaVolumes (rayCluster )... )
158
+ }
152
159
return warnings , allErrors .ToAggregate ()
153
160
}
154
161
@@ -343,7 +350,7 @@ func (w *rayClusterWebhook) rayHeadInitContainer(rayCluster *rayv1.RayCluster) c
343
350
return initContainerHead
344
351
}
345
352
346
- func rayWorkerInitContainer (rayCluster * rayv1. RayCluster ) corev1.Container {
353
+ func rayWorkerInitContainer () corev1.Container {
347
354
initContainerWorker := corev1.Container {
348
355
Name : "create-cert" ,
349
356
Image : "quay.io/project-codeflare/ray:latest-py39-cu118" ,
@@ -372,7 +379,7 @@ func (w *rayClusterWebhook) validateHeadInitContainer(rayCluster *rayv1.RayClust
372
379
func (w * rayClusterWebhook ) validateWorkerInitContainer (rayCluster * rayv1.RayCluster ) field.ErrorList {
373
380
var allErrors field.ErrorList
374
381
375
- if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (rayCluster ), byContainerName ,
382
+ if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), byContainerName ,
376
383
field .NewPath ("spec" , "workerGroupSpecs" , "0" , "template" , "spec" , "initContainers" ),
377
384
"create-cert Init Container is immutable" ); err != nil {
378
385
allErrors = append (allErrors , err )
0 commit comments