Configure a watch namespace for a cluster extension (Technology Preview)

You can configure the watch namespace for extensions that support namespace-scoped resource watching.

Important

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.

Prerequisites
  • You have access to an Red Hat OpenShift Container Platform 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.

Procedure
  1. 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.watchNamespace

      Specifies 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
  2. Apply the CR to the cluster by running the following command:

    $ oc apply -f <cluster_extension_cr>.yaml
Verification
  • Verify that the extension installed successfully by running the following command:

    $ oc get clusterextension <extension_name> -o yaml
    Example output
    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