Skip to content

Commit 7870db7

Browse files
committed
Cleanup after rebase
1 parent 23c8dcc commit 7870db7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/controllers/raycluster_webhook.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
106106
rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.Volumes = upsert(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.Volumes, caVol, withVolumeName(caVol.Name))
107107
}
108108
// 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))
110110

111111
}
112112

@@ -149,6 +149,13 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
149149
allErrors = append(allErrors, validateHeadGroupServiceAccountName(rayCluster)...)
150150
}
151151

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+
}
152159
return warnings, allErrors.ToAggregate()
153160
}
154161

@@ -343,7 +350,7 @@ func (w *rayClusterWebhook) rayHeadInitContainer(rayCluster *rayv1.RayCluster) c
343350
return initContainerHead
344351
}
345352

346-
func rayWorkerInitContainer(rayCluster *rayv1.RayCluster) corev1.Container {
353+
func rayWorkerInitContainer() corev1.Container {
347354
initContainerWorker := corev1.Container{
348355
Name: "create-cert",
349356
Image: "quay.io/project-codeflare/ray:latest-py39-cu118",
@@ -372,7 +379,7 @@ func (w *rayClusterWebhook) validateHeadInitContainer(rayCluster *rayv1.RayClust
372379
func (w *rayClusterWebhook) validateWorkerInitContainer(rayCluster *rayv1.RayCluster) field.ErrorList {
373380
var allErrors field.ErrorList
374381

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,
376383
field.NewPath("spec", "workerGroupSpecs", "0", "template", "spec", "initContainers"),
377384
"create-cert Init Container is immutable"); err != nil {
378385
allErrors = append(allErrors, err)

0 commit comments

Comments
 (0)