-
Notifications
You must be signed in to change notification settings - Fork 435
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
[Feature] Add ValidateRayClusterSpec to Webhook #2739
base: master
Are you sure you want to change the base?
Conversation
ray-operator/apis/ray/v1/constant.go
Outdated
const RAY_REDIS_ADDRESS = "RAY_REDIS_ADDRESS" | ||
|
||
// Ray GCS FT related annotations | ||
const RayFTEnabledAnnotationKey = "ray.io/ft-enabled" |
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 you create references to them with the same name in the package utils
?
I think it should be something like this
package utils
const RayContainerIndex = rayv1.RayContainerIndex
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.
Sorry, I have a misunderstanding
|
} | ||
if r.Annotations[RayFTEnabledAnnotationKey] != "true" && | ||
len(r.Spec.HeadGroupSpec.Template.Spec.Containers) > 0 && | ||
r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env != nil { |
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.
r.Spec.HeadGroupSpec.Template.Spec.Containers[RayContainerIndex].Env != nil
check is not necessary.
return field.Invalid( | ||
field.NewPath("spec").Child("gcsFaultToleranceOptions"), | ||
r.Spec.GcsFaultToleranceOptions, | ||
fmt.Sprintf("GcsFaultToleranceOptions should be nil when %s is disabled", RayFTEnabledAnnotationKey), |
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.
when %s is disabled
might be confusing.
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), |
return field.Invalid( | ||
field.NewPath("spec").Child("headGroupSpec").Child("template").Child("spec").Child("containers").Index(0).Child("env"), | ||
RAY_REDIS_ADDRESS, | ||
fmt.Sprintf("%s should not be set when %s is disabled", RAY_REDIS_ADDRESS, RayFTEnabledAnnotationKey), |
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.
fmt.Sprintf("%s should not be set when %s is disabled", RAY_REDIS_ADDRESS, RayFTEnabledAnnotationKey), | |
fmt.Sprintf("%s environment variable should not be set when %s annotation is not set to true", RAY_REDIS_ADDRESS, RayFTEnabledAnnotationKey), |
…y func and variables to /ray/v1
…y and change confusing message
e579e66
to
ce2c194
Compare
|
Why are these changes needed?
ValidateRayClusterSpec validation should also be invoked in the optional validation webhook
constant.go
to store some necessary variables which copy fromcontrollers/ray/utils
utils.go
to store some necessary functions which copy fromcontrollers/ray/utils
Related issue number
Closes #2694
Related Discussion:
Checks