-
Notifications
You must be signed in to change notification settings - Fork 12
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
Speed up namespace switching in big clusters #11
Conversation
@imbstack, thanks for your PR, that's a pretty good addition 🚀 Later on, we can flip the flag and make it the default and keep the old style for anyone who works with older K8s versions. |
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.
I will merge the PR once it has a flag (env var) to control the feature as mentioned.
Ah yes sorry, I've been busy lately. I'll get a patch with that change before too long! |
Finally got around to this. I've tested this with the env var unset, and set to both listed values across the following cases:
I believe it works correctly in all of those cases. That said, I'm not a shell scripting expert so if there's a better way to go about any of this I'm happy to change whatever! |
I'll update README usage and such if this looks good! |
@imbstack Thanks for the change. You can simplify it by setting the default value the same way as here: if you don't want to bother, I can do the whole change anyway. |
Ah, good call! Hopefully this is more what you're thinking of. If not, feel free to edit or drop the PR and make it yourself. Thanks again! |
@imbstack I've made a small fix and it's ready to merge. |
Hi, thank you so much for this tool, it is the best one of its kind!
This patch just switches the check that a namespace exists from listing all namespaces to seeing if a specific label exists. This doesn't make much difference on clusters with reasonable numbers of namespaces but for me it is roughly a 8 second speedup:
This label should always exist in 1.22+ clusters. I expect relying on this would break
kubechc
for clusters older than that? Happy to make this fallback to the listing-all-namespaces way when the label check fails or something along those lines. Whatever sounds best to you.Thanks again!