Skip to content

Commit cc0b306

Browse files
OSDOCS#8861: Semver support and updating Operators
SME feedback
1 parent fe4d8cd commit cc0b306

7 files changed

+361
-122
lines changed

modules/olmv1-about-target-versions.adoc

Lines changed: 33 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,106 +3,70 @@
33
// * operators/olm_v1/olmv1-installing-an-operator-from-a-catalog.adoc
44
// * operators/olm_v1/arch/olmv1-operator-controller.adoc
55

6-
:_mod-docs-content-type: CONCEPT
6+
:_mod-docs-content-type: REFERENCE
77

8-
[id="olmv1-about-operator-updates_{context}"]
9-
= About target versions in {olmv1}
8+
[id="olmv1-about-target-versions_{context}"]
9+
= Example custom resources (CRs) that specify a target version
1010

11-
In {olmv1-first}, cluster administrators set the target version of an Operator declaratively in the Operator's custom resource (CR).
11+
In {olmv1-first}, cluster administrators can declaratively set the target version of an Operator or extension in the custom resource (CR).
1212

13-
If you specify a channel in the Operator's CR, {olmv1} installs the latest release from the specified channel. When updates are published to the specified channel, {olmv1} automatically updates to the latest release from the channel.
13+
You can define a target version by specifying any of the following fields:
14+
15+
* Channel
16+
* Version number
17+
* Version range
18+
19+
If you specify a channel in the CR, {olmv1} installs the latest version of the Operator or extension that can be resolved within the specified channel. When updates are published to the specified channel, {olmv1} automatically updates to the latest release that can be resolved from the channel.
1420

1521
.Example CR with a specified channel
1622
[source,yaml]
1723
----
1824
apiVersion: operators.operatorframework.io/v1alpha1
1925
kind: Operator
2026
metadata:
21-
name: quay-example
27+
name: pipelines-operator
2228
spec:
23-
packageName: quay-operator
24-
channel: stable-3.8 <1>
29+
packageName: openshift-pipelines-operator-rh
30+
channel: latest <1>
2531
----
26-
<1> Installs the latest release published to the specified channel. Updates to the channel are automatically installed.
32+
<1> Installs the latest release that can be resolved from the specified channel. Updates to the channel are automatically installed.
2733

28-
If you specify the Operator's target version in the CR, {olmv1} installs the specified version. When the target version is specified in the Operator's CR, {olmv1} does not change the target version when updates are published to the catalog.
34+
If you specify the Operator or extension's target version in the CR, {olmv1} installs the specified version. When the target version is specified in the CR, {olmv1} does not change the target version when updates are published to the catalog.
2935

30-
If you want to update the version of the Operator that is installed on the cluster, you must manually update the Operator's CR. Specifying a Operator's target version pins the Operator's version to the specified release.
36+
If you want to update the version of the Operator that is installed on the cluster, you must manually edit the Operator's CR. Specifying an Operator's target version pins the Operator's version to the specified release.
3137

3238
.Example CR with the target version specified
3339
[source,yaml]
3440
----
3541
apiVersion: operators.operatorframework.io/v1alpha1
3642
kind: Operator
3743
metadata:
38-
name: quay-example
44+
name: pipelines-operator
3945
spec:
40-
packageName: quay-operator
41-
version: 3.8.12 <1>
46+
packageName: openshift-pipelines-operator-rh
47+
version: 1.11.1 <1>
4248
----
43-
<1> Specifies the target version. If you want to update the version of the Operator that is installed on the cluster, you must manually update this field the Operator's CR to the desired target version.
44-
45-
If you want to change the installed version of an Operator, edit the Operator's CR to the desired target version.
49+
<1> Specifies the target version. If you want to update the version of the Operator or extension that is installed, you must manually update this field the CR to the desired target version.
4650

47-
[WARNING]
48-
====
49-
In previous versions of OLM, Operator authors could define upgrade edges to prevent you from updating to unsupported versions. In its current state of development, {olmv1} does not enforce upgrade edge definitions. You can specify any version of an Operator, and {olmv1} attempts to apply the update.
50-
====
51+
If you want to define a range of acceptable versions for an Operator or extension, you can specify a version range by using a comparison string. When you specify a version range, {olmv1} installs the latest version of an Operator or extension that can be resolved by the Operator Controller.
5152

52-
You can inspect an Operator's catalog contents, including available versions and channels, by running the following command:
53-
54-
.Command syntax
55-
[source,terminal]
53+
.Example CR with a version range specified
54+
[source,yaml]
5655
----
57-
$ oc get package <catalog_name>-<package_name> -o yaml
56+
apiVersion: operators.operatorframework.io/v1alpha1
57+
kind: Operator
58+
metadata:
59+
name: pipelines-operator
60+
spec:
61+
packageName: openshift-pipelines-operator-rh
62+
version: >1.11.1 <1>
5863
----
64+
<1> Specifies that the desired version range is greater than version `1.11.1`. For more information, see "Support for version ranges".
5965

60-
After you create or update a CR, create or configure the Operator by running the following command:
66+
After you create or update a CR, apply the configuration file by running the following command:
6167

6268
.Command syntax
6369
[source,terminal]
6470
----
6571
$ oc apply -f <extension_name>.yaml
6672
----
67-
68-
.Troubleshooting
69-
70-
* If you specify a target version or channel that does not exist, you can run the following command to check the status of your Operator:
71-
+
72-
[source,terminal]
73-
----
74-
$ oc get operator.operators.operatorframework.io <operator_name> -o yaml
75-
----
76-
+
77-
.Example output
78-
[source,text]
79-
----
80-
apiVersion: operators.operatorframework.io/v1alpha1
81-
kind: Operator
82-
metadata:
83-
annotations:
84-
kubectl.kubernetes.io/last-applied-configuration: |
85-
{"apiVersion":"operators.operatorframework.io/v1alpha1","kind":"Operator","metadata":{"annotations":{},"name":"quay-example"},"spec":{"packageName":"quay-operator","version":"999.99.9"}}
86-
creationTimestamp: "2023-10-19T18:39:37Z"
87-
generation: 3
88-
name: quay-example
89-
resourceVersion: "51505"
90-
uid: 2558623b-8689-421c-8ed5-7b14234af166
91-
spec:
92-
packageName: quay-operator
93-
version: 999.99.9
94-
status:
95-
conditions:
96-
- lastTransitionTime: "2023-10-19T18:50:34Z"
97-
message: package 'quay-operator' at version '999.99.9' not found
98-
observedGeneration: 3
99-
reason: ResolutionFailed
100-
status: "False"
101-
type: Resolved
102-
- lastTransitionTime: "2023-10-19T18:50:34Z"
103-
message: installation has not been attempted as resolution failed
104-
observedGeneration: 3
105-
reason: InstallationStatusUnknown
106-
status: Unknown
107-
type: Installed
108-
----
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/olm_v1/olmv1-installing-an-operator-from-a-catalog.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
7+
[id="olmv1-forcing-an-update-or-rollback_{context}"]
8+
= Forcing an update or rollback
9+
10+
{olmv1} does not support automatic updates to the next major version or rollbacks to an earlier version. If you want to perform a major version update or rollback, you must verify and force the update manually.
11+
12+
[WARNING]
13+
====
14+
You must verify the consequences of forcing a manual update or rollback. Failure to verify a forced update or rollback might have catastrophic consequences such as data loss.
15+
====
16+
17+
.Prerequisites
18+
19+
* You have a catalog installed.
20+
* You have an Operator or extension installed.
21+
22+
.Procedure
23+
24+
. Edit the custom resource (CR) of your Operator or extension as shown in the following example:
25+
+
26+
.Example CR
27+
[source,yaml]
28+
----
29+
apiVersion: olm.operatorframework.io/v1alpha1
30+
kind: Operator
31+
metadata:
32+
name: <operator_name> <1>
33+
spec:
34+
packageName: <package_name> <2>
35+
version: <version> <3>
36+
upgradeConstraintPolicy: Ignore <4>
37+
----
38+
<1> Specifies the name of the Operator or extension, such as `pipelines-operator`
39+
<2> Specifies the package name, such as `openshift-pipelines-operator-rh`.
40+
<3> Specifies the blocked update or rollback version.
41+
<4> Optional: Specifies the upgrade constraint policy. To force an update or rollback, set the field to `Ignore`. If unspecified, the default setting is `Enforce`.
42+
43+
. Apply the changes to your Operator or extensions CR by running the following command:
44+
+
45+
[source,terminal]
46+
----
47+
$ oc apply -f <extension_name>.yaml
48+
----

modules/olmv1-installing-an-operator.adoc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[id="olmv1-installing-an-operator_{context}"]
88
= Installing an Operator from a catalog
99

10-
{olmv1-first} supports installing Operators and extensions scoped to the cluster. You can install an Operator from a catalog by creating an Operator custom resource (CR) and applying it to the cluster.
10+
{olmv1-first} supports installing Operators and extensions scoped to the cluster. You can install an Operator or extension from a catalog by creating a custom resource (CR) and applying it to the cluster.
1111

1212
[IMPORTANT]
1313
====
@@ -23,6 +23,7 @@ Operators and extensions that use webhooks or that target a single or specified
2323

2424
* You have added a catalog to your cluster.
2525
* You have downloaded a local copy of the catalog file.
26+
* You have installed the `jq` CLI tool.
2627

2728
.Procedure
2829

@@ -95,7 +96,7 @@ select( .schema == "olm.channel" ) | select( .name == "latest" ) | \
9596
----
9697
====
9798

98-
. Create an Operator CR, similar to the following example:
99+
. Create a CR, similar to the following example:
99100
+
100101
.Example `pipelines-operator.yaml` CR
101102
[source,yaml]
@@ -113,9 +114,13 @@ spec:
113114
where:
114115
+
115116
<channel>:: Optional: Specifies the channel, such as `pipelines-1.11` or `latest`, for the package you want to install or update.
116-
<version>:: Optional: Specifies the specific version or version range, such as `1.11.1`, `1.12.x`, or `>=1.12.1`, of the package you want to install or update. For more information, see "About target versions in OLM 1.0" and "Support for version ranges".
117+
<version>:: Optional: Specifies the version or version range, such as `1.11.1`, `1.12.x`, or `>=1.12.1`, of the package you want to install or update. For more information, see "Example custom resources (CRs) that specify a target version" and "Support for version ranges".
118+
+
119+
--
120+
include::snippets/olmv1-multi-catalog-admon.adoc[]
121+
--
117122

118-
. Apply the Operator CR to the cluster by running the following command:
123+
. Apply the CR to the cluster by running the following command:
119124
+
120125
[source,terminal]
121126
----
@@ -130,19 +135,16 @@ operator.operators.operatorframework.io/pipelines-operator created
130135

131136
.Verification
132137

133-
. View the Operator's CR in the YAML format by running the following command:
138+
. View the Operator or extension's CR in the YAML format by running the following command:
134139
+
135140
[source,terminal]
136141
----
137142
$ oc get operator.operators.operatorframework.io pipelines-operator -o yaml
138143
----
139144
+
140-
[NOTE]
141-
====
142-
If you specify a channel or define a version range in your Operator or extension's CR, {olmv1} does not display the resolved version installed on the cluster. Only the version and channel information specified in the CR are displayed.
143-
144-
If you want to find the specific version that is installed, you must compare the SHA of the image of the `spec.source.image.ref` field to the image reference in the catalog.
145-
====
145+
--
146+
include::snippets/olmv1-version-range-cr-adomn.adoc[]
147+
--
146148
+
147149
.Example output
148150
[%collapsible]
@@ -184,7 +186,7 @@ status:
184186
----
185187
====
186188

187-
. Get information about your Operator's bundle deployment by running the following command:
189+
. Get information about your bundle deployment by running the following command:
188190
+
189191
[source,terminal]
190192
----

modules/olmv1-semver-support.adoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/olm_v1/olmv1-installing-an-operator-from-a-catalog.adoc
4+
// * operators/olm_v1/arch/olmv1-operator-controller.adoc
5+
6+
:_mod-docs-content-type: CONCEPT
7+
8+
[id="olmv1-semver-support_{context}"]
9+
= Support for semantic versioning
10+
11+
Support for link:https://semver.org/[semantic versioning (semver)] is enabled in {olmv1} by default. Operator and extension authors can use the semver standard to define compatible updates.
12+
13+
{olmv1-first} can use an Operator or extension's version number to determine if an update can be resolved successfully.
14+
15+
Cluster administrators can define a range of acceptable versions to install and automtically update. For Operators and extensions that follow the semver standard, you can use comparison strings to define to specify a desired version range.
16+
17+
[NOTE]
18+
====
19+
{olmv1} does not support automatic updates to the next major version. If you want to perform a major version update, you must verify and apply the update manually. For more information, see "Forcing an update or rollback".
20+
====
21+
22+
== Major version zero releases
23+
24+
The semver standard specifies that major version zero releases (`O.y.z`) are reserved for initial development. During the initial development stage, the API is not stable and breaking changes might be introduced in any published version. As a result, major version zero releases apply a special set of update conditions.
25+
26+
.Update conditions for major version zero releases
27+
28+
* You cannot apply automatic updates when the major and minor versions are both zero, such as `0.0.*`. For example, automatic updates with the version range of `>=0.0.1 <0.1.0` are not allowed.
29+
* You cannot apply automatic updates from one minor version to another within a major version zero release. For example, {olmv1} does not automatically apply an update from `0.1.0` to `0.2.0`.
30+
* You can apply automatic updates from patch versions, such as `>=0.1.0 <0.2.0` or `>=0.2.0 <0.3.0`.
31+
32+
When an automatic update is blocked by {olmv1}, you must manually verify and force the update by editing the Operator or extension's custom resource (CR).

0 commit comments

Comments
 (0)