Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fscnick
Copy link
Contributor

@fscnick fscnick commented Mar 4, 2025

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.
fail

Related issue number

#2986

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@@ -158,6 +159,12 @@ func ValidateRayJobSpec(rayJob *rayv1.RayJob) error {
}

func ValidateRayServiceSpec(rayService *rayv1.RayService) error {
if !reflect.DeepEqual(rayService.Spec.RayClusterSpec, rayv1.RayClusterSpec{}) {
Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !reflect.DeepEqual(rayService.Spec.RayClusterSpec, rayv1.RayClusterSpec{}) {
if !reflect.ValueOf(rayService.Spec.RayClusterSpec).IsZero() {

Copy link
Contributor Author

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.

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")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, if trying to apply a yaml without RayClusterSpec. It would pass the creation of RayService but fail on creating RayCluster.

fail

Copy link
Member

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?

Copy link
Member

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"`

Copy link
Member

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.

Copy link
Contributor Author

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.

Comment on lines 750 to 760
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")
Copy link
Contributor Author

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.

Copy link
Member

@MortalHappiness MortalHappiness Mar 6, 2025

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

@fscnick fscnick force-pushed the rayservice-event-cant-set-pwd branch from 9d79335 to 09dfae8 Compare March 4, 2025 15:03
@kevin85421 kevin85421 self-assigned this Mar 4, 2025
@fscnick fscnick marked this pull request as ready for review March 5, 2025 00:27
@kevin85421
Copy link
Member

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() {
Copy link
Contributor

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?

Suggested change
if !reflect.ValueOf(rayService.Spec.RayClusterSpec).IsZero() {

@MortalHappiness
Copy link
Member

Hi. Please resolve the conflicts. Thanks.

fscnick added 5 commits March 12, 2025 20:42
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>
@fscnick fscnick force-pushed the rayservice-event-cant-set-pwd branch from 113c824 to 445bcb6 Compare March 12, 2025 13:12
@fscnick fscnick requested review from rueian and kevin85421 March 12, 2025 14:14
name: "headGroupSpec should have at least one container",
spec: rayv1.RayServiceSpec{
RayClusterSpec: rayv1.RayClusterSpec{
HeadServiceAnnotations: map[string]string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is HeadServiceAnnotations necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants