搜索

5.7.2. 在 Operator Lifecycle Manager 中测试 Operator 升级

download PDF

您可以使用 Operator Lifecycle Manager(OLM)集成 Operator SDK 来快速测试 Operator 升级,而无需手动管理索引镜像和目录源。

run bundle-upgrade 子命令通过为以后的版本指定捆绑包镜像来自动触发已安装的 Operator 以升级到更新的版本。

先决条件

  • 使用 run bundle 子命令安装 OLM 的 operator
  • 代表已安装 Operator 的更新版本的捆绑包镜像

流程

  1. 如果使用 run bundle 子命令的 OLM 尚未安装 Operator,请通过指定捆绑包镜像来安装 Operator 的早期版本。例如,对于 Memcached Operator:

    $ operator-sdk run bundle <registry>/<user>/memcached-operator:v0.0.1

    输出示例

    INFO[0009] Successfully created registry pod: quay-io-demo-memcached-operator-v0-0-1
    INFO[0009] Created CatalogSource: memcached-operator-catalog
    INFO[0010] OperatorGroup "operator-sdk-og" created
    INFO[0010] Created Subscription: memcached-operator-v0-0-1-sub
    INFO[0013] Approved InstallPlan install-bqggr for the Subscription: memcached-operator-v0-0-1-sub
    INFO[0013] Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.1" to reach 'Succeeded' phase
    INFO[0013]   Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.1" to appear
    INFO[0019]   Found ClusterServiceVersion "my-project/memcached-operator.v0.0.1" phase: Succeeded

  2. 通过为后续的 Operator 版本指定捆绑包镜像来升级已安装的 Operator:

    $ operator-sdk run bundle-upgrade <registry>/<user>/memcached-operator:v0.0.2

    输出示例

    INFO[0002] Found existing subscription with name memcached-operator-v0-0-1-sub and namespace my-project
    INFO[0002] Found existing catalog source with name memcached-operator-catalog and namespace my-project
    INFO[0009] Successfully created registry pod: quay-io-demo-memcached-operator-v0-0-2
    INFO[0009] Updated catalog source memcached-operator-catalog with address and annotations
    INFO[0010] Deleted previous registry pod with name "quay-io-demo-memcached-operator-v0-0-1"
    INFO[0041] Approved InstallPlan install-gvcjh for the Subscription: memcached-operator-v0-0-1-sub
    INFO[0042] Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.2" to reach 'Succeeded' phase
    INFO[0042]   Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: InstallReady
    INFO[0043]   Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: Installing
    INFO[0044]   Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: Succeeded
    INFO[0044] Successfully upgraded to "memcached-operator.v0.0.2"

  3. 清理已安装的 Operator:

    $ operator-sdk cleanup memcached-operator
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.