Skip to content

openshift/cluster-version-operator

Repository files navigation

Cluster Version Operator

The Cluster Version Operator (CVO) is one of the Cluster Operators that run in every OpenShift cluster. CVO consumes an artifact called a "release payload image," which represents a specific version of OpenShift. The release payload image contains the resource manifests necessary for the cluster to function, like all Cluster Operator ones. CVO reconciles the resources within the cluster to match the manifests in the release payload image. As a result, CVO implements cluster upgrades. After being provided a release payload image for a newer OpenShift version, CVO reconciles all Cluster Operators to their updated versions, and Cluster Operators similarly update their operands.

OpenShift Upgrades

For information about upgrading OpenShift clusters, please see the respective documentation:

ClusterVersion Resource

Like other Cluster Operators, the Cluster Version Operator is configured by a Config API resource in the cluster: a ClusterVersion:

$ oc explain clusterversion
  KIND:     ClusterVersion
  VERSION:  config.openshift.io/v1

  DESCRIPTION:
       ClusterVersion is the configuration for the ClusterVersionOperator. This is
       where parameters related to automatic updates can be set. Compatibility
       level 1: Stable within a major release for a minimum of 12 months or 3
       minor releases (whichever is longer).

  FIELDS:
     ...
     spec	<Object> -required-
       spec is the desired state of the cluster version - the operator will work
       to ensure that the desired version is applied to the cluster.

     status	<Object>
       status contains information about the available updates and any in-progress
       updates.

ClusterVersion resource follows the established Kubernetes pattern where the spec property describes the desired state that CVO should achieve and maintain, and the status property is populated by the CVO to describe its status and the observed state.

In a typical OpenShift cluster, there will be a cluster-scoped ClusterVersion resource called version:

$ oc get clusterversion version
NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.11.17   True        False         6d5h    Cluster version is 4.11.17

Note that as a user or a cluster administrator, you usually do not interact with the ClusterVersion resource directly but via either the oc adm upgrade CLI or the web console.

Understanding Upgrades

💡 This section is only a high-level overview. See the Update Process and Reconciliation documents in the dev-guide for more details.

The Cluster Version Operator continuously fetches information about upgrade paths for the configured channel from the OpenShift Update Service (OSUS). It stores the recommended update options in the status.availableUpdates field of its ClusterVersion resource.

The intent to upgrade the cluster to another version is expressed by storing the desired version in the spec.desiredUpdate field. When spec.desiredUpdate does not match the current cluster version, CVO will start updating the cluster. It downloads the release payload image, validates it, and systematically reconciles the Cluster Operator resources to match the updated manifests delivered in the release payload image.

Troubleshooting

A typical OpenShift cluster will have a Deployment resource called cluster-version-operator in the openshift-cluster-version namespace, configured to run a single CVO replica. Confirm that its Pod is up and optionally inspect its log:

$ oc get deployment -n openshift-cluster-version cluster-version-operator
NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
cluster-version-operator   1/1     1            1           2y227d

$ oc get pods -n openshift-cluster-version -l k8s-app=cluster-version-operator
NAME                                       READY   STATUS    RESTARTS   AGE
cluster-version-operator-6885cc574-674n6   1/1     Running   0          6d5h

$ oc logs -n openshift-cluster-version -l k8s-app=cluster-version-operator
...

The CVO follows the Kubernetes API conventions and sets Conditions in the status of its ClusterVersion resource. These conditions are surfaced by both the OpenShift web console and the oc adm upgrade CLI.

Development

Contributions welcome! Please follow CONTRIBUTING.md and developer documentation.