4.13. 镜像设置配置示例


以下 ImageSetConfiguration 文件示例演示了各种镜像用例的配置。

使用案例:包含最短的 OpenShift Container Platform 升级路径

以下 ImageSetConfiguration 文件使用本地存储后端,并包括所有 OpenShift Container Platform 版本,以及从最低 4.11.37 版本到最大 4.12.15 版本的升级路径。

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.12
        minVersion: 4.11.37
        maxVersion: 4.12.15
        shortestPath: true

使用案例:包含从最小到最新的 OpenShift Container Platform 的所有版本

以下 ImageSetConfiguration 文件使用一个 registry 存储后端,并包括从最小 4.10.10 迁移到频道中最新版本的所有 OpenShift Container Platform 版本。

对于每个使用此镜像集合配置的 oc-mirror,评估 stable-4.10 频道的最新发行版本,因此定期运行 oc-mirror 可确保您自动收到最新版本的 OpenShift Container Platform 镜像。

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  platform:
    channels:
      - name: stable-4.10
        minVersion: 4.10.10

使用案例:包含从最低到最新的 Operator 版本

以下 ImageSetConfiguration 文件使用本地存储后端,仅包含 stable 频道中从 4.0.1 及之后的版本开始的 Red Hat Advanced Cluster Security for Kubernetes Operator。

注意

当您指定了一个最小或最大版本范围时,可能不会接收该范围内的所有 Operator 版本。

默认情况下,oc-mirror 排除了 Operator Lifecycle Manager (OLM)规格中跳过或被较新的版本替换的任何版本。跳过的 Operator 版本可能会受到 CVE 或包含错误的影响。改为使用较新版本。有关跳过和替换版本的更多信息,请参阅使用 OLM 创建更新图表

要接收指定范围内的所有 Operator 版本,您可以将 mirror.operators.full 字段设置为 true

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12
      packages:
        - name: rhacs-operator
          channels:
          - name: stable
            minVersion: 4.0.1

注意

要指定最大版本而不是最新的版本,请设置 mirror.operators.packages.channels.maxVersion 字段。

使用案例:包含 Nutanix CSI Operator

以下 ImageSetConfiguration 文件使用本地存储后端,并包括 Nutanix CSI Operator、OpenShift Update Service (OSUS)图形镜像以及额外的 Red Hat Universal Base Image (UBI)。

ImageSetConfiguration 文件示例

kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    imageURL: mylocalregistry/ocp-mirror/openshift4
    skipTLS: false
mirror:
  platform:
    channels:
    - name: stable-4.12
      type: ocp
    graph: true
  operators:
  - catalog: registry.redhat.io/redhat/certified-operator-index:v4.12
    packages:
    - name: nutanixcsioperator
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi9/ubi:latest

使用案例:包含默认 Operator 频道

以下 ImageSetConfiguration 文件包括 OpenShift Elasticsearch Operator 的stable-5.7stable 频道。即使只需要 stable-5.7 频道中的软件包,stable 频道也必须包含在 ImageSetConfiguration 文件中,因为它是 Operator 的默认频道。即使您没有使用该频道中的捆绑包,还必须始终包含 Operator 软件包的默认频道。

提示

您可以运行以下命令来找到默认频道:oc mirror list operators --catalog=<catalog_name> --package=<package_name>

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12
    packages:
    - name: elasticsearch-operator
      channels:
      - name: stable-5.7
      - name: stable

使用案例:包含整个目录(所有版本)

以下 ImageSetConfiguration 文件将 mirror.operators.full 字段设置为 true,使其包含整个 Operator 目录的所有版本。

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12
      full: true

使用案例:包含整个目录(仅限频道头)

以下 ImageSetConfiguration 文件包含整个 Operator 目录的频道头。

默认情况下,对于目录中的每个 Operator,oc-mirror 都包含来自默认频道的最新 Operator 版本(频道头)。如果要镜像所有 Operator 版本,而不仅仅是频道头,您必须将 mirror.operators.full 字段设置为 true

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12

用例:包含任意镜像和 helm chart

以下 ImageSetConfiguration 文件使用 registry 存储后端,并包含 helm chart 和额外的 Red Hat Universal Base Image(UBI)。

ImageSetConfiguration 文件示例

apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
archiveSize: 4
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
 platform:
   architectures:
     - "s390x"
   channels:
     - name: stable-4.12
 operators:
   - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12
 helm:
   repositories:
     - name: redhat-helm-charts
       url: https://raw.githubusercontent.com/redhat-developer/redhat-helm-charts/master
       charts:
         - name: ibm-mongodb-enterprise-helm
           version: 0.2.0
 additionalImages:
   - name: registry.redhat.io/ubi9/ubi:latest

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.