-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve performance of fetching cluster resources when deploying flux to sync in all namespaces #2520
Conversation
Pull upstream changes
I would also like to mention that this reduces the number of calls made to the API Server by a huge amount. |
@hiddeco It would be great if you could review this today |
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.
LGTM
@waseem-h can you please squash the commits? thanks
Fix test cases Change to make Change back to string array Fix test case Change back to []string format Fetch full ns object instead of creating one
@stefanprodan squashed |
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.
Thank you @waseem-h, this is an obvious optimization we missed 💯
@waseem-h you can deploy the fix on your cluster using this image |
Thanks @stefanprodan. Any idea when the new minor is going to be released? |
Probably in two weeks from now. |
Awesome |
PR fluxcd#2520 broke the scoping of imagePullSecrets when allowing to get workloads from all namespaces at once. The problem is that a secret cache (`seenCreds`) was indexed by the secret name (making it namespace specific). Processing all the namespaces at once without adjusting the scoping opened the door to clashes between secrets from different namespaces which are called the same.
PR fluxcd#2520 broke the scoping of imagePullSecrets when allowing to get workloads from all namespaces at once. The problem is that a secret cache (`seenCreds`) was indexed by the secret name (making it namespace specific). Processing all the namespaces at once without adjusting the scoping opened the door to clashes between secrets from different namespaces which are called the same.
what
Improve logic for fetching resources from the cluster
why
Flux fetches resources from all namespaces on a per namespace basis even if we tell flux to deploy in all namespaces. This becomes an issue when there are a lot of namespaces and a lot of resource kinds.
use-case
We have 300+ namespaces and 25+ CRDs in our cluster and it takes about 13.5 minutes for only the resources to be fetched which is a problem for us since we want to sync changes every minute. This PR improves the performance significantly by fetching resources from all namespaces if that is enabled instead of a per namespace basis.