@@ -87,7 +87,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
87
87
}
88
88
89
89
// Append the create-cert Init Container
90
- rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers = upsert (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , w .Config .IngressDomain ), withContainerName (initContainerName ))
90
+ rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers = upsert (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , w .Config .IngressDomain , w . Config . CertGeneratorImage ), withContainerName (initContainerName ))
91
91
92
92
// Append the CA volumes
93
93
for _ , caVol := range caVolumes (rayCluster ) {
@@ -117,7 +117,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
117
117
}
118
118
119
119
// Append the create-cert Init Container
120
- rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), withContainerName (initContainerName ))
120
+ rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers = upsert (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (w . Config . CertGeneratorImage ), withContainerName (initContainerName ))
121
121
}
122
122
123
123
return nil
@@ -161,8 +161,8 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
161
161
162
162
// Init Container related errors
163
163
if ptr .Deref (w .Config .MTLSEnabled , true ) {
164
- allErrors = append (allErrors , validateHeadInitContainer (rayCluster , w .Config .IngressDomain )... )
165
- allErrors = append (allErrors , validateWorkerInitContainer (rayCluster )... )
164
+ allErrors = append (allErrors , validateHeadInitContainer (rayCluster , w .Config .IngressDomain , w . Config . CertGeneratorImage )... )
165
+ allErrors = append (allErrors , validateWorkerInitContainer (rayCluster , w . Config . CertGeneratorImage )... )
166
166
allErrors = append (allErrors , validateHeadEnvVars (rayCluster )... )
167
167
allErrors = append (allErrors , validateWorkerEnvVars (rayCluster )... )
168
168
allErrors = append (allErrors , validateCaVolumes (rayCluster )... )
@@ -339,14 +339,14 @@ func caVolumes(rayCluster *rayv1.RayCluster) []corev1.Volume {
339
339
}
340
340
}
341
341
342
- func rayHeadInitContainer (rayCluster * rayv1.RayCluster , domain string ) corev1.Container {
342
+ func rayHeadInitContainer (rayCluster * rayv1.RayCluster , domain string , certGeneratorImage string ) corev1.Container {
343
343
rayClientRoute := "rayclient-" + rayCluster .Name + "-" + rayCluster .Namespace + "." + domain
344
344
// Service name for basic interactive
345
345
svcDomain := rayCluster .Name + "-head-svc." + rayCluster .Namespace + ".svc"
346
346
347
347
initContainerHead := corev1.Container {
348
348
Name : "create-cert" ,
349
- Image : "quay.io/project-codeflare/ray:latest-py39-cu118" ,
349
+ Image : certGeneratorImage ,
350
350
Command : []string {
351
351
"sh" ,
352
352
"-c" ,
@@ -357,10 +357,10 @@ func rayHeadInitContainer(rayCluster *rayv1.RayCluster, domain string) corev1.Co
357
357
return initContainerHead
358
358
}
359
359
360
- func rayWorkerInitContainer () corev1.Container {
360
+ func rayWorkerInitContainer (certGeneratorImage string ) corev1.Container {
361
361
initContainerWorker := corev1.Container {
362
362
Name : "create-cert" ,
363
- Image : "quay.io/project-codeflare/ray:latest-py39-cu118" ,
363
+ Image : certGeneratorImage ,
364
364
Command : []string {
365
365
"sh" ,
366
366
"-c" ,
@@ -371,10 +371,10 @@ func rayWorkerInitContainer() corev1.Container {
371
371
return initContainerWorker
372
372
}
373
373
374
- func validateHeadInitContainer (rayCluster * rayv1.RayCluster , domain string ) field.ErrorList {
374
+ func validateHeadInitContainer (rayCluster * rayv1.RayCluster , domain string , certGeneratorImage string ) field.ErrorList {
375
375
var allErrors field.ErrorList
376
376
377
- if err := contains (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , domain ), byContainerName ,
377
+ if err := contains (rayCluster .Spec .HeadGroupSpec .Template .Spec .InitContainers , rayHeadInitContainer (rayCluster , domain , certGeneratorImage ), byContainerName ,
378
378
field .NewPath ("spec" , "headGroupSpec" , "template" , "spec" , "initContainers" ),
379
379
"create-cert Init Container is immutable" ); err != nil {
380
380
allErrors = append (allErrors , err )
@@ -383,10 +383,10 @@ func validateHeadInitContainer(rayCluster *rayv1.RayCluster, domain string) fiel
383
383
return allErrors
384
384
}
385
385
386
- func validateWorkerInitContainer (rayCluster * rayv1.RayCluster ) field.ErrorList {
386
+ func validateWorkerInitContainer (rayCluster * rayv1.RayCluster , certGeneratorImage string ) field.ErrorList {
387
387
var allErrors field.ErrorList
388
388
389
- if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (), byContainerName ,
389
+ if err := contains (rayCluster .Spec .WorkerGroupSpecs [0 ].Template .Spec .InitContainers , rayWorkerInitContainer (certGeneratorImage ), byContainerName ,
390
390
field .NewPath ("spec" , "workerGroupSpecs" , "0" , "template" , "spec" , "initContainers" ),
391
391
"create-cert Init Container is immutable" ); err != nil {
392
392
allErrors = append (allErrors , err )
0 commit comments