-
Notifications
You must be signed in to change notification settings - Fork 402
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][RayCluster] Add RayClusterRedisPodAssociationOptions and HeadServiceAssociationOptions #2062
base: master
Are you sure you want to change the base?
Conversation
7a66c22
to
84b6053
Compare
cc @rueian would you mind reviewing this PR? Thanks! |
84b6053
to
3d87528
Compare
3d87528
to
8858022
Compare
func HeadServiceAssociationOptions(instance *rayv1.RayCluster) AssociationOptions { | ||
return AssociationOptions{ | ||
client.InNamespace(instance.Namespace), | ||
client.MatchingLabels(HeadServiceLabels(*instance)), |
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.
LGTM
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.
Please revisit all the function names.
|
||
if err := r.List(ctx, &services, client.InNamespace(instance.Namespace), filterLabels); err != nil { | ||
if err := r.List(ctx, &services, common.RayClusterHeadPodsAssociationOptions(instance).ToListOptions()...); err != 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.
This is pretty confusing. We use RayClusterHeadPodsAssociationOptions
to list service.
8858022
to
06652db
Compare
Thank you! I have revised the function names to be more well-defined and try not to confuse developers. |
0d06e3f
to
723a3d8
Compare
I intend to separate functions with similar functionality into |
@@ -103,6 +123,13 @@ func RayServiceRayClustersAssociationOptions(rayService *rayv1.RayService) Assoc | |||
} | |||
} | |||
|
|||
func HeadServiceAssociationOptions(instance *rayv1.RayCluster) AssociationOptions { |
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.
The function name is inconsistent with our naming convention.
@@ -84,7 +94,7 @@ func RayClusterGroupPodsAssociationOptions(instance *rayv1.RayCluster, group str | |||
} | |||
} | |||
|
|||
func RayClusterAllPodsAssociationOptions(instance *rayv1.RayCluster) AssociationOptions { | |||
func RayClusterRelatedAssociationOptions(instance *rayv1.RayCluster) AssociationOptions { |
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.
What's the definition of "RayClusterRelated"?
@@ -93,6 +103,16 @@ func RayClusterAllPodsAssociationOptions(instance *rayv1.RayCluster) Association | |||
} | |||
} | |||
|
|||
func RayClusterServicesAssociationOptions(instance *rayv1.RayCluster) AssociationOptions { |
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.
What's the difference between this function and HeadServiceAssociationOptions
?
8022141
to
28aed73
Compare
Why are these changes needed?
This PR aims to follow up #2045. The purpose of this initiative is to maintain consistency in association methods and avoid scattering MatchingLabels usage throughout the entire codebase.
In this PR, I mainly update the
raycluster_controller.go
file to reflect the change, and add twoAssociationOptions
which areRayClusterRedisPodAssociationOptions
andHeadServiceAssociationOptions
inassociation.go
.Related issue number
#2045
Checks