-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RayService event can't set redis password in both GCSFaultTolerance and rayStartParam #3153
base: master
Are you sure you want to change the base?
Conversation
@@ -158,6 +159,12 @@ func ValidateRayJobSpec(rayJob *rayv1.RayJob) error { | |||
} | |||
|
|||
func ValidateRayServiceSpec(rayService *rayv1.RayService) error { | |||
if !reflect.DeepEqual(rayService.Spec.RayClusterSpec, rayv1.RayClusterSpec{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this acceptable that it uses reflect.DeepEqual
to verify if RayClusterSpec
or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fscnick, can’t we use ValidateRayClusterSpec directly? What will happen if use it directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !reflect.DeepEqual(rayService.Spec.RayClusterSpec, rayv1.RayClusterSpec{}) { | |
if !reflect.ValueOf(rayService.Spec.RayClusterSpec).IsZero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fscnick, can’t we use ValidateRayClusterSpec directly? What will happen if use it directly?
Hi @rueian , it seems that the following test cases implies an empty RayClusterSpec
is acceptable.
kuberay/ray-operator/controllers/ray/utils/validation_test.go
Lines 735 to 748 in a721d60
err = ValidateRayServiceSpec(&rayv1.RayService{ | |
Spec: rayv1.RayServiceSpec{}, | |
}) | |
require.NoError(t, err, "The RayService spec is valid.") | |
var upgradeStrat rayv1.RayServiceUpgradeType = "invalidStrategy" | |
err = ValidateRayServiceSpec(&rayv1.RayService{ | |
Spec: rayv1.RayServiceSpec{ | |
UpgradeStrategy: &rayv1.RayServiceUpgradeStrategy{ | |
Type: &upgradeStrat, | |
}, | |
}, | |
}) | |
require.Error(t, err, "spec.UpgradeSpec.Type is invalid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevin85421 Should we make RayClusterSpec
to required field for RayService
CRD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make RayClusterSpec to required field for RayService CRD?
Wow, I wasn’t aware that RayClusterSpec isn’t a required field in the RayService CRD. It should be required. @fscnick would you mind opening a PR to make it become required?
Remove omitempty
and then generate the new CRD YAMLs.
RayClusterSpec RayClusterSpec `json:"rayClusterConfig,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG. I think we should make this field required first and remove the corresponding tests. And then we can remove this check completely in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make RayClusterSpec to required field for RayService CRD?
Wow, I wasn’t aware that RayClusterSpec isn’t a required field in the RayService CRD. It should be required. @fscnick would you mind opening a PR to make it become required?
Remove
omitempty
and then generate the new CRD YAMLs.
RayClusterSpec RayClusterSpec `json:"rayClusterConfig,omitempty"`
Sure, I'll create another PR to address this.
err = ValidateRayServiceSpec(&rayv1.RayService{ | ||
Spec: rayv1.RayServiceSpec{ | ||
RayClusterSpec: rayv1.RayClusterSpec{ | ||
HeadServiceAnnotations: map[string]string{ | ||
"foo": "bar", | ||
}, | ||
HeadGroupSpec: rayv1.HeadGroupSpec{}, | ||
}, | ||
}, | ||
}) | ||
require.Error(t, err, "headGroupSpec should have at least one container") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an expected error case on ValidateRayClusterSpec
inside ValidateRayServiceSpec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add a testcase for empty RayClusterSpec
. Also, please convert this test into subtests and then run them with t.Run
. You can reference the TestValidateRayClusterSpecRedisPassword
function above.
Follow-up PR: Also convert TestValidateRayJobSpec
9d79335
to
09dfae8
Compare
cc @MortalHappiness @rueian would you mind reviewing this PR? |
@@ -158,6 +159,12 @@ func ValidateRayJobSpec(rayJob *rayv1.RayJob) error { | |||
} | |||
|
|||
func ValidateRayServiceSpec(rayService *rayv1.RayService) error { | |||
if !reflect.ValueOf(rayService.Spec.RayClusterSpec).IsZero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed now?
if !reflect.ValueOf(rayService.Spec.RayClusterSpec).IsZero() { |
Hi. Please resolve the conflicts. Thanks. |
Signed-off-by: fscnick <fscnick.dev@gmail.com>
…terSpec Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
113c824
to
445bcb6
Compare
name: "headGroupSpec should have at least one container", | ||
spec: rayv1.RayServiceSpec{ | ||
RayClusterSpec: rayv1.RayClusterSpec{ | ||
HeadServiceAnnotations: map[string]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is HeadServiceAnnotations
necessary?
Why are these changes needed?
If an user sets redis password in both GCSFaultTolerance and rayStartParam, it will prompt CR event in RayCluster.
However, it's not show in RayService. Thus, the user need to find the CR event in RayCluster to know the cause.
Here is result of screenshot.

Related issue number
#2986
Checks