-
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?
Changes from 4 commits
9e9031f
0f9171d
c3413fb
0796f35
1c1c6b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Please rename to |
||||||
redisCleanupJobs := batchv1.JobList{} | ||||||
if err := r.List(ctx, &redisCleanupJobs, client.InNamespace(instance.Namespace), filterLabels); err != nil { | ||||||
if err := r.List(ctx, &redisCleanupJobs, filterLabels...); err != nil { | ||||||
return ctrl.Result{RequeueAfter: DefaultRequeueDuration}, err | ||||||
} | ||||||
|
||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. It's misleading to use |
||||||
if err := r.List(ctx, &headRoutes, filterLabels...); err != nil { | ||||||
return err | ||||||
} | ||||||
|
||||||
|
@@ -512,8 +512,8 @@ func (r *RayClusterReconciler) reconcileRouteOpenShift(ctx context.Context, inst | |||||
func (r *RayClusterReconciler) reconcileIngressKubernetes(ctx context.Context, instance *rayv1.RayCluster) error { | ||||||
logger := ctrl.LoggerFrom(ctx) | ||||||
headIngresses := networkingv1.IngressList{} | ||||||
filterLabels := client.MatchingLabels{utils.RayClusterLabelKey: instance.Name} | ||||||
if err := r.List(ctx, &headIngresses, client.InNamespace(instance.Namespace), filterLabels); err != nil { | ||||||
filterLabels := common.RayClusterAllPodsAssociationOptions(instance).ToListOptions() | ||||||
if err := r.List(ctx, &headIngresses, filterLabels...); err != nil { | ||||||
return err | ||||||
} | ||||||
|
||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
if err := r.List(ctx, &services, client.InNamespace(instance.Namespace), filterLabels); err != nil { | ||||||
if err := r.List(ctx, &services, filterLabels...); err != nil { | ||||||
return err | ||||||
} | ||||||
|
||||||
|
@@ -1280,8 +1280,8 @@ func (r *RayClusterReconciler) calculateStatus(ctx context.Context, instance *ra | |||||
newInstance.Status.ObservedGeneration = newInstance.ObjectMeta.Generation | ||||||
|
||||||
runtimePods := corev1.PodList{} | ||||||
filterLabels := client.MatchingLabels{utils.RayClusterLabelKey: newInstance.Name} | ||||||
if err := r.List(ctx, &runtimePods, client.InNamespace(newInstance.Namespace), filterLabels); err != nil { | ||||||
filterLabels := common.RayClusterAllPodsAssociationOptions(newInstance).ToListOptions() | ||||||
if err := r.List(ctx, &runtimePods, filterLabels...); err != nil { | ||||||
return nil, err | ||||||
} | ||||||
|
||||||
|
@@ -1450,11 +1450,8 @@ func (r *RayClusterReconciler) updateEndpoints(ctx context.Context, instance *ra | |||||
// We assume we can find the right one by filtering Services with appropriate label selectors | ||||||
// and picking the first one. We may need to select by name in the future if the Service naming is stable. | ||||||
rayHeadSvc := corev1.ServiceList{} | ||||||
filterLabels := client.MatchingLabels{ | ||||||
utils.RayClusterLabelKey: instance.Name, | ||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||||||
if err := r.List(ctx, &rayHeadSvc, filterLabels...); err != nil { | ||||||
return err | ||||||
} | ||||||
|
||||||
|
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!