|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * operators/user/olm-installing-operators-in-namespace.adoc |
| 4 | +// * operators/admin/olm-adding-operators-to-cluster.adoc |
| 5 | + |
| 6 | +ifeval::["{context}" == "olm-installing-operators-in-namespace"] |
| 7 | +:olm-user: |
| 8 | +endif::[] |
| 9 | + |
| 10 | +[id="olm-installing-specific-version-cli_{context}"] |
| 11 | += Installing a specific version of an Operator |
| 12 | + |
| 13 | +You can install a specific version of an Operator by setting the cluster service version (CSV) in a `Subscription` object. |
| 14 | + |
| 15 | +.Prerequisites |
| 16 | + |
| 17 | +ifndef::olm-user[] |
| 18 | +- Access to an {product-title} cluster using an account with |
| 19 | +ifdef::openshift-enterprise,openshift-webscale,openshift-origin[] |
| 20 | +`cluster-admin` permissions |
| 21 | +endif::[] |
| 22 | +ifdef::openshift-dedicated[] |
| 23 | +`dedicated-admins-cluster` permissions |
| 24 | +endif::[] |
| 25 | +endif::[] |
| 26 | + |
| 27 | +ifdef::olm-user[] |
| 28 | +- Access to an {product-title} cluster using an account with Operator installation permissions |
| 29 | +endif::[] |
| 30 | + |
| 31 | +- OpenShift CLI (`oc`) installed |
| 32 | + |
| 33 | +.Procedure |
| 34 | + |
| 35 | +. Create a `Subscription` object YAML file that subscribes a namespace to an Operator with a specific version by setting the `startingCSV` field. Set the `installPlanApproval` field to `Manual` to prevent the Operator from automatically upgrading if a later version exists in the catalog. |
| 36 | ++ |
| 37 | +For example, the following `sub.yaml` file can be used to install the Red Hat Quay Operator specifically to version 3.4.0: |
| 38 | ++ |
| 39 | +.Subscription with a specific starting Operator version |
| 40 | +[source,yaml] |
| 41 | +---- |
| 42 | +apiVersion: operators.coreos.com/v1alpha1 |
| 43 | +kind: Subscription |
| 44 | +metadata: |
| 45 | + name: quay-operator |
| 46 | + namespace: quay |
| 47 | +spec: |
| 48 | + channel: quay-v3.4 |
| 49 | + installPlanApproval: Manual <1> |
| 50 | + name: quay-operator |
| 51 | + source: redhat-operators |
| 52 | + sourceNamespace: openshift-marketplace |
| 53 | + startingCSV: quay-operator.v3.4.0 <2> |
| 54 | +---- |
| 55 | +<1> Set the approval strategy to `Manual` in case your specified version is superseded by a later version in the catalog. This plan prevents an automatic upgrade to a later version and requires manual approval before the starting CSV can complete the installation. |
| 56 | +<2> Set a specific version of an Operator CSV. |
| 57 | + |
| 58 | +. Create the `Subscription` object: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ oc apply -f sub.yaml |
| 63 | +---- |
| 64 | + |
| 65 | +. Manually approve the pending install plan to complete the Operator installation. |
0 commit comments