2.6. Operator 如何选择容器镜像


如果 CR 不包含 spec.deploymentPlan.imagespec.deployment.Plan.initImage 属性,它指定 Operator 必须部署的特定容器镜像的 registry URL,Operator 会自动选择要部署的适当容器镜像。

注意

如果使用 OpenShift 命令行界面安装 Operator,Operator 安装存档会包括一个名为 broker_activemqartemis_cr.yaml 的 CR 文件示例。在示例 CR 中,spec.deploymentPlan.image 属性包含并设置为其 占位符 的默认值。这个值表示在部署 CR 前,Operator 不会选择代理容器镜像。

指定 Init 容器镜像的 spec.deploymentPlan.initImage 属性 不包含在 broker_activemqartemis_cr.yaml 示例 CR 文件中。如果您没有在 CR 中显式包含 spec.deploymentPlan.initImage 属性,并指定一个值,Operator 会选择一个与所选 Operator 容器镜像版本匹配的内置 Init 容器镜像。

要选择 broker 和 Init 容器镜像,Operator 首先决定所需的镜像的 AMQ Broker 版本。Operator 从 spec.version 属性的值获取版本。如果没有设置 spec.version 属性,Operator 将使用 AMQ Broker 的镜像的最新版本。

然后,Operator 会检测您的容器平台。AMQ Broker Operator 可以在以下容器平台中运行:

  • OpenShift Container Platform (x86_64)
  • OpenShift Container Platform on IBM Z (s390x)
  • IBM Power 系统上的 OpenShift Container Platform (ppc64le)

根据 AMQ Broker 和容器平台的版本,Operator 会在 operator.yaml 配置文件中引用两组环境变量。这些一组环境变量为 AMQ Broker 的不同版本指定 broker 和 Init 容器镜像,如以下部分所述。

2.6.1. 代理和 init 容器镜像的环境变量

operator.yaml 中包含的环境变量有以下命名约定。

容器平台命名规则

OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_<AMQ_Broker_version>

IBM Z 上的 OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_<AMQ_Broker_version>_s390x

IBM Power 系统上的 OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_<AMQ_Broker_version>_ppc64le

以下是代理和 init 容器镜像的环境变量名称示例,用于每个支持的容器平台。

容器平台环境变量名称

OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_7117
RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_7117

IBM Z 上的 OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_7117_s390x
RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_s390x_7117

IBM Power 系统上的 OpenShift Container Platform

RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_7117_ppc64le
RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_ppc64le_7117

每个环境变量的值指定红帽提供的容器镜像的地址。镜像名称由 安全哈希算法 (SHA)值表示。例如:

- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_7117
  value: registry.redhat.io/amq7/amq-broker-rhel8@sha256:137b893ad15e0cd5353bae134c8fae833257a12641b12d0f774f1565ce66f63c

因此,基于 AMQ Broker 版本和容器平台,Operator 决定代理和 init 容器的适用环境变量名称。在启动代理容器时,Operator 会使用对应的镜像值。

其他资源

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.