Description
What would you like to be added?
Add another option for a container's imagePullPolicy
, which attempts to pull the image, and falls back to using a local cached copy if the image could not be pulled.
Why is this needed?
In development, images are frequently updated, so it's essential to grab the latest version of the image to test against.
In production, single points of failure should be minimized, so if the image is available through the repository OR cached locally, then the container should be able to start up (i.e. neither the repo nor the local cache is a single point of failure).
Currently, imagePullPolicy
only offers three options:
Always
: Only tries to pull the image; ignores cache and fails if repository is unavailableIfNotPresent
: First tries to use a cached image; falls back to pulling the imageNever
: Only tries to use cached image; ignores repository
From these options, Always
is the only one that grabs the latest changes, so it's the only suitable option for development, but it turns the repository into a single point of failure, so it's not suitable for production unless you're okay with everything breaking if the repository goes offline.
In addition, using the latest
tag (or any other tag that changes, like a v1
tag that gives the latest 1.x.y version) only works if the imagePullPolicy
is Always
, or the image cache on each node is cleared whenever the tag is updated, so if those tags are used in production, and you don't want the repository to be a single point of failure, then there is NO suitable option for production at all.
A fourth option, which first tries to pull the image, and falls back to using a cached copy (the inverse of IfNotPresent
), would be well-suited to both development and production, and would fit in very nicely in between Always
and IfNotPresent
.
Honestly, I think this would be the only imagePullPolicy
I would ever use for ANYTHING I do (work and personal projects) if it were available, and I don't understand why it's missing.