|  | 
|  | 1 | +## Description | 
|  | 2 | + | 
|  | 3 | +!!! note | 
|  | 4 | +This feature is still in *alpha* the `SingleOwnNamespaceInstallSupport` feature-gate must be enabled to make use of it. | 
|  | 5 | +See the instructions below on how to enable it. | 
|  | 6 | + | 
|  | 7 | +--- | 
|  | 8 | + | 
|  | 9 | +A component of OLMv0's multi-tenancy feature is its support of four [*installModes*](https://olm.operatorframework.io/docs/advanced-tasks/operator-scoping-with-operatorgroups/#targetnamespaces-and-their-relationship-to-installmodes): | 
|  | 10 | +for operator installation: | 
|  | 11 | + | 
|  | 12 | + - *OwnNamespace*: If supported, the operator can be configured to watch for events in the namespace it is deployed in. | 
|  | 13 | + - *SingleNamespace*: If supported, the operator can be configured to watch for events in a single namespace that the operator is not deployed in. | 
|  | 14 | + - *MultiNamespace*: If supported, the operator can be configured to watch for events in more than one namespace. | 
|  | 15 | + - *AllNamespaces*: If supported, the operator can be configured to watch for events in all namespaces. | 
|  | 16 | + | 
|  | 17 | +OLMv1 will not attempt multi-tenancy (see [design decisions document](../../project/olmv1_design_decisions.md)) and will think of operators | 
|  | 18 | +as globally installed, i.e. in OLMv0 parlance, as installed in *AllNamespaces* mode. However, there are operators that | 
|  | 19 | +were intended only for the *SingleNamespace* and *OwnNamespace* install modes. In order to make these operators installable in v1 while they | 
|  | 20 | +transition to the new model, v1 is adding support for these two new *installModes*. It should be noted that, in line with v1's no multi-tenancy policy, | 
|  | 21 | +users will not be able to install the same operator multiple times, and that in future iterations of the registry bundle format will not | 
|  | 22 | +include *installModes*. | 
|  | 23 | + | 
|  | 24 | +## Demos | 
|  | 25 | + | 
|  | 26 | +### SingleNamespace Install | 
|  | 27 | + | 
|  | 28 | +[](https://asciinema.org/a/w1IW0xWi1S9cKQFb9jnR07mgh) | 
|  | 29 | + | 
|  | 30 | +### OwnNamespace Install | 
|  | 31 | + | 
|  | 32 | +[](https://asciinema.org/a/Rxx6WUwAU016bXFDW74XLcM5i) | 
|  | 33 | + | 
|  | 34 | +## Enabling the Feature-Gate | 
|  | 35 | + | 
|  | 36 | +!!! tip | 
|  | 37 | + | 
|  | 38 | +This guide assumes OLMv1 is already installed. If that is not the case, | 
|  | 39 | +you can follow the [getting started](../../getting-started/olmv1_getting_started.md) guide to install OLMv1. | 
|  | 40 | + | 
|  | 41 | +--- | 
|  | 42 | + | 
|  | 43 | +Patch the `operator-controller` `Deployment` adding `--feature-gates=SingleOwnNamespaceInstallSupport=true` to the | 
|  | 44 | +controller container arguments: | 
|  | 45 | + | 
|  | 46 | +```terminal title="Enable SingleOwnNamespaceInstallSupport feature-gate" | 
|  | 47 | +kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=SingleOwnNamespaceInstallSupport=true"}]' | 
|  | 48 | +``` | 
|  | 49 | + | 
|  | 50 | +Wait for `Deployment` rollout: | 
|  | 51 | + | 
|  | 52 | +```terminal title="Wait for Deployment rollout" | 
|  | 53 | +kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager | 
|  | 54 | +``` | 
|  | 55 | + | 
|  | 56 | +## Configuring the `ClusterExtension` | 
|  | 57 | + | 
|  | 58 | +A `ClusterExtension` can be configured to install bundle in `Single-` or `OwnNamespace` mode through the | 
|  | 59 | +`olm.operatorframework.io/watch-namespace: <namespace>` annotation. The *installMode* is inferred in the following way: | 
|  | 60 | + | 
|  | 61 | + - *AllNamespaces*: `<namespace>` is empty, or the annotation is not present | 
|  | 62 | + - *OwnNamespace*: `<namespace>` is the install namespace (i.e. `.spec.namespace`) | 
|  | 63 | + - *SingleNamespace*: `<namespace>` not the install namespace | 
|  | 64 | + | 
|  | 65 | +### Examples | 
|  | 66 | + | 
|  | 67 | +``` terminal title="SingleNamespace install mode example" | 
|  | 68 | +kubectl apply -f - <<EOF | 
|  | 69 | +apiVersion: olm.operatorframework.io/v1 | 
|  | 70 | +kind: ClusterExtension | 
|  | 71 | +metadata: | 
|  | 72 | +  name: argocd | 
|  | 73 | +  annotations: | 
|  | 74 | +    olm.operatorframework.io/watch-namespace: argocd-watch | 
|  | 75 | +spec: | 
|  | 76 | +  namespace: argocd | 
|  | 77 | +  serviceAccount: | 
|  | 78 | +    name: argocd-installer | 
|  | 79 | +  source: | 
|  | 80 | +    sourceType: Catalog | 
|  | 81 | +    catalog: | 
|  | 82 | +      packageName: argocd-operator | 
|  | 83 | +      version: 0.2.1 # Update to version 0.2.1 | 
|  | 84 | +    EOF | 
|  | 85 | +``` | 
|  | 86 | + | 
|  | 87 | +``` terminal title="OwnNamespace install mode example" | 
|  | 88 | +kubectl apply -f - <<EOF | 
|  | 89 | +apiVersion: olm.operatorframework.io/v1 | 
|  | 90 | +kind: ClusterExtension | 
|  | 91 | +metadata: | 
|  | 92 | +  name: argocd | 
|  | 93 | +  annotations: | 
|  | 94 | +    olm.operatorframework.io/watch-namespace: argocd | 
|  | 95 | +spec: | 
|  | 96 | +  namespace: argocd | 
|  | 97 | +  serviceAccount: | 
|  | 98 | +    name: argocd-installer | 
|  | 99 | +  source: | 
|  | 100 | +    sourceType: Catalog | 
|  | 101 | +    catalog: | 
|  | 102 | +      packageName: argocd-operator | 
|  | 103 | +      version: 0.2.1 # Update to version 0.2.1 | 
|  | 104 | +    EOF | 
|  | 105 | +``` | 
0 commit comments