evanlucas / fish-kubectl-completions

kubectl completions for fish shell
MIT License
576 stars 42 forks source link

Persist CRD cache in the filesystem #39

Closed morozov closed 2 years ago

morozov commented 2 years ago

I recently noticed that the CRD cache is valid only for 30 seconds. Additionally, it's not persisted between shell sessions. It's okay when using a local minikube cluster but is suboptimal when dealing with a remote one, especially if it's geographically remote. In my worst case, a call to kubectl get crd may take 4 seconds.

The proposal is instead of storing the cache in memory, store it in the filesystem. Additionally, make the cache TTL configurable (I could use at least something like 86400 instead of 30).

After implementing this patch, I realized that technically, each of the kubectl contexts may need its own cache. If you're interested in merging this patch, I'll make the cache scoped to the context.