mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
207 lines
6.6 KiB
Plaintext
207 lines
6.6 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * operators/user/olm-installing-operators-in-namespace.adoc
|
|
// * operators/admin/olm-adding-operators-to-cluster.adoc
|
|
|
|
ifeval::["{context}" == "olm-installing-operators-in-namespace"]
|
|
:olm-user:
|
|
endif::[]
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="olm-installing-specific-version-cli_{context}"]
|
|
= Installing a specific version of an Operator
|
|
|
|
You can install a specific version of an Operator by setting the cluster service version (CSV) in a `Subscription` object.
|
|
|
|
.Prerequisites
|
|
|
|
ifndef::olm-user[]
|
|
- Access to an {product-title} cluster using an account with
|
|
ifdef::openshift-enterprise,openshift-webscale,openshift-origin[]
|
|
`cluster-admin` permissions
|
|
endif::[]
|
|
ifdef::openshift-dedicated,openshift-rosa[]
|
|
the `dedicated-admin` role.
|
|
endif::[]
|
|
endif::[]
|
|
|
|
ifdef::olm-user[]
|
|
- Access to an {product-title} cluster using an account with Operator installation permissions.
|
|
endif::[]
|
|
|
|
- You have installed the OpenShift CLI (`oc`).
|
|
|
|
.Procedure
|
|
|
|
. Look up the available versions and channels of the Operator you want to install by running the following command:
|
|
+
|
|
.Command syntax
|
|
[source,terminal]
|
|
----
|
|
$ oc describe packagemanifests <operator_name> -n <catalog_namespace>
|
|
----
|
|
+
|
|
For example, the following command prints the available channels and versions of the Red Hat Quay Operator from OperatorHub:
|
|
+
|
|
.Example command
|
|
[source,terminal]
|
|
----
|
|
$ oc describe packagemanifests quay-operator -n openshift-marketplace
|
|
----
|
|
+
|
|
.Example output
|
|
[%collapsible]
|
|
====
|
|
[source,text]
|
|
----
|
|
Name: quay-operator
|
|
Namespace: operator-marketplace
|
|
Labels: catalog=redhat-operators
|
|
catalog-namespace=openshift-marketplace
|
|
hypershift.openshift.io/managed=true
|
|
operatorframework.io/arch.amd64=supported
|
|
operatorframework.io/os.linux=supported
|
|
provider=Red Hat
|
|
provider-url=
|
|
Annotations: <none>
|
|
API Version: packages.operators.coreos.com/v1
|
|
Kind: PackageManifest
|
|
...
|
|
Current CSV: quay-operator.v3.7.11
|
|
...
|
|
Entries:
|
|
Name: quay-operator.v3.7.11
|
|
Version: 3.7.11
|
|
Name: quay-operator.v3.7.10
|
|
Version: 3.7.10
|
|
Name: quay-operator.v3.7.9
|
|
Version: 3.7.9
|
|
Name: quay-operator.v3.7.8
|
|
Version: 3.7.8
|
|
Name: quay-operator.v3.7.7
|
|
Version: 3.7.7
|
|
Name: quay-operator.v3.7.6
|
|
Version: 3.7.6
|
|
Name: quay-operator.v3.7.5
|
|
Version: 3.7.5
|
|
Name: quay-operator.v3.7.4
|
|
Version: 3.7.4
|
|
Name: quay-operator.v3.7.3
|
|
Version: 3.7.3
|
|
Name: quay-operator.v3.7.2
|
|
Version: 3.7.2
|
|
Name: quay-operator.v3.7.1
|
|
Version: 3.7.1
|
|
Name: quay-operator.v3.7.0
|
|
Version: 3.7.0
|
|
Name: stable-3.7
|
|
...
|
|
Current CSV: quay-operator.v3.8.5
|
|
...
|
|
Entries:
|
|
Name: quay-operator.v3.8.5
|
|
Version: 3.8.5
|
|
Name: quay-operator.v3.8.4
|
|
Version: 3.8.4
|
|
Name: quay-operator.v3.8.3
|
|
Version: 3.8.3
|
|
Name: quay-operator.v3.8.2
|
|
Version: 3.8.2
|
|
Name: quay-operator.v3.8.1
|
|
Version: 3.8.1
|
|
Name: quay-operator.v3.8.0
|
|
Version: 3.8.0
|
|
Name: stable-3.8
|
|
Default Channel: stable-3.8
|
|
Package Name: quay-operator
|
|
----
|
|
====
|
|
+
|
|
[TIP]
|
|
====
|
|
You can print an Operator's version and channel information in the YAML format by running the following command:
|
|
|
|
[source,terminal]
|
|
----
|
|
$ oc get packagemanifests <operator_name> -n <catalog_namespace> -o yaml
|
|
----
|
|
====
|
|
|
|
** If more than one catalog is installed in a namespace, run the following command to look up the available versions and channels of an Operator from a specific catalog:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get packagemanifest \
|
|
--selector=catalog=<catalogsource_name> \
|
|
--field-selector metadata.name=<operator_name> \
|
|
-n <catalog_namespace> -o yaml
|
|
----
|
|
+
|
|
[IMPORTANT]
|
|
====
|
|
If you do not specify the Operator's catalog, running the `oc get packagemanifest` and `oc describe packagemanifest` commands might return a package from an unexpected catalog if the following conditions are met:
|
|
|
|
* Multiple catalogs are installed in the same namespace.
|
|
* The catalogs contain the same Operators or Operators with the same name.
|
|
====
|
|
|
|
. An Operator group, defined by an `OperatorGroup` object, selects target namespaces in which to generate required role-based access control (RBAC) access for all Operators in the same namespace as the Operator group.
|
|
+
|
|
The namespace to which you subscribe the Operator must have an Operator group that matches the install mode of the Operator, either the `AllNamespaces` or `SingleNamespace` mode. If the Operator you intend to install uses the `AllNamespaces` mode, then the `openshift-operators` namespace already has an appropriate Operator group in place.
|
|
+
|
|
However, if the Operator uses the `SingleNamespace` mode and you do not already have an appropriate Operator group in place, you must create one:
|
|
|
|
.. Create an `OperatorGroup` object YAML file, for example `operatorgroup.yaml`:
|
|
+
|
|
.Example `OperatorGroup` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1
|
|
kind: OperatorGroup
|
|
metadata:
|
|
name: <operatorgroup_name>
|
|
namespace: <namespace>
|
|
spec:
|
|
targetNamespaces:
|
|
- <namespace>
|
|
----
|
|
|
|
.. Create the `OperatorGroup` object:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f operatorgroup.yaml
|
|
----
|
|
|
|
. 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.
|
|
+
|
|
For example, the following `sub.yaml` file can be used to install the Red Hat Quay Operator specifically to version 3.7.10:
|
|
+
|
|
.Subscription with a specific starting Operator version
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
kind: Subscription
|
|
metadata:
|
|
name: quay-operator
|
|
namespace: quay
|
|
spec:
|
|
channel: stable-3.7
|
|
installPlanApproval: Manual <1>
|
|
name: quay-operator
|
|
source: redhat-operators
|
|
sourceNamespace: openshift-marketplace
|
|
startingCSV: quay-operator.v3.7.10 <2>
|
|
----
|
|
<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.
|
|
<2> Set a specific version of an Operator CSV.
|
|
|
|
. Create the `Subscription` object:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f sub.yaml
|
|
----
|
|
|
|
. Manually approve the pending install plan to complete the Operator installation.
|