Reputation: 529
In Openshift we have a BuildConfig which depends on an image from hub.docker.com (ubuntu:xenial
).
strategy:
type: Docker
dockerStrategy:
from:
kind: ImageStreamTag
namespace: <my namespace>
name: 'ubuntu:xenial'
forcePull: true
For this I created an ImageStream with the following config:
apiVersion: v1
kind: ImageStream
metadata:
name: ubuntu
namespace: <my namespace>
spec:
dockerImageRepository: registry.hub.docker.com/library/ubuntu
I now would like to run my BuildConfig whenever the upstream Ubuntu image changes. I can update the Ubuntu image manually by running oc import-image ubuntu
.
Is there another way to automatically update the image other than create an external cron job?
Versions
OpenShift Master: v1.3.1
Kubernetes Master: v1.3.0+52492b4
Upvotes: 4
Views: 3416
Reputation: 58523
Look at scheduled
field of the importPolicy
associated with the image stream tag.
$ oc explain is.spec.tags.importPolicy
RESOURCE: importPolicy <Object>
DESCRIPTION:
Import is information that controls how images may be imported by the
server.
TagImportPolicy describes the tag import policy
FIELDS:
insecure <boolean>
Insecure is true if the server may bypass certificate verification or
connect directly over HTTP during image import.
scheduled <boolean>
Scheduled indicates to the server that this tag should be periodically
checked to ensure it is up to date, and imported
There is a mention of it in:
Upvotes: 5
Reputation: 1543
As stated in documentation:
"Querying external registries to synchronize tag and image metadata is not currently an automated process. To resynchronize manually, run oc import-image . Within a short amount of time, OpenShift will communicate with the external registry to get up to date information about the Docker image repository associated with the image stream"
You can always take advantage of DockerHub Webhooks (they are triggered when an image is built in, or a new tag added):
https://docs.docker.com/docker-hub/webhooks/
Upvotes: 0