2.2. Operator Controller
Operator Controller is the central component of Operator Lifecycle Manager (OLM) v1 and consumes the other OLM v1 component, catalogd. It extends Kubernetes with an API through which users can install Operators and extensions.
2.2.1. ClusterExtension API 링크 복사링크가 클립보드에 복사되었습니다!
To manage installed extensions in OLM v1, use the ClusterExtension API. This consolidated API simplifies extension management by replacing multiple OLM (Classic) objects with a single cluster-scoped resource.
In OLM v1, ClusterExtension objects are cluster-scoped. This differs from OLM (Classic) where Operators can be either namespace-scoped or cluster-scoped. In OLM (Classic), the scope depends on the configuration of related Subscription and OperatorGroup objects.
For more information about OLM (Classic) behavior, see Multitenancy and Operator colocation.
Example ClusterExtension object
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
spec:
namespace: <namespace_name>
config:
configType: Inline
inline:
watchNamespace: <namespace_name>
serviceAccount:
name: <service_account_name>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
channels:
- <channel>
version: "<version>"
config- If the extension supports watching a specific namespace, use this field to configure extension behavior. For more information, see "Extension configuration".
2.2.1.1. Example custom resources (CRs) that specify a target version 링크 복사링크가 클립보드에 복사되었습니다!
In Operator Lifecycle Manager (OLM) v1, cluster administrators can declaratively set the target version of an Operator or extension in the custom resource (CR).
You can define a target version by specifying any of the following fields:
- Channel
- Version number
- Version range
If you specify a channel in the CR, OLM v1 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, OLM v1 automatically updates to the latest release that can be resolved from the channel.
Example CR with a specified channel
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <clusterextension_name>
spec:
namespace: <installed_namespace>
serviceAccount:
name: <service_account_installer_name>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
channels:
- latest
- 1
- Optional: Installs the latest release that can be resolved from the specified channel. Updates to the channel are automatically installed. Specify the value of the
channelsparameter as an array.
If you specify the Operator or extension’s target version in the CR, OLM v1 installs the specified version. When the target version is specified in the CR, OLM v1 does not change the target version when updates are published to the catalog.
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.
Example CR with the target version specified
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <clusterextension_name>
spec:
namespace: <installed_namespace>
serviceAccount:
name: <service_account_installer_name>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
version: "1.11.1"
- 1
- Optional: 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.
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, OLM v1 installs the latest version of an Operator or extension that can be resolved by the Operator Controller.
Example CR with a version range specified
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <clusterextension_name>
spec:
namespace: <installed_namespace>
serviceAccount:
name: <service_account_installer_name>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
version: ">1.11.1"
- 1
- Optional: Specifies that the desired version range is greater than version
1.11.1. For more information, see "Support for version ranges".
After you create or update a CR, apply the configuration file by running the following command:
Command syntax
$ oc apply -f <extension_name>.yaml