3.4. 容器镜像准备参数

用于准备您的容器的默认文件 (containers-prepare-parameter.yaml) 包含 ContainerImagePrepare Heat 参数。此参数定义一个用于准备一系列镜像的策略列表:

parameter_defaults:
  ContainerImagePrepare:
  - (strategy one)
  - (strategy two)
  - (strategy three)
  ...

每一策略接受一组子参数,它们定义要使用哪些镜像以及如何对待它们。下表包含有关您可与每个 ContainerImagePrepare 策略配合使用的子参数的信息:

参数描述

excludes

从策略中排除的镜像名称子字符串列表。

includes

包括在策略中的镜像名称子字符串列表。至少一个镜像名称必须与现有镜像匹配。如果指定了 includes,将忽略所有 excludes

modify_append_tag

要附加到目标镜像标签的字符串。例如,如果使用标签 14.0-89 拉取镜像并将 modify_append_tag 设置为 -hotfix,director 会将最终镜像标记为 14.0-89-hotfix

modify_only_with_labels

过滤镜像进行修改的镜像标签字典。如果镜像与定义的标签匹配,则 director 将该镜像包括在修改过程中。

modify_role

在上传期间但在将镜像推送到目标 registry 之前运行的 ansible 角色名称字符串。

modify_vars

要传递给 modify_role 的变量的字典。

push_destination

用于在上传过程中推送镜像的注册表的命名空间。当为这个参数指定了一个命名空间后,所有镜像参数也会使用这个命名空间。如果设为 true,则 push_destination 设为 undercloud 注册表命名空间。建议不要在生产环境中将此参数设置为 false

pull_source

从中拉取原始容器镜像的源 registry 。

set

用于定义从何处获取初始镜像的 key: value 定义的字典。

tag_from_label

定义标记 (tag) 生成的镜像的标签特征。通常设置为 {version}-{release}

set 参数接受一组 key: value 定义。下表包含键的相关信息:

描述

ceph_image

Ceph Storage 容器镜像的名称。

ceph_namespace

Ceph Storage 容器镜像的命名空间。

ceph_tag

Ceph Storage 容器镜像的标签。

name_prefix

各个 OpenStack 服务镜像的前缀。

name_suffix

各个 OpenStack 服务镜像的后缀。

namespace

各个 OpenStack 服务镜像的命名空间。

neutron_driver

用于确定要使用的 OpenStack Networking (neutron) 容器的驱动程序。null 值代表使用标准的 neutron-server 容器。设为 ovn 可使用基于 OVN 的容器。设为 odl 可使用基于 OpenDaylight 的容器。

tag

director 用于识别要从源 registry 中拉取的镜像的标签。这个项通常会被设置为 latest

ContainerImageRegistryCredentials 参数将容器 registry 映射到用户名和密码以对该 registy 进行验证。

如果容器 registry 需要用户名和密码,则可使用 ContainerImageRegistryCredentials 以下语法包括它们的值:

  ContainerImagePrepare:
  - push_destination: 192.168.24.1:8787
    set:
      namespace: registry.redhat.io/...
      ...
  ContainerImageRegistryCredentials:
    registry.redhat.io:
      my_username: my_password

在示例中,用身份验证凭据替换 my_usernamemy_password。红帽建议创建一个 registry 服务帐户并使用这些凭据访问 registry.redhat.io 内容,而不使用您的个人用户凭据。有关更多信息,请参阅“红帽容器 registry 身份验证”