-
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
Move matching labels to association.go #2734
base: master
Are you sure you want to change the base?
Move matching labels to association.go #2734
Conversation
Signed-off-by: owenowenisme <[email protected]>
f89cc2d
to
9e9031f
Compare
@rueian please take a look🙏🙏🙏 |
Hi @owenowenisme, I noticed that there are |
Signed-off-by: owenowenisme <[email protected]>
@@ -100,6 +100,16 @@ func RayClusterWorkerPodsAssociationOptions(instance *rayv1.RayCluster) Associat | |||
} | |||
} | |||
|
|||
func RayClusterRedisPodsAssociationOptions(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.
Could you add a test for this new method?
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.
Will do!
Signed-off-by: owenowenisme <[email protected]>
Signed-off-by: owenowenisme <[email protected]>
utils.RayNodeTypeLabelKey: "head", | ||
} | ||
if err := r.List(ctx, &rayHeadSvc, client.InNamespace(instance.Namespace), filterLabels); err != nil { | ||
filterLabels := common.RayClusterAllPodsAssociationOptions(instance).ToListOptions() |
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.
Use RayClusterHeadServiceListOptions
instead?
@@ -544,9 +544,9 @@ func (r *RayClusterReconciler) reconcileIngressKubernetes(ctx context.Context, i | |||
func (r *RayClusterReconciler) reconcileHeadService(ctx context.Context, instance *rayv1.RayCluster) error { | |||
logger := ctrl.LoggerFrom(ctx) | |||
services := corev1.ServiceList{} | |||
filterLabels := client.MatchingLabels{utils.RayClusterLabelKey: instance.Name, utils.RayNodeTypeLabelKey: string(rayv1.HeadNode)} | |||
filterLabels := common.RayClusterHeadPodsAssociationOptions(instance).ToListOptions() |
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.
filterLabels := common.RayClusterHeadPodsAssociationOptions(instance).ToListOptions() | |
filterLabels := common.RayClusterHeadServiceListOptions(instance).ToListOptions() |
@@ -286,9 +286,9 @@ func (r *RayClusterReconciler) rayClusterReconcile(ctx context.Context, instance | |||
} | |||
|
|||
// We can start the Redis cleanup process now because the head Pod has been terminated. | |||
filterLabels := client.MatchingLabels{utils.RayClusterLabelKey: instance.Name, utils.RayNodeTypeLabelKey: string(rayv1.RedisCleanupNode)} | |||
filterLabels := common.RayClusterRedisPodsAssociationOptions(instance).ToListOptions() |
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.
- It is used to associate a K8s Job instead of Pod.
- It is not a Redis Pod.
Please rename to RayClusterRedisCleanupJobAssociationOptions
@@ -481,8 +481,8 @@ func (r *RayClusterReconciler) reconcileIngress(ctx context.Context, instance *r | |||
func (r *RayClusterReconciler) reconcileRouteOpenShift(ctx context.Context, instance *rayv1.RayCluster) error { | |||
logger := ctrl.LoggerFrom(ctx) | |||
headRoutes := routev1.RouteList{} | |||
filterLabels := client.MatchingLabels{utils.RayClusterLabelKey: instance.Name} | |||
if err := r.List(ctx, &headRoutes, client.InNamespace(instance.Namespace), filterLabels); err != nil { | |||
filterLabels := common.RayClusterAllPodsAssociationOptions(instance).ToListOptions() |
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.
It's misleading to use RayClusterAllPodsAssociationOptions
to associate K8s ingress / route. Please create a new function RayClusterNetworkResourcesOptions
for both ingress and route instead.
Signed-off-by: owenowenisme <[email protected]>
4fa5f6a
to
1c1c6b7
Compare
@@ -194,3 +194,12 @@ func GetRayClusterHeadPod(ctx context.Context, reader client.Reader, instance *r | |||
} | |||
return &runtimePods.Items[0], nil | |||
} | |||
|
|||
func RayClusterNetworkResourcesOptions(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.
Since the new function is created, please add a test for it.
Why are these changes needed?
#2733
Related issue number
Closes #2733
Checks