-
Notifications
You must be signed in to change notification settings - Fork 321
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 to Ensure Consistent Use of CRDType #1892
Refactor to Ensure Consistent Use of CRDType #1892
Conversation
Signed-off-by: Yicheng-Lu-llll <luyc58576@gmail.com>
|
||
return creatorName | ||
func getCreatorCRDType(instance rayv1.RayCluster) utils.CRDType { | ||
return utils.GetCRDType(instance.Labels[utils.RayOriginatedFromCRDLabelKey]) |
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 Labels is nil or does not contain the key, instance.Labels[utils.RayOriginatedFromCRDLabelKey]
will return an empty string. See this simple example.
@@ -292,14 +292,14 @@ func initLivenessAndReadinessProbe(rayContainer *corev1.Container, rayNodeType r | |||
} | |||
|
|||
// BuildPod a pod config | |||
func BuildPod(ctx context.Context, podTemplateSpec corev1.PodTemplateSpec, rayNodeType rayv1.RayNodeType, rayStartParams map[string]string, headPort string, enableRayAutoscaler *bool, creator string, fqdnRayIP string) (aPod corev1.Pod) { | |||
func BuildPod(ctx context.Context, podTemplateSpec corev1.PodTemplateSpec, rayNodeType rayv1.RayNodeType, rayStartParams map[string]string, headPort string, enableRayAutoscaler *bool, creatorCRDType utils.CRDType, fqdnRayIP string) (aPod corev1.Pod) { |
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.
nit: Is (aPod corev1.Pod)
necessary?
We don't need to update it in this PR. We can revisit all named return values in a separate 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.
I agree aPod
is unnecessary.
Why are these changes needed?
This PR ensures consistent use of CRDType instead of string types to avoid potential bugs, addressing the issue described here:
kuberay/ray-operator/controllers/ray/raycluster_controller.go
Line 1059 in 52cb1a1
Related issue number
Checks
As shown below, we can successfully detect that the RayCluster is created by RayService:
RAY_timeout_ms_task_wait_for_death_info
environment variable is set.