Skip to content

Commit 75477e5

Browse files
author
Chris Negus
authored
Merge pull request #13739 from chrisnegus/operator-hub-features-4.0
Installing an Operator using the command line and expanded OperatorHub (Marketplace) descriptions
2 parents 96eb150 + fd78e5a commit 75477e5

File tree

4 files changed

+150
-1
lines changed

4 files changed

+150
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ cluster to Operators from the OperatorHub.
1414
include::modules/olm-operator-lifecycle-manager.adoc[leveloffset=+1]
1515
include::modules/olm-operatorhub.adoc[leveloffset=+1]
1616
include::modules/olm-installing-operator-using-operatorhub.adoc[leveloffset=+1]
17+
include::modules/olm-installing-operator-using-commands.adoc[leveloffset=+1]
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * applications/operators/olm-adding-operators-to-cluster.adoc
4+
5+
[id='olm-installing-operator-using-commands_{context}']
6+
7+
= Installing an Operator using the command line
8+
9+
Instead of using the {product-title} Web console, you can install an
10+
Operator from the command line. Use the `oc` command as follows to install
11+
(subscribe to) an Operator for a selected namespace.
12+
13+
.Prerequisites
14+
15+
- Access to an {product-title} 4 cluster using an account with `cluster-admin`
16+
permissions.
17+
18+
.Procedure
19+
20+
. To view a list of operators available from OperatorHub, type the following:
21+
+
22+
----
23+
$ oc get packagemanifest
24+
----
25+
26+
. To identify the Operators to install, create a CatalogSourceConfig object yaml file (for example, `csc.cr.yaml`)
27+
containing information similar to the following:
28+
29+
+
30+
.Example CatalogSourceConfig
31+
[source,yaml]
32+
----
33+
apiVersion: "marketplace.redhat.com/v1alpha1"
34+
kind: "CatalogSourceConfig"
35+
metadata:
36+
name: "example"
37+
namespace: "openshift-marketplace"
38+
spec:
39+
targetNamespace: "global" <1>
40+
packages: "operators/myoperator,operators/another-operator" <2>
41+
----
42+
<1> Set the `targetNamespace` to identify the namespace where you want the
43+
Operator to be available
44+
<2> Set `packages` to a comma-separated list of Operators to which
45+
you want to subscribe.
46+
47+
. To install the Operator to the selected namespace, type the following:
48+
+
49+
----
50+
$ oc apply -f csc.cr.yaml
51+
----
52+
53+
. Later, if you want to install more operators, you can simply update your
54+
CatalogSourceConfig file (in this example, csc.cr.yaml) with more packages.
55+
For example:
56+
+
57+
.Example updated CatalogSourceConfig
58+
[source,yaml]
59+
----
60+
apiVersion: "marketplace.redhat.com/v1alpha1"
61+
kind: "CatalogSourceConfig"
62+
metadata:
63+
name: "example"
64+
namespace: "openshift-marketplace"
65+
spec:
66+
targetNamespace: "global"
67+
packages: "operators/myoperator,operators/another-operator,operators/this-operator-too"
68+
<1>
69+
----
70+
<1> Add new packages to existing package list.
71+
72+
. To update the CatalogSourceConfig object, run the `oc apply` command again:
73+
+
74+
----
75+
$ oc apply -f csc.cr.yaml
76+
----
77+
+
78+
The Operator will generate a CatalogSource and ConfigMap from your
79+
CatalogSourceConfig in the specified namespace (targetNamespace).
80+
With the OLM aware of your selected Operator, follow the OLM workflow
81+
to use the Operator.
82+
83+
Before you can install your own Operators to cluster, you need to upload your
84+
Operator artifacts to Quay.io, then add your own `OperatorSource` to your
85+
cluster. Optionally, you can add Secrets to your Operator to provide authentication. The general steps for doing this are:
86+
87+
. link:https://github.com/operator-framework/operator-marketplace/blob/master/docs/how-to-upload-artifact.md[Pushing an Operator Artifact to an App Registry]
88+
. link:https://github.com/operator-framework/operator-marketplace/blob/master/docs/how-to-authenticate-private-repositories.md[Authenticating Operators in your Private App Registry Repositories]
89+
. link:https://github.com/operator-framework/operator-marketplace/blob/master/README.md#populating-your-own-app-registry-operatorsource[Adding OperatorSource to your cluster]
90+
91+
92+
After that, you can manage the Operator in your
93+
cluster as you would any other Operator.

modules/olm-installing-operator-using-operatorhub.adoc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,29 @@
77

88
As a cluster administrator, you can install an Operator using the OperatorHub in
99
the {product-title} web console to make it available for all developers using
10-
your cluster. This procedure uses the etcd Operator as an example.
10+
your cluster. The act of installing an Operator is also referred to as
11+
`subscribing` an Operator to a namespace.
12+
13+
This procedure uses the etcd Operator as an example. Here are a
14+
few decisions you can make when you install an Operator to a namespace:
15+
16+
* Target Namespace: A list of operator-group namespaces are presented for
17+
you to choose where the installed Operator will be available. This example
18+
chooses `global-operators`, to make the Operator available to all users and
19+
projects.
20+
21+
* Update Channel: If an Operator is available through multiple channels,
22+
you can choose which channel you want to subscribe to. For example, to deploy
23+
from the `stable` channel, select `stable` from the Update Channel drop-down
24+
list.
25+
26+
* Update Strategy: You can choose automatic or manual updates. If you choose Automatic updates for an
27+
installed Operator, when a new version of that Operator is available the
28+
OLM will automatically upgrade the running instance of your Operator
29+
without human intervention. If you select Manual updates, when a newer
30+
version of an Operator is available, the OLM will create an update request.
31+
As a cluster administrator, you need to manually approve that update request
32+
to have the Operator updated to the new version.
1133

1234
.Prerequisites
1335

modules/olm-operatorhub.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,36 @@ Community Operators::
2626
Optionally-visible software maintained by relevant representatives in the
2727
link:https://github.com/operator-framework/community-operators[operator-framework/community-operators]
2828
GitHub repository. No official support.
29+
30+
OperatorHub itself is installed and run as an Operator by default on {product-title}.
31+
In particular, the OperatorHub runs in the
32+
openshift-marketplace namespace in OpenShift.
33+
34+
Each operator in the OperatorHub is defined by two Custom Resource Definitions (CRDs):
35+
an link:https://github.com/operator-framework/operator-marketplace/blob/master/deploy/crds/operatorsource.crd.yaml[OperatorSource] and a link:https://github.com/operator-framework/operator-marketplace/blob/master/deploy/crds/catalogsourceconfig.crd.yaml[CatalogSourceConfig]:
36+
37+
OperatorSource::
38+
For each operator, the OperatorSource identifies the location of its
39+
operator bundle. A link:https://github.com/operator-framework/operator-marketplace/blob/master/deploy/examples/operatorsource.cr.yaml[simple OperatorSource] could include:
40+
41+
* _type_: To identify the datastore as an application registry, type is set to appregistry.
42+
* _endpoint_: Currently, Quay is the external datastore used by OperatorHub, so
43+
the endpoint is set to _https:/quay.io/cnr_ for the Quay.io appregistry.
44+
* _registryNamespace_: For a Community Operator, this is set to community-operator.
45+
* _displayName_: Optionally set to a name that appears in the OperatorHub
46+
user interface for the Operator.
47+
* _publisher_: Optionally, set to the person or organization publishing
48+
the Operator, so it can be displayed on the Operator Hub.
49+
50+
CatalogSourceConfig::
51+
An operator's CatalogSourceConfig defines how an operator is installed to your
52+
cluster. A link:https://github.com/operator-framework/operator-marketplace/blob/master/deploy/examples/catalogsourceconfig.cr.yaml[simple CatalogSourceConfig] would need to identify:
53+
54+
* _targetNamespace_: The location where the operator would be deployed and
55+
updated, such as openshift-marketplace. This is the namespace that OLM watches.
56+
* _packages_: A comma-separated list of packages that make up the content of
57+
the Operator.
58+
59+
Although some OperatorSource and CatalogSourcConfig information is exposed
60+
through the OperatorHub user interface, those files are only used directly
61+
by those who are creating their own Operators.

0 commit comments

Comments
 (0)