k8s-image-swapper icon indicating copy to clipboard operation
k8s-image-swapper copied to clipboard

Feature request: max image age

Open jgournet opened this issue 9 months ago • 2 comments

Hi,

We have a few applications that are set to run as "latest" image ( I know, we should not - but we do). Once written to ECR, this "latest" will stay there forever ... so it will soon become "not latest".

From reading https://github.com/estahn/k8s-image-swapper/issues/843 , it seems some users have decided to wipe all images via ECR policy to force this - which introduces quite some issues (PullImageBackOff namely).

What about adding a new setting like "max_image_days" (default to "0" for infinite, to avoid changing current deployments) ? then k8s-image-swapper could just push again when it reaches that max_age.

jgournet avatar Feb 26 '25 23:02 jgournet

This should already be handled if you set imagePullPolicy: Always - then the copier will not just use existing images, it'll always check the upstream image to see if there's a newer version to copy

https://github.com/estahn/k8s-image-swapper/blob/13d52179de724fc437b6e7118b4f4d29a053ab7b/pkg/webhook/image_copier.go#L92

mikebryant avatar Apr 03 '25 09:04 mikebryant

Yes, but then, that counts as 1 dockerhub pull; which is now limited to 10 per hour

jgournet avatar Apr 03 '25 20:04 jgournet