-
Notifications
You must be signed in to change notification settings - Fork 603
Add RayClusterReady Condition Type #2271
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
Add RayClusterReady Condition Type #2271
Conversation
6bbe9e7
to
dd3c27b
Compare
@@ -168,14 +168,19 @@ type RayClusterConditionType string | |||
|
|||
// Custom Reason for RayClusterCondition | |||
const ( | |||
AllPodRunningAndReady = "AllPodRunningAndReady" | |||
HeadPodNotFound = "HeadPodNotFound" | |||
// PodRunningAndReady says that the pod is running and ready. | |||
PodRunningAndReady = "PodRunningAndReady" |
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 actually prefer changing PodRunningAndReady
to HeadPodRunningAndReady
to make it more explicit. This also makes it easier for me to copy the Reason
field from HeadPodReady
to RayClusterReady
.
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 actually prefer changing PodRunningAndReady to HeadPodRunningAndReady to make it more explicit.
makes sense to me
// PodRunningAndReady says that the pod is running and ready. | ||
PodRunningAndReady = "PodRunningAndReady" | ||
// UnknownReason says that the reason for the condition is unknown. | ||
UnknownReason = "Unknown" | ||
) | ||
|
||
const ( | ||
// HeadPodReady is added in a RayCluster when its Head Pod is ready for requests. |
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 changed this comment a little bit because HeadPodReady
will always be there no matter whether the Head Pod is ready or not; it is just its status
that will be true
or false
.
@@ -168,14 +168,19 @@ type RayClusterConditionType string | |||
|
|||
// Custom Reason for RayClusterCondition | |||
const ( | |||
AllPodRunningAndReady = "AllPodRunningAndReady" | |||
HeadPodNotFound = "HeadPodNotFound" | |||
// PodRunningAndReady says that the pod is running and ready. | |||
PodRunningAndReady = "PodRunningAndReady" |
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 actually prefer changing PodRunningAndReady to HeadPodRunningAndReady to make it more explicit.
makes sense to me
// PodRunningAndReady says that the pod is running and ready. | ||
PodRunningAndReady = "PodRunningAndReady" | ||
// UnknownReason says that the reason for the condition is unknown. | ||
UnknownReason = "Unknown" | ||
) | ||
|
||
const ( | ||
// HeadPodReady is added in a RayCluster when its Head Pod is ready for requests. | ||
// RayClusterReady indicates whether all Ray Pods are ready when the RayCluster is first created. | ||
// After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's Head Pod is ready for requests. |
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.
// After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's Head Pod is ready for requests. | |
// After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's head Pod is ready for requests. |
// RayClusterReady indicates whether all Ray Pods are ready when the RayCluster is first created. | ||
// After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's Head Pod is ready for requests. | ||
RayClusterReady RayClusterConditionType = "RayClusterReady" | ||
// HeadPodReady indicates weather RayCluster's Head Pod is ready for requests. |
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.
// HeadPodReady indicates weather RayCluster's Head Pod is ready for requests. | |
// HeadPodReady indicates weather RayCluster's head Pod is ready for requests. |
Type: string(rayv1.RayClusterReady), | ||
Status: headPodReadyCondition.Status, | ||
Reason: headPodReadyCondition.Reason, | ||
Message: headPodReadyCondition.Message, |
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.
update Message
meta.SetStatusCondition(&newInstance.Status.Conditions, metav1.Condition{ | ||
Type: string(rayv1.RayClusterReady), | ||
Status: metav1.ConditionTrue, | ||
Reason: rayv1.AllPodRunningAndReady, |
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 Message
@@ -1717,8 +1717,6 @@ func TestCalculateStatus(t *testing.T) { | |||
// Test CheckRayHeadRunningAndReady with head pod running and ready | |||
newInstance, _ = r.calculateStatus(ctx, testRayCluster, nil) | |||
assert.True(t, meta.IsStatusConditionPresentAndEqual(newInstance.Status.Conditions, string(rayv1.HeadPodReady), metav1.ConditionTrue)) | |||
condition := meta.FindStatusCondition(newInstance.Status.Conditions, string(rayv1.HeadPodReady)) |
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.
This check is the same as assert.True(t, meta.IsStatusConditionPresentAndEqual(newInstance.Status.Conditions, string(rayv1.HeadPodReady), metav1.ConditionTrue))
, so I deleted it.
|
||
// Test reconcilePodsErr with the feature gate enabled | ||
newInstance, err = r.calculateStatus(ctx, testRayCluster, utils.ErrFailedCreateHeadPod) | ||
assert.Nil(t, err) | ||
assert.True(t, meta.IsStatusConditionPresentAndEqual(newInstance.Status.Conditions, string(rayv1.RayClusterReplicaFailure), metav1.ConditionTrue)) | ||
} | ||
|
||
func TestRayClusterReadyCondition(t *testing.T) { |
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.
After several tries, I decided to make it a separate function with TestCalculateStatus. Otherwise, it is too difficult to write with so many things coupled together. I think the test is fine being a little long, and these tests will be rewritten to use a real client in the future anyway.
// RayClusterReady indicates whether all Ray Pods are ready when the RayCluster is first created. | ||
// After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's head Pod is ready for requests. | ||
RayClusterReady RayClusterConditionType = "RayClusterReady" | ||
// HeadPodReady indicates weather RayCluster's head Pod is ready for requests. |
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.
// HeadPodReady indicates weather RayCluster's head Pod is ready for requests. | |
// HeadPodReady indicates whether RayCluster's head Pod is ready for requests. |
_ = fakeClient.Status().Update(ctx, headPod) | ||
_ = fakeClient.Status().Update(ctx, workerPod) | ||
testRayCluster, _ = r.calculateStatus(ctx, testRayCluster, nil) | ||
assert.Nil(t, meta.FindStatusCondition(testRayCluster.Status.Conditions, string(rayv1.RayClusterReady))) |
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 also check reasons or messages?
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. I did not check line 1814 because RayClusterReady should not be added at that time.
Signed-off-by: Yicheng-Lu-llll <luyc58576@gmail.com>
7d0c5c9
to
9f90369
Compare
Why are these changes needed?
This PR adds RayClusterReady condition type. See here for the reason: https://docs.google.com/document/d/1bRL0cZa87eCX6SI7gqthN68CgmHaB6l3-vJuIse-BrY/edit.
RayClusterReady indicates whether all Ray Pods are ready when the RayCluster is first created.
After RayClusterReady is set to true for the first time, it only indicates whether the RayCluster's Head Pod is ready for
Related issue number
Checks