// Module included in the following assemblies:
//
// * extensions/ce/olmv1-configuring-extensions.adoc
// * extensions/ce/olmv1-installing-an-operator-from-a-catalog.adoc

:_mod-docs-content-type: PROCEDURE

[id="olmv1-deploying-a-ce-in-a-specific-namespace_{context}"]
= Configuring a watch namespace for a cluster extension (Technology Preview)

[role="_abstract"]
You can configure the watch namespace for extensions that support namespace-scoped resource watching.

:FeatureName: Configuring watch namespace for a cluster extension
include::snippets/technology-preview.adoc[]

.Prerequisites

* You have access to an {product-title} 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

. 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:
+
[source,yaml]
----
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:
+
[source,yaml]
----
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:
+
[source,terminal]
----
$ oc apply -f <cluster_extension_cr>.yaml
----

.Verification

* Verify that the extension installed successfully by running the following command:
+
[source,terminal]
----
$ oc get clusterextension <extension_name> -o yaml
----
+
.Example output
[source,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
----
