argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.37k stars 5.28k forks source link

Support a label selector for application controller #19566

Open jnovick opened 3 weeks ago

jnovick commented 3 weeks ago

Summary

Allow the application controller to be targeted to a applications that match a specific label selector.

Motivation

Since application controllers do not yet support sharding for many applications for the same cluster, this is a quick and easy win for being able to manually split the load on application controllers.

Proposal

I can put the PR up, but I believe the code already supports filtering by label in the client so we just would need to add the argument to the entrypoint and pass the value through.

Bondza commented 3 weeks ago

I was just about to create a duplicate issue of this, but instead I will just add in what I had written as a comment here:

Summary

The application controller seem to watch all applications in either one or all namespaces. This seem to always be the case since there is no way to specify the label selector that the informer should use to list and watch applications.

With a setup with multiple clusters where each cluster is managed by a separate shard and each cluster has its own set of applications, that are more or less the same per cluster, this means that each shard will list and watch all application resources. At least this is our understanding from poking around the application controller source.

Motivation

We manage the assignment of shards through a controller that manages the cluster secrets and application controllers. The controller also labels each application to depending on the cluster it belongs to. Since we have a controller to configure the application controllers we would like to be able to configure a label selector for applications so that each application controller only needs to list and watch the applications that it should manage. We currently have about 14k applications managed by more than 600 shards, so this would be a way to reduce resource usage of our application controller shards it would be great.

Proposal

Application controllers can configure the Application SharedInformer to use a label selector for list and watch.