Bookmark this page

Update Operators with the OLM

Objectives

  • Update OLM-managed operators by using the web console and CLI.

Operator Updates

For operators that are installed in an OpenShift cluster, operator providers can release new versions. These new versions can contain bug fixes and new features. The Operator Lifecycle Manager (OLM) can update these operators.

However, new operator versions can introduce bugs and incompatibilities.

Cluster administrators should define operator update policies to ensure that bug fixes and new functions are adopted, with the cluster continuing to operate correctly.

OpenShift provides features to help to implement such policies.

  • For each installed operator, you can decide whether the OLM automatically applies updates, or whether the updates require administrator approval.

  • Operator providers can create multiple channels for an operator. The provider can follow different policies to push updates to each channel, so that each channel contains different versions of the operator. When installing an operator, you choose the channel to follow for updates.

  • You can create custom catalogs, and decide which versions of operators to include in the catalog. For example, in a multicluster environment, you configure operators to update automatically, but add only tested versions to the catalog.

Providers can publish operators by other means than the OLM and operator catalogs. For example, a provider can publish operators as Helm charts or YAML resource files. The OLM does not manage operators that are installed by other means.

Operator Update Channels

Each operator provider can create multiple channels for an operator.

For example, a provider can create stable and preview channels for an operator. The provider publishes each new version of the operator to the preview channel. You can use the preview channel to test new features and to validate that the new versions fix bugs. If the provider receives feedback for preview versions of the operator and finds no serious issues with the latest version, then the provider publishes the version to the stable channel. You can use the stable channel for environments with higher reliability requirements, and trade off slower adoption of new features for improved stability.

Additionally, operators might have new features that introduce significant changes or incompatibilities with earlier versions. Operator providers might adopt a versioning scheme for the operator that separates major updates from minor updates, depending on the adoption cost of the new version. In this scenario, providers can create channels for different major versions of the operator.

For example, a provider creates an operator that installs an application. The provider creates version-1 and version-2 channels, to correspond to different major versions of the application. Users of the operator can stay on the version-1 channel in the production environment, and test and design an update process to adopt the version-2 channel in a staging environment.

When you install an operator, determine the most suitable channel for your requirements. Clusters with varying reliability requirements might use different channels.

You can edit an operator subscription to switch channels. Switching channels does not cause any operator update, unless switching channel makes a later version available and the operator is configured for automatic updates. Switching channels might cause unwanted results; always refer to the operator documentation to learn about possible issues.

Automatic and Manual Updates

When you install an operator, you can decide whether the OLM automatically applies updates, or whether the OLM requires an administrator to approve the update. On the operator installation wizard, you can choose between automatic or manual approval. When you create a subscription by using the oc command, the resource specification contains an installPlanApproval property that requires an Automatic or Manual value.

If the publishing policies of an operator suit your requirements, then you can configure automatic approvals. Click OperatorsInstalled Operators on the web console, or examine cluster service versions with the oc command, to review the version of installed operators.

If you install an operator and configure manual approvals, then you must approve updates before the OLM updates the operator.

The Installed Operators page in the web console displays available upgrades.

Figure 9.9: The Installed Operators page with an available upgrade

The subscription resources and the install plan resources contain information about upgrades. You can use the oc command to examine those resources to find available upgrades.

[user@host ~]$ oc get sub -n openshift-operators web-terminal -o yaml
...output omitted...
spec:
  channel: fast
  installPlanApproval: Manual
  name: web-terminal
  source: do280-catalog-redhat
  sourceNamespace: openshift-marketplace
  startingCSV: web-terminal.v1.5.1
status:
...output omitted...
  conditions:
...output omitted...
  - lastTransitionTime: "2022-11-24T13:46:21Z"
    reason: RequiresApproval
    status: "True"
    type: InstallPlanPending
  currentCSV: web-terminal.v1.6.0 1
  installPlanGeneration: 2
  installPlanRef:
    apiVersion: operators.coreos.com/v1alpha1
    kind: InstallPlan
    name: install-72vnw 2
    namespace: openshift-operators
    resourceVersion: "194989"
    uid: 8dc979fe-936f-475a-8977-36d210c4da98
  installedCSV: web-terminal.v1.5.1 3
...output omitted...
  state: UpgradePending

1

The currentCSV key shows the latest available version in the channel.

2

The installPlanRef section contains a reference to the install plan resource.

3

The installedCSV key shows the current version.

The OLM also creates an install plan resource when the operator channel contains a later version of an operator.

[user@host ~]$ oc get installplan -n openshift-operators install-72vnw -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: InstallPlan
...output omitted...
spec:
  approval: Manual 1
  approved: false 2
  clusterServiceVersionNames:
  - web-terminal.v1.6.0 3
  generation: 2
status:
...output omitted...
  phase: RequiresApproval
...output omitted...

1

The approval key indicates whether updates must be approved.

2

The approved key shows whether the update is approved.

3

The clusterServiceVersionNames shows the updated version.

To install the update, edit the specification of the install plan to change the approved key value to true.

[user@host ~]$ oc patch installplan install-72vnw --type merge \
  --patch '{"spec":{"approved":true}}'
installplan.operators.coreos.com/install-72vnw patched

You can also use the web console to approve an update. In the Installed Operators, click Upgrade available, and then click Preview InstallPlan to view the install plan. Review the install plan, and then click Approve to update the operator.

Figure 9.10: Reviewing an install plan

Operator Updates and Cluster Updates

Operators might be incompatible with later versions of OpenShift. For example, an operator that uses an API that is removed from later versions of OpenShift does not work correctly when the cluster is updated. Operators can define a list of compatible OpenShift versions.

When updating a cluster, you might need to update operators if the installed version of the operator is not compatible with the updated OpenShift version. Before you update a cluster, review and install any operator updates that are needed for compatibility fixes. If no compatible updates are available, then you must update the cluster by uninstalling incompatible operators.

Uninstalling Operators

You can uninstall operators by using the web console or the oc command.

In the console, click OperatorsInstalled operators and locate the operator. Click the vertical ellipsis () menu, and then click Uninstall Operator.

Figure 9.11: The uninstall operator button

After confirming the operation by clicking Uninstall, the OLM uninstalls the operator.

Alternatively, delete the subscription and cluster service versions by using the oc command.

Important

Uninstalling an operator can leave operator resources on the cluster. Always review the operator documentation to learn about cleanup processes that you must follow to completely remove an operator.

References

Refer to the Upgrading Installed Operators section in the Administrator Tasks chapter in the Red Hat OpenShift Container Platform 4.14 Operators documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/operators/index#olm-upgrading-operators

Refer to the Deleting Operators from a Cluster section in the Administrator Tasks chapter in the Red Hat OpenShift Container Platform 4.14 Operators documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/operators/index#olm-deleting-operators-from-a-cluster

For more information about creating custom catalogs with controlled operator versions, refer to the Managing Custom Catalogs section in the Administrator Tasks chapter in the Red Hat OpenShift Container Platform 4.14 Operators documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/operators/index#olm-managing-custom-catalogs

Revision: do280-4.14-08d11e1