apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
...
spec:
namespace: <installation_namespace>
config:
configType: Inline
inline:
watchNamespace: <watch_namespace>
In Operator Lifecycle Manager (OLM) v1, extensions watch all namespaces by default. Some Operators support only namespace-scoped watching based on OLM (Classic) install modes. To install these Operators, configure the watch namespace for the extension. For more information, see "Discovering bundle install modes".
|
Configuring a watch namespace for a cluster extension is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope. |
Configure the namespace an extension watches by using the .spec.config field in the ClusterExtension resource.
|
OLM v1 configuration API is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope. |
Extensions watch all namespaces by default. Some Operators support only namespace-scoped watching based on OLM (Classic) install modes. Configure the .spec.config.inline.watchNamespace field to install these Operators.
Whether you must configure this field depends on the install modes supported by the bundle.
The configuration API uses an opaque structure. The bundle validates the configuration values, not OLM v1. Operator authors can define their own configuration requirements.
Currently, the Inline configuration type is the only supported type:
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
...
spec:
namespace: <installation_namespace>
config:
configType: Inline
inline:
watchNamespace: <watch_namespace>
where:
<installation_namespace>Specifies the namespace where the extension components run.
config.configTypeSpecifies the configuration type. Currently, Inline is the only supported type.
<watch_namespace>Specifies the namespace where the extension watches for custom resources. The watch namespace can match or differ from the installation namespace, depending on the install modes supported by the bundle.
Avoid installation failures by using the correct watchNamespace value for the install modes supported by your bundle. Requirements vary based on whether the bundle supports AllNamespaces, OwnNamespace, and SingleNamespace install modes.
OLM (Classic) registry+v1 bundles declare the install modes they support. These install modes control whether watchNamespace configuration is required or optional, and what values are valid.
|
OLM v1 does not support multi-tenancy. You cannot install the same extension more than once on a cluster. As a result, the |
AllNamespacesWatches resources across all namespaces in the cluster.
OwnNamespaceWatches resources only in the installation namespace.
SingleNamespaceWatches resources in a single namespace that differs from the installation namespace.
Whether the .spec.config.inline.watchNamespace field is required depends on the install modes that the bundle supports.
| Bundle install mode support | watchNamespace field | Valid values |
|---|---|---|
|
Not applicable |
The |
|
Required |
Must match |
|
Required |
Must differ from |
Both |
Required |
Can match or differ from |
|
Optional |
Omit to watch all namespaces, or specify a namespace to watch only that namespace |
|
OLM v1 validates the |
You can render the bundle metadata to find which install modes a bundle supports.
You have installed the jq CLI tool.
You have installed the opm CLI tool.
Render the bundle metadata by running the following command:
$ opm render <bundle_image> -o json | \
jq 'select(.schema == "olm.bundle") | .properties[] | select(.type == "olm.bundle.object")'
{
"type": "olm.bundle.object",
"value": {
"data": "...",
"ref": "olm.csv"
}
}
Decode the base64-encoded CSV data to view install mode declarations:
$ echo "<base64_data>" | base64 -d | jq '.spec.installModes'
[
{
"type": "OwnNamespace",
"supported": true
},
{
"type": "SingleNamespace",
"supported": true
},
{
"type": "MultiNamespace",
"supported": false
},
{
"type": "AllNamespaces",
"supported": false
}
]
In this example, the bundle supports both OwnNamespace and SingleNamespace modes. The .spec.config.inline.watchNamespace field is required and can match or differ from the .spec.namespace field.
You can configure the watch namespace for extensions that support namespace-scoped resource watching.
|
Configuring watch namespace for a cluster extension is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope. |
You have access to an OKD cluster using an account with cluster-admin permissions.
You have enabled the TechPreviewNoUpgrade feature set on the cluster.
You have created a service account and assigned enough role-based access controls (RBAC) to install, update, and manage the extension. For more information, see "Cluster extension permissions".
You have verified the supported install modes for the extension and determined the required watchNamespace configuration.
Create a custom resource (CR) based on where you want the extension to watch for resources:
To configure the extension to watch its own installation namespace:
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
spec:
namespace: <installation_namespace>
config:
configType: Inline
inline:
watchNamespace: <installation_namespace>
serviceAccount:
name: <service_account>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
version: <version>
upgradeConstraintPolicy: CatalogProvided
where:
config.inline.watchNamespaceSpecifies the namespace to watch for resources. For requirements and valid values, see "Extension configuration".
To configure the extension to watch a different namespace:
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
spec:
namespace: <installation_namespace>
config:
configType: Inline
inline:
watchNamespace: <watched_namespace>
serviceAccount:
name: <service_account>
source:
sourceType: Catalog
catalog:
packageName: <package_name>
version: <version>
upgradeConstraintPolicy: CatalogProvided
Apply the CR to the cluster by running the following command:
$ oc apply -f <cluster_extension_cr>.yaml
Verify that the extension installed successfully by running the following command:
$ oc get clusterextension <extension_name> -o yaml
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: <extension_name>
spec:
namespace: <installation_namespace>
config:
configType: Inline
inline:
watchNamespace: <installation_namespace>
status:
conditions:
- type: Installed
status: "True"
reason: Succeeded
To configure the watchNamespace field correctly for your bundle’s install mode, see the following examples. These show valid configurations for Operators that support the AllNamespaces, OwnNamespace, and SingleNamespace install modes.
AllNamespaces install modeapiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: example-extension
spec:
namespace: openshift-operators
serviceAccount:
name: example-sa
source:
sourceType: Catalog
catalog:
packageName: example-operator
The config field is omitted. The extension watches all namespaces by default.
OwnNamespace install modeapiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: example-extension
spec:
namespace: example-operators
config:
configType: Inline
inline:
watchNamespace: example-operators
serviceAccount:
name: example-sa
source:
sourceType: Catalog
catalog:
packageName: example-operator
You must set the watchNamespace field to use the OwnNamespace install mode.
The watchNamespace value must match the spec.namespace field value.
SingleNamespace install modeapiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: example-extension
spec:
namespace: example-operators
config:
configType: Inline
inline:
watchNamespace: production
serviceAccount:
name: example-sa
source:
sourceType: Catalog
catalog:
packageName: example-operator
You must set the watchNamespace field to use the SingleNamespace install mode.
The watchNamespace value must differ from the spec.namespace field value.
In this example, the extension runs in the example-operators namespace but watches resources in the production namespace.
Validation errors occur when the watchNamespace field is omitted or contains an invalid value for the install modes supported by the bundle.
| Error | Cause | Resolution |
|---|---|---|
Required field missing |
The bundle requires the |
Add the |
|
The bundle only supports |
Set the |
|
The bundle only supports |
Set the |
Invalid configuration |
The |
Verify the configuration follows the correct API structure with |