[ArgoCD] Cache key enhancement
Summary
Argocd is using cache key as "...", which may be modified to "%s...", where %s by default is "" but can be given any value "abc" through environmental variable on-demand after which the key becomes "abc..."
Motivation
- Multiple instances of argocd may use centralized cache instance which can be opted by end user on-demand...
- Assuming 500 argocd instances with 3 redis pods each are running across organizations in an enterprise, where total pod count becomes 1500 for only redis, also can't ensure usage of all those instances are to the fullest, may be a dedicated cluster of redis made with 3,5, etc instances of redis would benefit...
Proposal
Cache struct in cache.go -> can have another prefix string field which get data through os.env or similar to how REDIS_PASSWORD is getting injected as shown below
type Cache struct {
client CacheClient
prefix string `default:""`
}
Other changes would be in package named reposerver/cache.go, server/cache.go, util/cache.go, util/cache/appstate.go where cache key is getting generated like in util/cache/go currently its
func (c *Cache) GetItem(key string, item interface{}) error {
if item == nil {
return fmt.Errorf("cannot get item into a nil for key %s", key)
}
key = fmt.Sprintf("%s|%s", key, common.CacheVersion)
return c.client.Get(key, item)
}
and it becomes
func (c *Cache) GetItem(key string, item interface{}) error {
if item == nil {
return fmt.Errorf("cannot get item into a nil for key %s", key)
}
key = fmt.Sprintf("%s%s|%s", c.GetPrefix(), key, common.CacheVersion)
return c.client.Get(key, item)
}
@crenshaw-dev Can you review the proposal! As we are willing to contribute to this issue as it would benefit us in the long run!
@crenshaw-dev Can you please review the proposal!
@rajarshipal-lab I like the idea. My only question would be whether there's some existing "instance name" config item we can reuse for this prefix. There are other use cases which require disambiguation among Argo CD instances. Maybe we can reuse something that already exists. I've added this to Thursday's contributor meeting agenda.
Hi everyone
I was researching about if this could be possible. But at contributor meeting agenda says that september 21th this topic would be discussed. But I couldn't find the recording of it and any more information related to this, but the issue still open. Could someone share more info, please?
Thanks in advance
Any update on this?
Any update on this?
@rotemjac If you are willing to proceed with the implementation, please proceed, as we have figured out some workaround on our side
we have figured out some workaround on our side
Could you share your workaround? I am very interested and looking to integrate this