Skip to content

Commit d9b2906

Browse files
OSDOCS-1929: Discover Operator versions and channels from the CLI
1 parent 5458844 commit d9b2906

File tree

2 files changed

+126
-3
lines changed

2 files changed

+126
-3
lines changed

modules/olm-installing-specific-version-cli.adoc

Lines changed: 125 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,131 @@ endif::[]
3030
3131
.Procedure
3232

33+
. Look up the available versions and channels of the Operator you want to install by running the following command:
34+
+
35+
.Command syntax
36+
[source,terminal]
37+
----
38+
$ oc describe packagemanifests <operator_name> -n <catalog_namespace>
39+
----
40+
+
41+
For example, the following command prints the available channels and versions of the Red Hat Quay Operator from OperatorHub:
42+
+
43+
.Example command
44+
[source,terminal]
45+
----
46+
$ oc describe packagemanifests quay-operator -n openshift-marketplace
47+
----
48+
+
49+
.Example output
50+
[%collapsible]
51+
====
52+
[source,text]
53+
----
54+
Name: quay-operator
55+
Namespace: operator-marketplace
56+
Labels: catalog=redhat-operators
57+
catalog-namespace=openshift-marketplace
58+
hypershift.openshift.io/managed=true
59+
operatorframework.io/arch.amd64=supported
60+
operatorframework.io/os.linux=supported
61+
provider=Red Hat
62+
provider-url=
63+
Annotations: <none>
64+
API Version: packages.operators.coreos.com/v1
65+
Kind: PackageManifest
66+
...
67+
Current CSV: quay-operator.v3.7.11
68+
...
69+
Entries:
70+
Name: quay-operator.v3.7.11
71+
Version: 3.7.11
72+
Name: quay-operator.v3.7.10
73+
Version: 3.7.10
74+
Name: quay-operator.v3.7.9
75+
Version: 3.7.9
76+
Name: quay-operator.v3.7.8
77+
Version: 3.7.8
78+
Name: quay-operator.v3.7.7
79+
Version: 3.7.7
80+
Name: quay-operator.v3.7.6
81+
Version: 3.7.6
82+
Name: quay-operator.v3.7.5
83+
Version: 3.7.5
84+
Name: quay-operator.v3.7.4
85+
Version: 3.7.4
86+
Name: quay-operator.v3.7.3
87+
Version: 3.7.3
88+
Name: quay-operator.v3.7.2
89+
Version: 3.7.2
90+
Name: quay-operator.v3.7.1
91+
Version: 3.7.1
92+
Name: quay-operator.v3.7.0
93+
Version: 3.7.0
94+
Name: stable-3.7
95+
...
96+
Current CSV: quay-operator.v3.8.5
97+
...
98+
Entries:
99+
Name: quay-operator.v3.8.5
100+
Version: 3.8.5
101+
Name: quay-operator.v3.8.4
102+
Version: 3.8.4
103+
Name: quay-operator.v3.8.3
104+
Version: 3.8.3
105+
Name: quay-operator.v3.8.2
106+
Version: 3.8.2
107+
Name: quay-operator.v3.8.1
108+
Version: 3.8.1
109+
Name: quay-operator.v3.8.0
110+
Version: 3.8.0
111+
Name: stable-3.8
112+
Default Channel: stable-3.8
113+
Package Name: quay-operator
114+
----
115+
====
116+
+
117+
[TIP]
118+
====
119+
You can format an Operator's version and channel information in the YAML format by running the following command:
120+
121+
[source,terminal]
122+
----
123+
$ oc get packagemanifests <operator_name> -n <catalog_namespace> -o yaml
124+
----
125+
====
126+
127+
. 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.
128+
+
129+
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.
130+
+
131+
However, if the Operator uses the `SingleNamespace` mode and you do not already have an appropriate Operator group in place, you must create one:
132+
133+
.. Create an `OperatorGroup` object YAML file, for example `operatorgroup.yaml`:
134+
+
135+
.Example `OperatorGroup` object
136+
[source,yaml]
137+
----
138+
apiVersion: operators.coreos.com/v1
139+
kind: OperatorGroup
140+
metadata:
141+
name: <operatorgroup_name>
142+
namespace: <namespace>
143+
spec:
144+
targetNamespaces:
145+
- <namespace>
146+
----
147+
148+
.. Create the `OperatorGroup` object:
149+
+
150+
[source,terminal]
151+
----
152+
$ oc apply -f operatorgroup.yaml
153+
----
154+
33155
. 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.
34156
+
35-
For example, the following `sub.yaml` file can be used to install the Red Hat Quay Operator specifically to version 3.4.0:
157+
For example, the following `sub.yaml` file can be used to install the Red Hat Quay Operator specifically to version 3.7.10:
36158
+
37159
.Subscription with a specific starting Operator version
38160
[source,yaml]
@@ -43,12 +165,12 @@ metadata:
43165
name: quay-operator
44166
namespace: quay
45167
spec:
46-
channel: quay-v3.4
168+
channel: quay-operator.v3.7.10
47169
installPlanApproval: Manual <1>
48170
name: quay-operator
49171
source: redhat-operators
50172
sourceNamespace: openshift-marketplace
51-
startingCSV: quay-operator.v3.4.0 <2>
173+
startingCSV: quay-operator.v3.7.10 <2>
52174
----
53175
<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.
54176
<2> Set a specific version of an Operator CSV.

operators/admin/olm-adding-operators-to-cluster.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ include::modules/olm-installing-specific-version-cli.adoc[leveloffset=+1]
3737
.Additional resources
3838
3939
* xref:../../operators/admin/olm-upgrading-operators.adoc#olm-approving-pending-upgrade_olm-upgrading-operators[Manually approving a pending Operator update]
40+
* xref:../../operators/admin/olm-adding-operators-to-cluster.adoc#olm-installing-global-namespaces_olm-adding-operators-to-a-cluster[Installing global Operators in custom namespaces]
4041
4142
include::modules/olm-preparing-multitenant-operators.adoc[leveloffset=+1]
4243
.Next steps

0 commit comments

Comments
 (0)