-
Notifications
You must be signed in to change notification settings - Fork 32
refine install and dependency docs #21
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
# How do I install my operator with OLM? | ||
# How do I install my operator with OLM? | ||
|
||
[Once you've made your packaged operator available in a catalog](packaging-an-operator.md) it will appear in the `packagemanifest` list from which the Operators to install are selected. See [How do I list available Operators](list-available-operators.md#information-relevant-for-installation) how to retrieve the required information from the `PackageServer` in order start an installation of an Operator. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following sentence does not read well:
|
||
|
||
## Install with automatic updates enabled | ||
|
||
First, retrieve the package name, channel and catalog name and catalog source namespace from the `packagemanifest` of the desired Operator to install. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: package name, channel, |
||
|
||
```bash | ||
$ kubectl describe packagemanifest my-operator | ||
``` | ||
|
||
With this information a `Subscription` object can be created. This represents the intent to install an Operator from a particular catalog and keep it updated throughout the life cycle of the Operator via newly released version that got subsequently added to the referenced catalog. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend changing
to
or somethings along those lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe even
instead of
And in @awgreene 's suggestion:
if we tweak it to
then if could read like more of a user facing doc than dev facing doc. |
||
|
||
[Once you've made your operator available in a catalog](https://), [or you've chosen an operator from an existing catalog](https:// ), you can install your operator by creating a Subscription to a specific channel. | ||
```yaml | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
|
@@ -12,8 +23,11 @@ spec: | |
name: <name-of-your-operator> | ||
source: <name-of-catalog-operator-is-part-of> | ||
sourceNamespace: <namespace-that-has-catalog> | ||
``` | ||
For example, if you want to install an operator named `my-operator`, from a catalog named `my-catalog` that is in the namespace `olm`, and you want to subscribe to the channel `stable`, your subscription yaml would look like this: | ||
``` | ||
|
||
The `spec.channel` property can also be omitted in which case the default channel will be picked. Optionally you can also define `spec.startingCSV` to denote that you want to install a specific version of your Operator and not the latest. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we highlight behavior when specifying |
||
|
||
For example, if you want to install an operator named `my-operator`, from a catalog named `my-catalog` that is in the namespace `olm`, and you want to subscribe to the channel `stable`, your subscription yaml would look like this: | ||
|
||
```yaml | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
|
@@ -28,23 +42,146 @@ spec: | |
sourceNamespace: olm | ||
``` | ||
|
||
Once you have the subscription yaml, `kubectl apply -f Subscription.yaml` to install your operator. | ||
|
||
You can inspect your Subscription with `kubectl get subs <name-of-your-subscription> -n <namespace>`. | ||
Once you have the YAML, `kubectl apply -f subscription.yaml` to install your operator. | ||
|
||
To ensure the operator installed successfully, check for the ClusterServiceVersion and the operator deployment in the namespace it was installed in. | ||
You can inspect your `Subscription` with `kubectl describe subs <name-of-your-subscription> -n <namespace>`. | ||
|
||
```yaml | ||
k describe subs subs-to-my-operator -n olm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we want to say |
||
Name: subs-to-my-operator | ||
Namespace: olm | ||
Labels: <none> | ||
Annotations: <none> | ||
API Version: operators.coreos.com/v1alpha1 | ||
Kind: Subscription | ||
Metadata: | ||
Creation Timestamp: 2019-11-19T13:54:51Z | ||
Generation: 1 | ||
Resource Version: 1787 | ||
Self Link: /apis/operators.coreos.com/v1alpha1/namespaces/operators/subscriptions/subs-to-my-operator | ||
UID: 2864cc19-0ad4-11ea-8c0e-aa8cc6bce8d3 | ||
Spec: | ||
Channel: stable | ||
Name: my-operator | ||
Source: my-catalog | ||
Source Namespace: olm | ||
Status: | ||
Catalog Health: | ||
Catalog Source Ref: | ||
API Version: operators.coreos.com/v1alpha1 | ||
Kind: CatalogSource | ||
Name: my-catalog | ||
Namespace: olm | ||
Resource Version: 787 | ||
UID: 674c52e3-0ad2-11ea-8c0e-aa8cc6bce8d3 | ||
Healthy: true | ||
Last Updated: 2019-11-19T13:54:51Z | ||
Conditions: | ||
Last Transition Time: 2019-11-19T13:54:51Z | ||
Message: all available catalogsources are healthy | ||
Reason: AllCatalogSourcesHealthy | ||
Status: False | ||
Type: CatalogSourcesUnhealthy | ||
Current CSV: my-operator.v1.15.0 | ||
Install Plan Ref: | ||
API Version: operators.coreos.com/v1alpha1 | ||
Kind: InstallPlan | ||
Name: install-4xhbl | ||
Namespace: operators | ||
Resource Version: 1744 | ||
UID: 286e5546-0ad4-11ea-8c0e-aa8cc6bce8d3 | ||
Installed CSV: my-operator.v1.15.0 | ||
Installplan: | ||
API Version: operators.coreos.com/v1alpha1 | ||
Kind: InstallPlan | ||
Name: install-4xhbl | ||
Uuid: 286e5546-0ad4-11ea-8c0e-aa8cc6bce8d3 | ||
Last Updated: 2019-11-19T13:54:55Z | ||
State: AtLatestKnown | ||
Events: <none> | ||
``` | ||
$ kubectl get csv -n <namespace-operator-was-installed-in> | ||
|
||
The `Subscription` has successfully deployed the Operator when the `status.state` property reaches `AtLatestKnown`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this always true? If the CSV reaches a |
||
|
||
You can verify that the Operator is deployed by checking the `ClusterServiceVersion` (CSV) object in the same namespace where the `Subscription` was placed in. The name of the CSV is referenced in `status.installedCSV` of the `Subscription`: | ||
|
||
```bash | ||
$ kubectl get csv my-operator.v1.15.0 -n olm | ||
|
||
NAME DISPLAY VERSION REPLACES PHASE | ||
<name-of-csv> <operator-name> <version> <csv-of-previous-version> Succeeded | ||
my-operator.v1.15.0 My Operator 1.15.0 my-operator.v1.14.0 Succeeded | ||
``` | ||
|
||
If the the CSV has transitioned to the _Succeeded_ phase the Operator deployment was successful. You inspect it manually like so: | ||
|
||
```bash | ||
$ kubectl get deployments -n olm | ||
|
||
NAME READY UP-TO-DATE AVAILABLE AGE | ||
my-operator 1/1 1 1 9m48s | ||
``` | ||
$ kubectl get deployments -n <namespace-operator-was-installed-in> | ||
NAME READY UP-TO-DATE AVAILABLE AGE | ||
<name-of-your-operator> 1/1 1 1 9m48s | ||
|
||
If the ClusterServiceVersion fails to show up or does not reach the `Succeeded` phase, please check the [troubleshooting documentation](troubleshooting.md) to debug your installation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above about the (troubleshooting.md#clusterserviceversion-troubleshooting). |
||
|
||
## Install with manual updates | ||
|
||
It is also possible to create a `Subscription` that will not automatically install updates as soon as they appear in the catalog. For this the `spec.installPlanApproval` property can be set to `Manual` instead of the default `Automatic`: | ||
|
||
```yaml | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: subs-to-my-operator | ||
namespace: olm | ||
spec: | ||
channel: stable | ||
name: my-operator | ||
source: my-catalog | ||
sourceNamespace: olm | ||
installPlanApproval: Manual | ||
``` | ||
|
||
If the ClusterServiceVersion fails to show up or does not reach the `Succeeded` phase, please check the [troubleshooting documentation](https://) to debug your installation. | ||
|
||
The `Subscription` will not immediately cause the Operator to be deploy by creating a CSV this time. Instead it will remain in a pending state: | ||
|
||
```bash | ||
$ kubectl get subscriptions subs-to-my-operator -n operators -o custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,STATUS:.status.state,INSTALLPLAN:.status.installPlanRef.name | ||
|
||
NAME NAMESPACE STATUS INSTALLPLAN | ||
my-operator olm UpgradePending install-q4fmf | ||
``` | ||
|
||
An `InstallPlan` object has been created as a result of the `Subscription` getting processed. This also happens when no approval method is selected but it now presents an opportunity to manually approve the Operator installation. | ||
|
||
```bash | ||
$ kubectl get installplan install-q4fmf -n olm | ||
|
||
NAME CSV APPROVAL APPROVED | ||
install-q4fmf my-operator.v1.15.0 Manual false | ||
``` | ||
|
||
You can also inspect this objects `status.plan` section to get a preview of the resources that will be deloyed as part of this Operator. | ||
|
||
You can then either interactively set the `spec.approved` property of the `InstallPlan` to `true` or _patch_ the object like so: | ||
|
||
```bash | ||
kubectl patch installplan install-q4fmf -n olm --type merge -p '{"spec":{"approved":true}}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we get rid of the "What do I approve an update?" doc too if we're putting this information here? |
||
installplan.operators.coreos.com/install-q4fmf patched | ||
``` | ||
|
||
Now the `InstallPlan` will be processed by OLM, creating the objects that ship as part of the Operator and eventually create the `ClusterServiceVersion` to represent the deployed Operator: | ||
|
||
```bash | ||
$ kubectl get csv -n olm | ||
|
||
NAME DISPLAY VERSION REPLACES PHASE | ||
my-operator.v1.15.0 My Operator 1.15.0 my-operator.v1.14.0 Succeeded | ||
``` | ||
|
||
If the the CSV has transitioned to the _Succeeded_ phase the Operator deployment was successful. You inspect it manually like so: | ||
|
||
```bash | ||
$ kubectl get deployments -n olm | ||
|
||
NAME READY UP-TO-DATE AVAILABLE AGE | ||
my-operator 1/1 1 1 9m48s | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we highlight that a new installPlan for the next available version will be created when available? This will give users an idea how to perform a manual update. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
# How do I list Operators available to install? | ||
|
||
There is an extension API in OLM named `PackageManifest` that contains information about existing `CatalogSources`, which is essentially a repository of CSVs, CRDs, and packages that define an operator in the cluster. By querying that API, you can see the list of available operators. | ||
There is an extension API in OLM named `PackageManifest` that contains information about the content served by `CatalogSources`, which is essentially a repository of CSVs, CRDs, and packages that define a operator in the cluster. By querying that API, you can see the list of available operators. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This should be:
|
||
|
||
There are two different types of `CatalogSource` in OLM: global and namespaced `CatalogSource`. The global `CatalogSource` contains operators that will be available for all namespaces while namespaced `CatalogSource` only contains operators that are only available for a specific namespace. | ||
There are two different types of `CatalogSource` in OLM: global and namespaced `CatalogSource`. The global `CatalogSource` contains operators that will be available for all namespaces while namespaced `CatalogSource` only contains operators that are only available for a specific namespace. Therefore the list of `packagemanifests` can differ depending on from which namespace it has been executed. | ||
|
||
## PackageManifest Commands | ||
By default, OLM ships with the namespace `olm` configured the place where global catalogs are stored. The content of these catalogs are visible in all namespaces of the cluster: | ||
|
||
You can use these example commands via kubectl CLI (kubectl) to list available operators in a specific namespace. `PackageManifest` will return the union of global, which are available globally, and namespaced operators in namespace you're requesting. | ||
```bash | ||
$ kubectl get packagemanifest -n <namespace> | ||
$ kubectl get catalogsources -n olm | ||
|
||
NAME DISPLAY TYPE PUBLISHER AGE | ||
operatorhubio-catalog Community Operators grpc OperatorHub.io 11m | ||
``` | ||
|
||
The list of available operators will be displayed as an output of those above commands: | ||
## PackageManifest Commands | ||
|
||
You can use these example commands via kubectl CLI (kubectl) to list operators available to install. `PackageManifest` will return the union of global, which are available globally, and namespaced operators in namespace you're requesting. | ||
|
||
The list of available operators will be displayed as an output: | ||
|
||
```bash | ||
$ kubectl get packagemanifest | ||
NAME CATALOG AGE | ||
|
@@ -21,3 +28,49 @@ postgres-operator Community Operators 26m | |
prometheus Community Operators 26m | ||
wildfly Community Operators 26m | ||
``` | ||
|
||
If there are no `CatalogSource` objects present in the current namespace of the command above the list will contain all Operators found in global catalogs. To include Operators available to install from namespace catalogs simply supply it with the `kubectl` command: | ||
|
||
```bash | ||
$ kubectl get packagemanifests | ||
|
||
NAME CATALOG AGE | ||
... | ||
my-operator My Catalog 31m | ||
... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You used |
||
``` | ||
Comment on lines
+32
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As someone that has worked with OLM before this is clear, but it may not be clear to users unfamiliar with OLM. |
||
|
||
## Information relevant for installation | ||
|
||
From the `packagemanifest` of an Operator you can discover available update channels and latest version like so: | ||
|
||
```bash | ||
$ kubectl describe packagemanifest my-operator | ||
|
||
Name: my-operator | ||
Namespace: default | ||
Labels: catalog=operatorhubio-catalog | ||
catalog-namespace=olm | ||
provider=CNCF | ||
provider-url= | ||
Annotations: <none> | ||
API Version: packages.operators.coreos.com/v1 | ||
Kind: PackageManifest | ||
Metadata: | ||
Creation Timestamp: 2019-11-19T13:42:18Z | ||
Self Link: /apis/packages.operators.coreos.com/v1/namespaces/default/packagemanifests/my-operator | ||
Spec: | ||
Status: | ||
Catalog Source: operatorhubio-catalog | ||
Catalog Source Display Name: Community Operators | ||
Catalog Source Namespace: olm | ||
Catalog Source Publisher: OperatorHub.io | ||
Channels: | ||
Current CSV: my-operator.v1.15.0 | ||
[...] | ||
Name: stable | ||
Default Channel: stable | ||
Package Name: jaeger | ||
``` | ||
|
||
This will also show you information about the catalog object from which this Operator is served. Note that only the latest version in `status.channels.currentCSV` will be shown. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ Dependencies within OLM exist when an operator will not function as intended if | |
|
||
OLM does not allow an operator to define a dependency on a specific version (e.g. `etcd-operator v0.9.0`) or instance (e.g. `etcd v3.2.1`) of an operator. Instead, an operator may define a dependency on a specific (Group, Version, Kind) of an API provided by a seperate operator. This encourages operator authors to depend on the interface and not the implementation; thereby allowing operators to update on individual release cycles. | ||
|
||
If a dependency is ever discovered, OLM will attempt to resolve said dependency by searching through known `CatalogSources` for an operator that `owns` the API. If an operator is found that `owns`the `required` API, OLM will attempt to deploy the operator that `owns` the API. If no `owner` is found, OLM will fail to deploy the operator with the dependency. | ||
If a dependency is ever discovered, OLM will attempt to resolve said dependency by searching through known `CatalogSources` for an operator that `owns` the API. If an operator is found that `owns` the `required` API, OLM will attempt to deploy the operator that `owns` the API. If no `owner` is found, OLM will fail to deploy the operator with the dependency. | ||
|
||
### Similarity with Package Managers | ||
|
||
|
@@ -23,20 +23,21 @@ This means that OLM will never: | |
|
||
Dependency resolution begins when a `Subscription` is reconciled by OLM. | ||
|
||
When resolving a `Subscription`, OLM will look at all `Subscription` in the namespace and identify the next offering of each operator based on the upgrade graph. By updating all `Subscriptions` in the namespace, OLM avoids version deadlock that could be introduced when two operators have dependencies on each other. | ||
When resolving a `Subscription`, OLM will look at the Operator metadata (specified in its `ClusterServiceVersion`) in order to determine required APIs either from the cluster itself or other Operators (via CRDs or APIServices). Once OLM has identified the list of Operators that should be installed it will create `Subscriptions` for those in the same namespace. | ||
|
||
Once OLM has identified the list of operator that should be installed in the namespace, OLM will attempt to resolve any required APIs that are missing from the cluster by querying known `CatalogSources`. | ||
Throughout the existence of a `Subscription`, OLM will look at all `Subscription` objects in the namespace and detect available updates of each operators. By looking at all `Subscriptions` in the namespace at once, OLM avoids version deadlock that could be introduced when two operators have dependencies on each other. | ||
|
||
Rather than returning the first `CatalogSource` that contains the missing API, OLM will attempt to identify a prioritized `CatalogSource` - one that provided an operator that depends on the missing API. If the prioritized `CatalogSource` does not contain the API, OLM will search through the remaining `CatalogSources` in the namespace for the API. If an operator is found that provides the API, OLM will create a `Subscription` for the operator using that `CatalogSource`. | ||
In case multiple Operators serve a required API, rather than using the first match, OLM searches `CatalogSources` in a specific order. First is the same catalog that contains the Operator stating the dependency, followed by other catalogs in the same namespace as the required `Subscription` and then finally all remaining `CatalogSources` objects in other namespaces of the cluster. | ||
|
||
If the required API cannot be resolved, OLM will not install operators that rely on that API. | ||
If are required API cannot be resolved or found, OLM will not install operators that rely on that API. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I don't understand why we changed |
||
|
||
## Defining a Dependency | ||
|
||
An operator can define dependencies within its `ClusterServiceVersion (CSV)``. An operator can specify: | ||
|
||
* A `required` CRD by adding it to the `spec.customresourcedefinitions.required` field. | ||
* A `required` API Service by adding it to the `spec.apiservicedefinitions.required` field. | ||
* A `required` CRD by adding it to the `spec.customresourcedefinitions.required` list. | ||
* A `required` API Service by adding it to the `spec.apiservicedefinitions.required` list. | ||
* A `required` Cluster-provided API by adding it to the `spec.nativeapis` field | ||
|
||
> Note: If your operator defines a dependency, packaging it in the same `CatalogSource` as the operator that fulfills the dependency ensures that OLM will always resolve the dependency. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could link to (troubleshooting.md#clusterserviceversion-troubleshooting) to link to the more relevant section instead of the entire doc.