Skip to content

Commit

Permalink
Review changes parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 committed Apr 18, 2024
1 parent 49949d2 commit 5d1c7f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/controllers/raycluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (w *rayClusterWebhook) Default(ctx context.Context, obj runtime.Object) err
}

// Append the create-cert Init Container
rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers = upsert(rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers, w.rayHeadInitContainer(rayCluster), withContainerName(initContainerName))
rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers = upsert(rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers, rayHeadInitContainer(rayCluster, w), withContainerName(initContainerName))

// Append the CA volumes
for _, caVol := range caVolumes(rayCluster) {
Expand Down Expand Up @@ -144,7 +144,7 @@ func (w *rayClusterWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj r
allErrors = append(allErrors, validateOAuthProxyVolume(rayCluster)...)
allErrors = append(allErrors, validateHeadGroupServiceAccountName(rayCluster)...)
// Init Container related errors
allErrors = append(allErrors, w.validateHeadInitContainer(rayCluster)...)
allErrors = append(allErrors, validateHeadInitContainer(rayCluster, w)...)
allErrors = append(allErrors, validateWorkerInitContainer(rayCluster)...)
allErrors = append(allErrors, validateHeadEnvVars(rayCluster)...)
allErrors = append(allErrors, validateWorkerEnvVars(rayCluster)...)
Expand Down Expand Up @@ -325,7 +325,7 @@ func caVolumes(rayCluster *rayv1.RayCluster) []corev1.Volume {
return caVolumes
}

func (w *rayClusterWebhook) rayHeadInitContainer(rayCluster *rayv1.RayCluster) corev1.Container {
func rayHeadInitContainer(rayCluster *rayv1.RayCluster, w *rayClusterWebhook) corev1.Container {
rayClientRoute := "rayclient-" + rayCluster.Name + "-" + rayCluster.Namespace + "." + w.Config.IngressDomain
// Service name for basic interactive
svcDomain := rayCluster.Name + "-head-svc." + rayCluster.Namespace + ".svc"
Expand Down Expand Up @@ -357,10 +357,10 @@ func rayWorkerInitContainer() corev1.Container {
return initContainerWorker
}

func (w *rayClusterWebhook) validateHeadInitContainer(rayCluster *rayv1.RayCluster) field.ErrorList {
func validateHeadInitContainer(rayCluster *rayv1.RayCluster, w *rayClusterWebhook) field.ErrorList {
var allErrors field.ErrorList

if err := contains(rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers, w.rayHeadInitContainer(rayCluster), byContainerName,
if err := contains(rayCluster.Spec.HeadGroupSpec.Template.Spec.InitContainers, rayHeadInitContainer(rayCluster, w), byContainerName,
field.NewPath("spec", "headGroupSpec", "template", "spec", "initContainers"),
"create-cert Init Container is immutable"); err != nil {
allErrors = append(allErrors, err)
Expand Down

0 comments on commit 5d1c7f7

Please sign in to comment.