Skip to content

Commit ce2c194

Browse files
committed
fix: rm Containers[RayContainerIndex].Env check which is not necessary and change confusing message
1 parent 4d71412 commit ce2c194

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

ray-operator/apis/ray/v1/raycluster_webhook.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,10 @@ func (r *RayCluster) ValidateRayClusterSpec() *field.Error {
9898
return field.Invalid(
9999
field.NewPath("spec").Child("gcsFaultToleranceOptions"),
100100
r.Spec.GcsFaultToleranceOptions,
101-
fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
101+
fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
102102
)
103103
}
104-
if r.Annotations[RayFTEnabledAnnotationKey] != "true" &&
105-
len(r.Spec.HeadGroupSpec.Template.Spec.Containers) > 0 &&
106-
r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env != nil {
107-
104+
if r.Annotations[RayFTEnabledAnnotationKey] != "true" && len(r.Spec.HeadGroupSpec.Template.Spec.Containers) > 0 {
108105
if EnvVarExists(RAY_REDIS_ADDRESS, r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env) {
109106
return field.Invalid(
110107
field.NewPath("spec").Child("headGroupSpec").Child("template").Child("spec").Child("containers").Index(0).Child("env"),

ray-operator/apis/ray/v1/raycluster_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestValidateRayClusterSpec(t *testing.T) {
2727
},
2828
gcsFaultToleranceOptions: &GcsFaultToleranceOptions{},
2929
expectError: true,
30-
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
30+
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
3131
},
3232
{
3333
name: "FT disabled with RAY_REDIS_ADDRESS set",
@@ -197,7 +197,7 @@ func TestValidateRayCluster(t *testing.T) {
197197
},
198198
GcsFaultToleranceOptions: &GcsFaultToleranceOptions{},
199199
expectError: true,
200-
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey),
200+
errorMessage: fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s annotation is set to false", RayFTEnabledAnnotationKey),
201201
},
202202
{
203203
name: "Valid RayCluster",

0 commit comments

Comments
 (0)