argoproj / argo-cd

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

Feature proposal: Watch clusterDecisionResource objects for changes #15411

Open cezarsa opened 1 year ago

cezarsa commented 1 year ago

Summary

The ClusterDecisionResource generator relies on periodic requeuing to detect changes to the duck-type resource being used for decisions. It would be great if we were able to detect changes without requeuing.

Motivation

It's desirable for ArgoCD to react to changes to the decision resource as fast as possible. The default requeue interval in the generator is 3m and the examples on the docs suggest a requeue interval of 1m. However, most of the time this is just wasting CPU cycles on both the controller and the k8s API server, and it gets worse as we lower the requeue interval if one wants to detect changes faster.

Proposal

Instead of relying only on requeues, the controller could create an Informer for the duck-type resource and WATCH it for changes instead. This would require some rework on the main appset controller but it should be doable. If there are no objections I can try working on a PR for this.

reedjosh commented 5 months ago

I am PoC-ing with this generator right now, and if the PoC goes well, I'm thinking I may also want to work on this feature. Will ping back if so. 😄