The namespace given to telepresence list is correctly used to filter the workloads that need to be iterated through
For each workload, its pod template spec's labels are passed into a service listing command to k8s
If the pod template spec's Namespace field is not set, this listing command will fall back to looking through every single namespace for services
To this end, I tried setting this Namespace field manually on my local build, at which point the command went down from ~4mins to ~40s. This is a marked improvement, but still quite a long time -- and we still end up in the same branch of code that we shouldn't be in. I'm not entirely sure when the informer is supposed to have a K8sFactory set on it per namespace, but I'm guessing that's not happening right now.
To Reproduce
Set up a cluster with several namespaces, each with several pods (e.g. we have 70+ ns, each with 100+ services)
Run telepresence list
Observe, either via debugging/logs, that all namespaces are searched through
The logs I have currently speak to a lot of workplace specific info -- I can try and share them if absolutely necessary.
Expected behaviortelepresence list should ideally complete relatively quickly, at most in ~10s.
Versions (please complete the following information):
$ telepresence version
OSS Client : v2.20.1
OSS Root Daemon: v2.20.1
OSS User Daemon: v2.20.1
Traffic Manager: not connected
Describe the bug When running
telepresence list
, it often takes almost 4 mins to complete.I have tried first connecting with and without
--mapped-namespaces
, and it has not made a difference.Debugging steps taken
When debugging a local version of the user daemon + CLI, the
list
command always gets to this branch: https://github.com/telepresenceio/telepresence/blob/ebb90267bddd121e19eaec02dca75669ede077f6/pkg/agentmap/discorvery.go#L202On further inspection, the
namespace
parameter of that function is always an empty string, and that is fed through in this line: https://github.com/telepresenceio/telepresence/blob/ebb90267bddd121e19eaec02dca75669ede077f6/pkg/agentmap/discorvery.go#L156-L157So, what I believe is happening is that:
telepresence list
is correctly used to filter the workloads that need to be iterated throughNamespace
field is not set, this listing command will fall back to looking through every single namespace for servicesTo this end, I tried setting this
Namespace
field manually on my local build, at which point the command went down from ~4mins to ~40s. This is a marked improvement, but still quite a long time -- and we still end up in the same branch of code that we shouldn't be in. I'm not entirely sure when the informer is supposed to have aK8sFactory
set on it per namespace, but I'm guessing that's not happening right now.To Reproduce
telepresence list
The logs I have currently speak to a lot of workplace specific info -- I can try and share them if absolutely necessary.
Expected behavior
telepresence list
should ideally complete relatively quickly, at most in ~10s.Versions (please complete the following information):