enix / kube-image-keeper

kuik is a container image caching system for Kubernetes
MIT License
447 stars 34 forks source link

Configure CacheImages Resources to Default to Retain Images via Configuration #363

Closed csc-piscopo closed 2 months ago

csc-piscopo commented 3 months ago

Hi team,

I hope you're all doing well!

I wanted to propose an enhancement regarding the CacheImages resources. Specifically, I was wondering if there would be any appetite for configuring these resources to default to retaining images via a configuration setting.

This adjustment could be particularly beneficial in scale-to-zero scenarios, where pods are being removed along with their container images. By defaulting to retain images, we can improve startup times and overall performance when scaling back up, as the images will already be cached. This would reduce the overhead and latency associated with pulling images from the registry each time a pod is recreated.

Looking forward to hearing your thoughts on this idea!

paullaffitte commented 3 months ago

Hello,

You can configure the .cachedImagesExpiryDelay (in days) value from the helm chart. This way, images will be kept in cache for the given duration. The was implemented specifically for scale-to-zero scenarios. You could also write a script to add the retain flag on some images or write a kyverno policy.

Does one of this solution could solve your issue? Could you explain why if it doesn't? IMHO it's a good thing that images eventually expires in order to free up space.

Thanks!