Skip to content

Commit ded1e68

Browse files
alimaazamatwin5923
andauthored
Check spec version then fall back to env var
Co-authored-by: Jun-Hao Wan <ken89@kimo.com> Signed-off-by: Alima Azamat <92766804+alimaazamat@users.noreply.github.com>
1 parent a608d94 commit ded1e68

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ray-operator/controllers/ray/utils/validation.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,14 @@ func validateWorkerGroupIdleTimeout(workerGroup rayv1.WorkerGroupSpec, spec *ray
609609
}
610610

611611
// idleTimeoutSeconds only allowed on autoscaler v2
612+
if IsAutoscalingV2Enabled(spec) {
613+
return nil
614+
}
612615
envVar, exists := EnvVarByName(RAY_ENABLE_AUTOSCALER_V2, spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env)
613-
if !exists || (envVar.Value != "1" && envVar.Value != "true") {
614-
return fmt.Errorf("worker group %s has idleTimeoutSeconds set, but %s environment variable is not set to 'true' in the head pod", workerGroup.GroupName, RAY_ENABLE_AUTOSCALER_V2)
616+
if exists && (envVar.Value == "1" || envVar.Value == "true") {
617+
return nil
615618
}
619+
return fmt.Errorf("worker group %s has idleTimeoutSeconds set, but autoscaler v2 is not enabled. Please set .spec.autoscalerOptions.version to 'v2' or set %s environment variable to 'true' in the head pod", workerGroup.GroupName, RAY_ENABLE_AUTOSCALER_V2)
616620
}
617621

618622
return nil

0 commit comments

Comments
 (0)