Skip to content
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

Don't reconcile all pods whenever a service change #6985

Closed
lahabana opened this issue Jun 9, 2023 · 0 comments · Fixed by #6986
Closed

Don't reconcile all pods whenever a service change #6985

lahabana opened this issue Jun 9, 2023 · 0 comments · Fixed by #6986
Labels
area/performance kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@lahabana
Copy link
Contributor

lahabana commented Jun 9, 2023

Description

Related to:

Now that dataplanes don't contain outbounds we shouldn't need to update all pods when a service changes:

func ServiceToPodsMapper(l logr.Logger, client kube_client.Client) kube_handler.MapFunc {
l = l.WithName("service-to-pods-mapper")
return func(ctx context.Context, obj kube_client.Object) []kube_reconile.Request {
// List Pods in the same namespace as a Service
pods := &kube_core.PodList{}
if err := client.List(ctx, pods, kube_client.InNamespace(obj.GetNamespace())); err != nil {
l.WithValues("service", obj.GetName()).Error(err, "failed to fetch Pods")
return nil
}
var req []kube_reconile.Request
for _, pod := range pods.Items {
req = append(req, kube_reconile.Request{
NamespacedName: kube_types.NamespacedName{Namespace: pod.Namespace, Name: pod.Name},
})
}
return req
}
}

I think we only need to reconcile pods that this service matches not all pods of the namespace

I also don't think we need to reconcile pods on external service:

Watches(&mesh_k8s.ExternalService{}, kube_handler.EnqueueRequestsFromMapFunc(ExternalServiceToPodsMapper(r.Log, mgr.GetClient()))).

@lahabana lahabana added triage/pending This issue will be looked at on the next triage meeting kind/improvement Improvement on an existing feature area/performance labels Jun 9, 2023
lahabana added a commit to lahabana/kuma that referenced this issue Jun 9, 2023
- only reconcile pods that are selected by this service
- don't reconcile pods when external services are updated

Fix kumahq#6985

Signed-off-by: Charly Molter <charly.molter@konghq.com>
@jakubdyszkiewicz jakubdyszkiewicz added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Jun 12, 2023
lahabana added a commit that referenced this issue Jun 12, 2023
- only reconcile pods that are selected by this service
- don't reconcile pods when external services are updated

Fix #6985

Signed-off-by: Charly Molter <charly.molter@konghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants