Skip to content

Commit

Permalink
Cleanup after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 committed Apr 18, 2024
1 parent 06d83b1 commit f44b2b9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/controllers/raycluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.Volumes = upsert(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.Volumes, caVol, withVolumeName(caVol.Name))
}
// Append the create-cert Init Container
rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers = upsert(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers, rayWorkerInitContainer(rayCluster), withContainerName(initContainerName))
rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers = upsert(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers, rayWorkerInitContainer(), withContainerName(initContainerName))

}

Expand Down Expand Up @@ -143,7 +143,11 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
allErrors = append(allErrors, validateOAuthProxyContainer(rayCluster)...)
allErrors = append(allErrors, validateOAuthProxyVolume(rayCluster)...)
allErrors = append(allErrors, validateHeadGroupServiceAccountName(rayCluster)...)

// Init Container related errors
allErrors = append(allErrors, w.validateHeadInitContainer(rayCluster)...)
allErrors = append(allErrors, w.validateWorkerInitContainer(rayCluster)...)
allErrors = append(allErrors, validateEnvVars(rayCluster)...)
allErrors = append(allErrors, validateCaVolumes(rayCluster)...)
return warnings, allErrors.ToAggregate()
}

Expand Down Expand Up @@ -338,7 +342,7 @@ func (w *rayClusterWebhook) rayHeadInitContainer(rayCluster *rayv1.RayCluster) c
return initContainerHead
}

func rayWorkerInitContainer(rayCluster *rayv1.RayCluster) corev1.Container {
func rayWorkerInitContainer() corev1.Container {
initContainerWorker := corev1.Container{
Name: "create-cert",
Image: "quay.io/project-codeflare/ray:latest-py39-cu118",
Expand Down Expand Up @@ -367,7 +371,7 @@ func (w *rayClusterWebhook) validateHeadInitContainer(rayCluster *rayv1.RayClust
func (w *rayClusterWebhook) validateWorkerInitContainer(rayCluster *rayv1.RayCluster) field.ErrorList {
var allErrors field.ErrorList

if err := contains(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers, rayWorkerInitContainer(rayCluster), byContainerName,
if err := contains(rayCluster.Spec.WorkerGroupSpecs[0].Template.Spec.InitContainers, rayWorkerInitContainer(), byContainerName,
field.NewPath("spec", "workerGroupSpecs", "0", "template", "spec", "initContainers"),
"create-cert Init Container is immutable"); err != nil {
allErrors = append(allErrors, err)
Expand Down

0 comments on commit f44b2b9

Please sign in to comment.