14.2.3. 创建 Operator imageContentSourcePolicy

oc adm catalog mirror 命令完成后,imageContentSourcePolicy.yaml 文件会被创建。通常,此文件的输出目录为 ./[catalog image name]-manifests)。使用这个流程在 .yaml 文件中添加任何缺少的条目,并将其应用到集群。

流程

  1. 检查此文件的内容是否有如下所示的镜像映射:

    spec:
      repositoryDigestMirrors:
        - mirrors:
          - <your_registry>/ocs4
          source: registry.redhat.io/ocs4
        - mirrors:
          - <your_registry>/rhceph
          source: registry.redhat.io/rhceph
        - mirrors:
          - <your_registry>/openshift4
          source: registry.redhat.io/openshift4
        - mirrors:
          - <your_registry>/rhscl
          source: registry.redhat.io/rhscl
  2. imageContentSourcePolicy.yaml 文件的末尾添加任何缺少的条目。
  3. 将 imageContentSourcePolicy.yaml 文件应用到集群。

    $ oc apply -f ./[output dir]/imageContentSourcePolicy.yaml

    更新镜像内容源策略后,需要更新并重新引导集群中的所有节点(master、infra 和 worker)。此过程通过 Machine Config Pool operator 自动处理,最多需要 30 分钟,尽管确切经过的时间可能因 OpenShift 集群中的节点数量而异。您可以使用 oc get mcp 命令或 oc get node 命令来监控更新过程。