argoproj / gitops-engine

Democratizing GitOps
https://pkg.go.dev/github.com/argoproj/gitops-engine?tab=subdirectories
Apache License 2.0
1.67k stars 251 forks source link

Enable consumers of gitops-engine API to specify an alternative temp directory to '/dev/shm', for generated manifests #614

Open jgwest opened 1 month ago

jgwest commented 1 month ago

At present, gitops-engine (and consumers of gitops-engine API) use /dev/shm to store temporary files that are passed to kubectl, such as manifests and cluster credentials. The temp directory logic can be found within pkg/utils/io/io.go.

One disadvantage of this is that since /dev/shm is backed by RAM, it has limited size. For many use cases this is not an issue, however, when concurrently deploying to a large number of Kubernetes clusters, or deploying large k8s manifests, /dev/shm can run out of disk space.

One option is that we could just move to using /tmp, rather than /dev/shm. But, it appears that /dev/shm was chosen intentionally to ensure that sensitive data (such as credentials) are kept off disk (absent disk caching of memory).

Thus, rather than moving to use /tmp, I propose instead allowing API consumers to optionally use a different path, which can then by enabled by API consumers (for example, Argo CD configmap value or env var)

I've also been tackling this problem by reducing the leaking of files into /dev/shm. You can see that work below.

Related issues: