Major concepts:
* cluster cache
* cache sync
* kubectl semaphore
* project cache
* orphaned resource index
* comparison levels
* managed resources cache
* resource tree cache
* app refresh queue
* app comparison type refresh queue???
* app refresh type
* project refresh queue
* app operation queue
* app informer
* project informer
* DB (cluster info + other stuff?)
* clusters
* repositories
* repo creds
* repo certs
* gpg keys
* controller replicas
* audit logger
* cluster info updater
# Cluster Cache
Argo CD maintains a cache of information on all resources on each configured cluster (some resources may be excluded from monitoring via RBAC or configured resource exclusions.) Argo CD uses dynamic resource discovery to determine what resources to watch. When new kinds or apiVersions are discovered, new watches are set up for those resources. When a kind or apiVersion is removed, the watches are shut down.
The resources are watched via listers and watchers. We don't use informers, because we don't need to maintain caches of the full resources, just some metadata about those resources.
When Argo CD starts up, a significant amount of time and resources go towards warming the cache (i.e. running the initial discovery and lists). After that initial setup, the watchers take over cache maintenance.
By default, every 24 hours the cluster cache is completely cleared and rebuilt. This is meant to clean up any old state which might be incorrect due to missed watch events.