Skip to content

Commit

Permalink
fix: rm Containers[RayContainerIndex].Env check which is not necessar…
Browse files Browse the repository at this point in the history
…y and change confusing message
  • Loading branch information
CheyuWu committed Jan 14, 2025
1 parent 4d71412 commit ce2c194
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions ray-operator/apis/ray/v1/raycluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ func (r *RayCluster) ValidateRayClusterSpec() *field.Error {
return field.Invalid(
field.NewPath("spec").Child("gcsFaultToleranceOptions"),
r.Spec.GcsFaultToleranceOptions,
fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
)
}
if r.Annotations[RayFTEnabledAnnotationKey] != "true" &&
len(r.Spec.HeadGroupSpec.Template.Spec.Containers) > 0 &&
r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env != nil {

if r.Annotations[RayFTEnabledAnnotationKey] != "true" && len(r.Spec.HeadGroupSpec.Template.Spec.Containers) > 0 {
if EnvVarExists(RAY_REDIS_ADDRESS, r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env) {
return field.Invalid(
field.NewPath("spec").Child("headGroupSpec").Child("template").Child("spec").Child("containers").Index(0).Child("env"),
Expand Down
4 changes: 2 additions & 2 deletions ray-operator/apis/ray/v1/raycluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestValidateRayClusterSpec(t *testing.T) {
},
gcsFaultToleranceOptions: &GcsFaultToleranceOptions{},
expectError: true,
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
},
{
name: "FT disabled with RAY_REDIS_ADDRESS set",
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestValidateRayCluster(t *testing.T) {
},
GcsFaultToleranceOptions: &GcsFaultToleranceOptions{},
expectError: true,
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
},
{
name: "Valid RayCluster",
Expand Down

0 comments on commit ce2c194

Please sign in to comment.