-
Notifications
You must be signed in to change notification settings - Fork 620
[Refactor] RayJob Spec ClusterSelector validation logic #4032
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
[Refactor] RayJob Spec ClusterSelector validation logic #4032
Conversation
…s/validation.go Signed-off-by: Future-Outlier <[email protected]>
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.
Great👍👍!
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
if !ok { | ||
return fmt.Errorf("failed to get cluster name in ClusterSelector map, the key is %v", RayJobClusterSelectorKey) | ||
} | ||
if len(clusterName) == 0 { | ||
return fmt.Errorf("cluster name in ClusterSelector should not be empty") | ||
} |
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 !ok { | |
return fmt.Errorf("failed to get cluster name in ClusterSelector map, the key is %v", RayJobClusterSelectorKey) | |
} | |
if len(clusterName) == 0 { | |
return fmt.Errorf("cluster name in ClusterSelector should not be empty") | |
} | |
if len(clusterName) == 0 { | |
return fmt.Errorf("%s in ClusterSelector should not be empty", RayJobClusterSelectorKey) | |
} |
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.
updated, thank you!
Signed-off-by: Future-Outlier <[email protected]>
…erSelector-validation
Why are these changes needed?
In RayJob controller, when using existing RayCluster, I need to use
clusterSelector
to select my RayCluster.However, I noticed that our validation logic is not implemented in
utils/validation.go
and is not invoked before the switch statement in the RayJob reconciliation logic, which does not align with the RayJob controller’s design philosophy.I think we should move the logic from
kuberay/ray-operator/controllers/ray/rayjob_controller.go
Lines 804 to 806 in 7639b9d
to
kuberay/ray-operator/controllers/ray/utils/validation.go
Lines 151 to 257 in 7639b9d
Related issue number
#4030
Checks