Skip to content

Commit d6cc6de

Browse files
committed
05-remove-single-own-namespace
1 parent a191e41 commit d6cc6de

File tree

56 files changed

+241
-46532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+241
-46532
lines changed

cmd/operator-controller/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,9 @@ func run() error {
475475

476476
certProvider := getCertificateProvider()
477477
regv1ManifestProvider := &applier.RegistryV1ManifestProvider{
478-
BundleRenderer: registryv1.Renderer,
479-
CertificateProvider: certProvider,
480-
IsWebhookSupportEnabled: certProvider != nil,
481-
IsSingleOwnNamespaceEnabled: features.OperatorControllerFeatureGate.Enabled(features.SingleOwnNamespaceInstallSupport),
478+
BundleRenderer: registryv1.Renderer,
479+
CertificateProvider: certProvider,
480+
IsWebhookSupportEnabled: certProvider != nil,
482481
}
483482
var cerCfg reconcilerConfigurator
484483
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {
Lines changed: 45 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,90 @@
11
## Description
22

3-
!!! note
4-
This feature is still in `alpha` and the `SingleOwnNamespaceInstallSupport` feature-gate must be enabled to make use of it.
5-
See the instructions below on how to enable it.
3+
# Configuring OLM v1 Extensions: Deployment Configuration
64

7-
---
5+
In OLM v1, extensions are configured through the `ClusterExtension` resource. This guide explains how to customize operator deployments using the `deploymentConfig` option.
86

9-
# Configuring OLM v1 Extensions: Migration and Reference
7+
## Deployment Configuration
108

11-
In OLM v1, the way extensions are configured has changed significantly to improve flexibility and consistency. This guide explains the architectural shift from OLM v0, how to inspect bundles for supported configurations, and how to correctly configure `registry+v1` (legacy) bundles using the new `ClusterExtension` API.
9+
The `deploymentConfig` option allows you to customize operator deployments with environment variables, resource limits, node selectors, tolerations, and other settings. This follows the same structure as OLM v0's `Subscription.spec.config`.
1210

13-
## OLM v0 vs. OLM v1: The Configuration Shift
11+
### Available Fields
1412

15-
In **OLM v0**, configuration was split across multiple resources and concepts. "Install Modes" (defining which namespaces an Operator watches) were handled by the `OperatorGroup` resource, while operand configuration (environment variables, resource limits) was handled via the `Subscription` resource.
13+
| Field | Description |
14+
|:----------------|:------------------------------------------------------|
15+
| `env` | Environment variables to set on the operator container |
16+
| `envFrom` | Sources for environment variables |
17+
| `resources` | CPU/memory resource requests and limits |
18+
| `nodeSelector` | Node labels for pod scheduling |
19+
| `tolerations` | Tolerations for node taints |
20+
| `volumes` | Additional volumes to mount |
21+
| `volumeMounts` | Volume mount paths for the operator container |
22+
| `affinity` | Pod scheduling affinity rules |
23+
| `annotations` | Additional annotations to add to the deployment |
1624

17-
In **OLM v1**, these concepts are unified under the **ClusterExtension** resource.
18-
19-
| Feature | OLM v0 Approach | OLM v1 Approach |
20-
|:--------------------|:----------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------|
21-
| **Namespace Scope** | Defined by **OperatorGroup**. You had to pre-create an OperatorGroup to tell the Operator where to watch. | Defined by **Configuration**. You provide a `watchNamespace` value directly in the `ClusterExtension` YAML. |
22-
| **User Settings** | `Subscription.spec.config` (e.g., env, resources). | `ClusterExtension.spec.config.inline` (arbitrary JSON/YAML defined by the bundle author). |
23-
| **Multi-Tenancy** | "Install Modes" allowed multiple instances of an operator to exist. | "Install Modes" are treated as **bundle configuration**. You install the extension once, and configure it to watch specific areas. |
24-
25-
### The `watchNamespace` Configuration
26-
27-
For existing `registry+v1` bundles (standard OLM bundles), OLM v1 automatically generates a configuration schema based on the bundle's capabilities. The primary configuration field available is `watchNamespace`.
28-
29-
* **OLM v0:** You selected `SingleNamespace` mode by creating an `OperatorGroup` that targeted a specific namespace.
30-
* **OLM v1:** You set `watchNamespace: "my-target-namespace"` inside the `ClusterExtension` config.
31-
32-
## Step 1: Identifying Bundle Capabilities
33-
34-
Before configuring a bundle, you must understand which Install Modes it supports. OLM v1 does not allow you to force a configuration that the bundle author has not explicitly supported.
35-
36-
You can inspect a bundle image using the `opm` CLI tool and `jq` to parse the output.
37-
38-
**Prerequisites:**
39-
* `opm` CLI installed.
40-
* `jq` installed.
41-
42-
**Command:**
43-
44-
Run the following command, replacing `<bundle-image>` with your target image (e.g., `quay.io/example/my-operator-bundle:v1.0.0`).
45-
46-
```bash
47-
opm render <bundle-image> -o json | \
48-
jq 'select(.schema == "olm.bundle") | .properties[] | select(.type == "olm.csv") | .value.spec.installModes'
49-
```
50-
51-
**Example Output:**
52-
53-
```json
54-
[
55-
{
56-
"type": "OwnNamespace",
57-
"supported": true
58-
},
59-
{
60-
"type": "SingleNamespace",
61-
"supported": true
62-
},
63-
{
64-
"type": "MultiNamespace",
65-
"supported": false
66-
},
67-
{
68-
"type": "AllNamespaces",
69-
"supported": false
70-
}
71-
]
72-
```
73-
74-
By analyzing which modes are marked `true`, you can determine how to configure the `ClusterExtension` in the next step.
75-
76-
## Step 2: Capability Matrix & Configuration Guide
77-
78-
Use the output from Step 1 to locate your bundle's capabilities in the matrix below. This determines if you *must* provide configuration, if it is optional, and what values are valid.
79-
80-
### Legend
81-
* **Install Namespace:** The namespace where the Operator logic (Pod) runs (defined in `ClusterExtension.spec.namespace`).
82-
* **Watch Namespace:** The namespace the Operator monitors for Custom Resources (defined in `spec.config.inline.watchNamespace`).
83-
84-
### Configuration Matrix
85-
86-
| Capabilities Detected (from `opm`) | `watchNamespace` Field Status | Valid Values / Constraints |
87-
|:-----------------------------------------|:------------------------------|:----------------------------------------------------------------------------------------------------------|
88-
| **OwnNamespace ONLY** | **Required** | Must be exactly the same as the **Install Namespace**. |
89-
| **SingleNamespace ONLY** | **Required** | Must be **different** from the Install Namespace. |
90-
| **OwnNamespace** AND **SingleNamespace** | **Required** | Can be **any** namespace (either the install namespace or a different one). |
91-
| **AllNamespaces** (regardless of others) | **Optional** | If omitted: defaults to Cluster-wide watch.<br>If provided: can be any specific namespace (limits scope). |
92-
93-
### Common Configuration Scenarios
94-
95-
#### Scenario A: The Legacy "OwnNamespace" Operator
96-
* **Capability:** Only supports `OwnNamespace`.
97-
* **Requirement:** The operator is hardcoded to watch its own namespace.
98-
* **Config:** You must explicitly set `watchNamespace` to match the installation namespace.
25+
### Example: Setting Environment Variables and Resource Limits
9926

10027
```yaml
10128
apiVersion: olm.operatorframework.io/v1
10229
kind: ClusterExtension
10330
metadata:
10431
name: my-operator
10532
spec:
106-
namespace: my-operator-ns # <--- Install Namespace
33+
namespace: my-operator-ns
10734
serviceAccount:
10835
name: my-sa
10936
config:
11037
configType: Inline
11138
inline:
112-
watchNamespace: my-operator-ns # <--- MUST match Install Namespace
39+
deploymentConfig:
40+
env:
41+
- name: LOG_LEVEL
42+
value: debug
43+
resources:
44+
requests:
45+
memory: "256Mi"
46+
cpu: "100m"
47+
limits:
48+
memory: "512Mi"
49+
cpu: "500m"
11350
source:
11451
sourceType: Catalog
11552
catalog:
11653
packageName: my-package
11754
```
11855
119-
#### Scenario B: The "SingleNamespace" Operator
120-
* **Capability:** Supports `SingleNamespace` (but not `OwnNamespace`).
121-
* **Requirement:** The operator runs in one namespace (e.g., `ops-system`) but watches workloads in another (e.g., `dev-team-a`).
122-
* **Config:** You must set `watchNamespace` to the target workload namespace.
56+
### Example: Node Scheduling
12357
12458
```yaml
12559
apiVersion: olm.operatorframework.io/v1
12660
kind: ClusterExtension
12761
metadata:
128-
name: monitor-operator
62+
name: my-operator
12963
spec:
130-
namespace: ops-system # <--- Install Namespace
64+
namespace: my-operator-ns
13165
serviceAccount:
132-
name: monitor-operator-installer
133-
source:
134-
sourceType: Catalog
135-
catalog:
136-
packageName: monitor-operator
66+
name: my-sa
13767
config:
13868
configType: Inline
13969
inline:
140-
watchNamespace: dev-team-a # <--- MUST differ from Install Namespace
141-
```
142-
143-
#### Scenario C: The Modern "AllNamespaces" Operator
144-
* **Capability:** Only supports `AllNamespaces`.
145-
146-
```yaml
147-
apiVersion: olm.operatorframework.io/v1
148-
kind: ClusterExtension
149-
metadata:
150-
name: global-operator
151-
spec:
152-
namespace: operators
153-
# No config provided = Operator watches the entire cluster (AllNamespaces)
154-
serviceAccount:
155-
name: global-operator-installer
70+
deploymentConfig:
71+
nodeSelector:
72+
kubernetes.io/os: linux
73+
tolerations:
74+
- key: "node-role.kubernetes.io/infra"
75+
operator: "Exists"
76+
effect: "NoSchedule"
15677
source:
15778
sourceType: Catalog
15879
catalog:
159-
packageName: global-operator
80+
packageName: my-package
16081
```
16182
162-
16383
## Troubleshooting Configuration Errors
16484
16585
OLM v1 validates your configuration against the bundle's schema before installation proceeds. If your configuration is invalid, the `ClusterExtension` will report a `Progressing` condition with an error message.
16686

167-
| Error Message Example | Cause | Solution |
168-
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|
169-
| `required field "watchNamespace" is missing` | The bundle does not support `AllNamespaces` default mode. | Add the `inline` block and specify a `watchNamespace`. |
170-
| `invalid value "X": watchNamespace must be "Y" (the namespace where the operator is installed) because this operator only supports OwnNamespace install mode` | You tried to set a different watch namespace for an `OwnNamespace`-only bundle. | Change `watchNamespace` to match `spec.namespace`. |
171-
| `invalid value "X": watchNamespace must be different from "Y" (the install namespace) because this operator uses SingleNamespace install mode to watch a different namespace` | You tried to set the watch namespace to the install namespace for a `SingleNamespace`-only bundle. | Change `watchNamespace` to a different target namespace. |
172-
| `unknown field "foo"` | You added extra fields to the inline config. | Remove fields other than `watchNamespace` (unless the bundle author explicitly documents extra schema support). |
87+
| Error Message Example | Cause | Solution |
88+
|:--------------------------------|:---------------------------------------------|:---------------------------------------------------------|
89+
| `unknown field "foo"` | You added fields not in the config schema. | Remove unsupported fields from the inline config. |
90+
| `invalid type for field "..."` | A field has the wrong type (e.g., string instead of array). | Check the expected type and correct the value. |

docs/draft/howto/single-ownnamespace-install.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)