Skip to content

Commit cf1d46b

Browse files
committed
Incorporate changes to OwnNamespace default handling procedure
More info: operator-framework/operator-controller#2283
1 parent 283340b commit cf1d46b

File tree

1 file changed

+42
-16
lines changed

1 file changed

+42
-16
lines changed

enhancements/olm/single-ownnamespace-enhancement-proposal.md

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ Future OLM v1 bundle formats will not include these legacy install mode concepts
3939

4040
The registry+v1 bundle format (used by OLM v0) includes install mode declarations (AllNamespaces, MultiNamespace, SingleNamespace, OwnNamespace) that affect how bundles are rendered into Kubernetes manifests. OLM v1 deliberately simplified operator installation by focusing on AllNamespaces mode to avoid complexity, but there exists significant existing registry+v1 bundle content in catalogs that only declares support for Single and OwnNamespace install modes.
4141

42+
### Install Mode Upgrade Behavior Edge Case
43+
44+
An important edge case exists around bundle upgrades and install mode behavior consistency. Consider this scenario:
45+
46+
1. **Initial State**: An operator bundle (v1.0) supports only `OwnNamespace` install mode
47+
2. **Installation**: User installs the operator without explicit `watchNamespace` configuration
48+
3. **Bundle Update**: Operator author releases bundle (v1.1) that adds `AllNamespaces` support alongside existing `OwnNamespace` support
49+
4. **Unintended Behavior**: Without proper validation, the system could automatically switch from `OwnNamespace` to `AllNamespaces` mode during upgrade, granting the operator cluster-wide permissions without user consent
50+
51+
This behavior is problematic because:
52+
- **Security Implications**: Operators suddenly gain broader permissions than originally intended
53+
- **Predictability**: Install mode changes occur without explicit administrator action
54+
- **Consistency**: The same bundle configuration produces different permission scopes across versions
55+
56+
To address this edge case, the implementation requires explicit `watchNamespace` configuration for namespace-scoped bundles (those not supporting `AllNamespaces` mode), ensuring that install mode selection is always deliberate and consistent across bundle upgrades.
57+
4258
### User Stories
4359

4460
#### Story 1: Legacy Operator Migration
@@ -47,6 +63,9 @@ As a cluster administrator migrating from OLM v0 to OLM v1, I want to install op
4763
#### Story 2: Operator Author Requirements
4864
As an operator developer, I have existing registry+v1 bundles that only support Single or OwnNamespace install modes, and I want my customers to be able to deploy these operators in OpenShift with OLM v1 so that the bundle content can be properly rendered and installed without requiring me to modify my existing bundle format during the migration to OLM v1.
4965

66+
#### Story 3: Install Mode Consistency Across Upgrades
67+
As a cluster administrator, I want to ensure that when I install an operator in a specific install mode (e.g., OwnNamespace), subsequent bundle upgrades that add new install mode capabilities (e.g., AllNamespaces) do not automatically change the install mode without my explicit consent, so that my operator's permission scope remains predictable and secure across versions.
68+
5069
### Goals
5170

5271
- Enable installation of registry+v1 bundles that only support SingleNamespace or OwnNamespace install modes
@@ -88,12 +107,12 @@ Update the OLMv1 operator-controller to support rendering registry+v1 bundles wi
88107
| AllNamespaces | SingleNamespace | OwnNamespace | WatchNamespace Configuration |
89108
|---------------|-----------------|--------------|------------------------------------------------------------------|
90109
| - | - | - | undefined/error (no supported install modes) |
91-
| - | - || no configuration |
110+
| - | - || required (must be install namespace) |
92111
| - || - | required (must not be install namespace) |
93-
| - ||| optional (default: install namespace) |
94-
|| - | - | no configuration |
95-
|| - || optional. If set, must be install namespace (default: unset) |
96-
||| - | optional. If set, must NOT be install namespace (default: unset) |
112+
| - ||| required (must specify target namespace) |
113+
|| - | - | no configuration |
114+
|| - || optional. If set, must be install namespace (default: unset) |
115+
||| - | optional. If set, must NOT be install namespace (default: unset) |
97116
|||| optional (default: unset) |
98117

99118
Add support for namespace-scoped operation by ensuring:
@@ -119,13 +138,18 @@ Ensure parity with OLMv0 behavior by:
119138
- `spec.namespace`: The installation namespace where the operator pod will run
120139
- `spec.config.inline.watchNamespace`: The namespace the operator should watch for resources
121140

122-
A scenario exists where the user must specify the watch namespace. Example workflow of a bundle that will require the watch namespace to be specified:
141+
For bundles that only support namespace-scoped install modes (SingleNamespace and/or OwnNamespace, but not AllNamespaces), the `watchNamespace` configuration is **required**. Example workflow:
123142

124-
1. User creates ClusterExtension for a bundle that only supportes SingleNamespace install mode but does not specify the watchNamespace
143+
1. User creates ClusterExtension for a bundle that only supports SingleNamespace or OwnNamespace install mode but does not specify the watchNamespace
125144
2. ClusterExtension does not install. The `Installing` and `Progressing` conditions will be set to false with an error that indicates the required `watchNamespace` is not specified
126-
3. User updates the ClusterExtension specifying the `watchNamespace` configuration to be an exiting namespace on the cluster
145+
3. User updates the ClusterExtension specifying the `watchNamespace` configuration to be an existing namespace on the cluster
127146
4. ClusterExtension installs successfully
128147

148+
This mandatory configuration requirement ensures that:
149+
- Install mode selection is always explicit for namespace-scoped operators
150+
- Bundle upgrades that add AllNamespaces support cannot automatically change the install mode
151+
- Administrators maintain control over operator permission scope across all bundle versions
152+
129153
```
130154
Note: Once a ClusterExtension is already installed, OLM will not prevent the `watchNamespace` parameter from being changed by the admin. OLM will reconcile again with the new parameter, however, whether the operator will then re-install successfully is dependent on the operator itself.
131155
```
@@ -262,25 +286,25 @@ The system determines the actual install mode based on the bundle's supported in
262286
|-------------------------|--------------------------|-----------------------|-----------|
263287
| AllNamespaces only | Not specified | AllNamespaces | Default behavior, no namespace scoping |
264288
| AllNamespaces only | Specified | Error | Bundle doesn't support namespace-scoped installation |
265-
| SingleNamespace only | Not specified | OwnNamespace | Default to most restrictive supported mode |
289+
| SingleNamespace only | Not specified | Error | watchNamespace required for namespace-scoped bundles |
266290
| SingleNamespace only | Specified (≠ install ns) | SingleNamespace | User's explicit choice, bundle supports it |
267291
| SingleNamespace only | Specified (= install ns) | Error | SingleNamespace cannot watch its own install namespace |
268-
| OwnNamespace only | Not specified | OwnNamespace | Use the only supported mode |
292+
| OwnNamespace only | Not specified | Error | watchNamespace required for namespace-scoped bundles |
269293
| OwnNamespace only | Specified (= install ns) | OwnNamespace | Explicit choice matches supported mode |
270294
| OwnNamespace only | Specified (≠ install ns) | Error | OwnNamespace can only watch install namespace |
271-
| Single + Own | Not specified | OwnNamespace | Default to more restrictive mode |
295+
| Single + Own | Not specified | Error | watchNamespace required for namespace-scoped bundles |
272296
| Single + Own | Specified (= install ns) | OwnNamespace | Namespace relationship determines mode |
273297
| Single + Own | Specified (≠ install ns) | SingleNamespace | Namespace relationship determines mode |
274298
| All + Single + Own | Not specified | AllNamespaces | Default to least restrictive mode for compatibility |
275299
| All + Single + Own | Specified (= install ns) | OwnNamespace | Namespace relationship determines mode |
276300
| All + Single + Own | Specified (≠ install ns) | SingleNamespace | Namespace relationship determines mode |
277301
278302
Default Mode Selection Rules are as follows:
279-
1. No watchNamespace specified: Use the most permissive mode supported by the bundle (AllNamespaces > OwnNamespace >
280-
SingleNamespace)
281-
2. watchNamespace = install namespace: Use OwnNamespace mode if supported, otherwise error
282-
3. watchNamespace ≠ install namespace: Use SingleNamespace mode if supported, otherwise error
283-
4. Unsupported mode requested: Installation fails with clear error message indicating supported modes
303+
1. **AllNamespaces-capable bundles**: When no `watchNamespace` is specified, default to `AllNamespaces` mode for maximum compatibility
304+
2. **Namespace-scoped bundles**: When bundles only support `SingleNamespace`/`OwnNamespace` modes, `watchNamespace` configuration is **required** to prevent implicit install mode changes during bundle upgrades
305+
3. **watchNamespace = install namespace**: Use `OwnNamespace` mode if supported, otherwise error
306+
4. **watchNamespace ≠ install namespace**: Use `SingleNamespace` mode if supported, otherwise error
307+
5. **Unsupported mode requested**: Installation fails with clear error message indicating supported modes
284308
285309
The relevant generated resources will be:
286310
- Role/RoleBinding resources for namespace-scoped permissions in Single/OwnNamespace modes
@@ -310,6 +334,7 @@ Because we are enabling namespace-scoped operator installations, there are opera
310334
- **Namespace Dependency**: Clear error messages when target namespaces don't exist or aren't accessible
311335
- **Migration Complexity**: Comprehensive documentation and examples for transitioning between install modes
312336
- **Permission Escalation**: ServiceAccount validation ensures adequate permissions without over-privileging
337+
- **Unintended Install Mode Changes**: Requiring explicit `watchNamespace` configuration for namespace-scoped bundles prevents automatic permission scope escalation when bundle upgrades add new install mode capabilities
313338
314339
Currently, admins control the scope of operator installations through ClusterExtension RBAC. This enhancement adds namespace-level controls while maintaining existing security boundaries.
315340
@@ -327,6 +352,7 @@ Operators installed in Single/OwnNamespace modes have reduced blast radius compa
327352
| **Installation Failures** | Medium | Detailed preflight checks and validation; clear error reporting |
328353
| **Security Boundaries** | Medium | Explicit validation of namespace permissions; RBAC properly scoped |
329354
| **Feature Proliferation** | Low | Clear documentation that this is for legacy compatibility only |
355+
| **Unintended Install Mode Changes** | High | Mandatory `watchNamespace` configuration for namespace-scoped bundles prevents automatic mode switching during upgrades |
330356
331357
### Drawbacks
332358

0 commit comments

Comments
 (0)