@@ -110,7 +110,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
110110 rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .Volumes = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .Volumes , caVol , withVolumeName (caVol .Name ))
111111 }
112112 // Append the create-cert Init Container
113- rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (rayCluster ), withContainerName (initContainerName ))
113+ rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), withContainerName (initContainerName ))
114114
115115 }
116116
@@ -143,7 +143,11 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
143143 allErrors = append (allErrors , validateOAuthProxyContainer (rayCluster )... )
144144 allErrors = append (allErrors , validateOAuthProxyVolume (rayCluster )... )
145145 allErrors = append (allErrors , validateHeadGroupServiceAccountName (rayCluster )... )
146-
146+ // Init Container related errors
147+ allErrors = append (allErrors , w .validateHeadInitContainer (rayCluster )... )
148+ allErrors = append (allErrors , w .validateWorkerInitContainer (rayCluster )... )
149+ allErrors = append (allErrors , validateEnvVars (rayCluster )... )
150+ allErrors = append (allErrors , validateCaVolumes (rayCluster )... )
147151 return warnings , allErrors .ToAggregate ()
148152}
149153
@@ -338,7 +342,7 @@ func (w *rayClusterWebhook) rayHeadInitContainer(rayCluster *rayv1.RayCluster) c
338342 return initContainerHead
339343}
340344
341- func rayWorkerInitContainer (rayCluster * rayv1. RayCluster ) corev1.Container {
345+ func rayWorkerInitContainer () corev1.Container {
342346 initContainerWorker := corev1.Container {
343347 Name : "create-cert" ,
344348 Image : "quay.io/project-codeflare/ray:latest-py39-cu118" ,
@@ -367,7 +371,7 @@ func (w *rayClusterWebhook) validateHeadInitContainer(rayCluster *rayv1.RayClust
367371func (w * rayClusterWebhook ) validateWorkerInitContainer (rayCluster * rayv1.RayCluster ) field.ErrorList {
368372 var allErrors field.ErrorList
369373
370- if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (rayCluster ), byContainerName ,
374+ if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), byContainerName ,
371375 field .NewPath ("spec" , "workerGroupSpecs" , "0" , "template" , "spec" , "initContainers" ),
372376 "create-cert Init Container is immutable" ); err != nil {
373377 allErrors = append (allErrors , err )
0 commit comments