|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * operators/operator_sdk/osdk-working-bundle-images.adoc |
| 4 | + |
| 5 | +[id="osdk-bundle-upgrade-olm_{context}"] |
| 6 | += Testing an Operator upgrade on Operator Lifecycle Manager |
| 7 | + |
| 8 | +You can quickly test upgrading your Operator by using Operator Lifecycle Manager (OLM) integration in the Operator SDK, without requiring you to manually manage index images and catalog sources. |
| 9 | + |
| 10 | +The `run bundle-upgrade` subcommand automates triggering an installed Operator to upgrade to a later version by specifying a bundle image for the later version. |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +- Operator installed with OLM by using the `run bundle` subcommand |
| 15 | +- A bundle image that represents a later version of the installed Operator |
| 16 | + |
| 17 | +.Procedure |
| 18 | + |
| 19 | +. If your Operator has not already been installed on OLM with the `run bundle` subcommand, install the earlier version of your Operator by specifying the bundle image. For example, for a Memcached Operator: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ operator-sdk run bundle <registry>/<user>/memcached-operator:v0.0.1 |
| 24 | +---- |
| 25 | ++ |
| 26 | +.Example output |
| 27 | +[source,terminal] |
| 28 | +---- |
| 29 | +INFO[0009] Successfully created registry pod: quay-io-demo-memcached-operator-v0-0-1 |
| 30 | +INFO[0009] Created CatalogSource: memcached-operator-catalog |
| 31 | +INFO[0010] OperatorGroup "operator-sdk-og" created |
| 32 | +INFO[0010] Created Subscription: memcached-operator-v0-0-1-sub |
| 33 | +INFO[0013] Approved InstallPlan install-bqggr for the Subscription: memcached-operator-v0-0-1-sub |
| 34 | +INFO[0013] Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.1" to reach 'Succeeded' phase |
| 35 | +INFO[0013] Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.1" to appear |
| 36 | +INFO[0019] Found ClusterServiceVersion "my-project/memcached-operator.v0.0.1" phase: Succeeded |
| 37 | +---- |
| 38 | + |
| 39 | +. Upgrade the installed Operator by specifying the bundle image for the later Operator version: |
| 40 | ++ |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +$ operator-sdk run bundle-upgrade <registry>/<user>/memcached-operator:v0.0.2 |
| 44 | +---- |
| 45 | ++ |
| 46 | +.Example output |
| 47 | +[source,terminal] |
| 48 | +---- |
| 49 | +INFO[0002] Found existing subscription with name memcached-operator-v0-0-1-sub and namespace my-project |
| 50 | +INFO[0002] Found existing catalog source with name memcached-operator-catalog and namespace my-project |
| 51 | +INFO[0009] Successfully created registry pod: quay-io-demo-memcached-operator-v0-0-2 |
| 52 | +INFO[0009] Updated catalog source memcached-operator-catalog with address and annotations |
| 53 | +INFO[0010] Deleted previous registry pod with name "quay-io-demo-memcached-operator-v0-0-1" |
| 54 | +INFO[0041] Approved InstallPlan install-gvcjh for the Subscription: memcached-operator-v0-0-1-sub |
| 55 | +INFO[0042] Waiting for ClusterServiceVersion "my-project/memcached-operator.v0.0.2" to reach 'Succeeded' phase |
| 56 | +INFO[0042] Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: InstallReady |
| 57 | +INFO[0043] Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: Installing |
| 58 | +INFO[0044] Found ClusterServiceVersion "my-project/memcached-operator.v0.0.2" phase: Succeeded |
| 59 | +INFO[0044] Successfully upgraded to "memcached-operator.v0.0.2" |
| 60 | +---- |
| 61 | + |
| 62 | +. Clean up the installed Operators: |
| 63 | ++ |
| 64 | +[source,terminal] |
| 65 | +---- |
| 66 | +$ operator-sdk cleanup memcached-operator |
| 67 | +---- |
0 commit comments