Openshift:自动更新上游图像

Phi*_*hil 4 openshift openshift-origin

在Openshift中,我们有一个BuildConfig,它依赖于hub.docker.com(ubuntu:xenial)中的映像。

strategy:
  type: Docker
  dockerStrategy:
    from:
      kind: ImageStreamTag
      namespace: <my namespace>
      name: 'ubuntu:xenial'
    forcePull: true
Run Code Online (Sandbox Code Playgroud)

为此,我使用以下配置创建了一个ImageStream:

apiVersion: v1
kind: ImageStream
metadata:
  name: ubuntu
  namespace: <my namespace>
spec:
  dockerImageRepository: registry.hub.docker.com/library/ubuntu
Run Code Online (Sandbox Code Playgroud)

我现在想在上游Ubuntu映像更改时运行BuildConfig。我可以通过运行手动更新Ubuntu映像oc import-image ubuntu

除了创建外部cron作业以外,还有另一种自动更新映像的方法吗?

版本号

OpenShift Master: v1.3.1
Kubernetes Master: v1.3.0+52492b4
Run Code Online (Sandbox Code Playgroud)

Gra*_*ton 5

查看与图像流标签关联的scheduled字段importPolicy

$ 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
Run Code Online (Sandbox Code Playgroud)

在以下内容中有提及: