Skip to content

Commit 46994e3

Browse files
committed
docs: clarify
1 parent 325f481 commit 46994e3

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

docs/documentation/features.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -460,16 +460,19 @@ For more information about MDC see this [link](https://www.baeldung.com/mdc-in-l
460460

461461
## Dynamically Changing Target Namespaces
462462

463-
A controller can be configured to watch a set of namespaces (not only a single namespace or the whole cluster).
464-
The framework supports to dynamically change the list of these namespaces while the operator is running.
465-
When a reconciler is registered the
466-
[`RegisteredController`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ec37025a15046d8f409c77616110024bf32c3416/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/RegisteredController.java#L5-L5)
467-
is returned, which provides the related methods. These namespaces are meant to be changed when the operator is already
468-
running.
469-
470-
In a real life scenario usually the list of the target namespaces configured in `ConfigMap` or other input,
471-
this part however is out of the scope of the framework. So in case you want to use a `ConfigMap` and react to change
472-
of it, registering an Informer and calling the `RegisteredController` is up to the developer to implement.
463+
A controller can be configured to watch a specific set of namespaces in addition of the
464+
namespace in which it is currently deployed or the whole cluster. The framework supports
465+
dynamically changing the list of these namespaces while the operator is running.
466+
When a reconciler is registered, an instance of
467+
[`RegisteredController`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ec37025a15046d8f409c77616110024bf32c3416/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/RegisteredController.java#L5)
468+
is returned, providing access to the methods allowing users to change watched namespaces as the
469+
operator is running.
470+
471+
A typical scenario would probably involve extracting the list of target namespaces from a
472+
`ConfigMap` or some other input but this part is out of the scope of the framework since this is
473+
use-case specific. For example, reacting to changes to a `ConfigMap` would probably involve
474+
registering an associated `Informer` and then calling the `changeNamespaces` method on
475+
`RegisteredController`.
473476

474477
```java
475478

@@ -485,9 +488,10 @@ of it, registering an Informer and calling the `RegisteredController` is up to t
485488

486489
```
487490

488-
If a target namespaces change for a controller, it might be desirable to change the target namespaces of registered
489-
`InformerEventSource`-s. In order to express this, the InformerEventSource needs to be configured to
490-
`followControllerNamespaceChanges`, this the related method in `InformerConfiguration` should return `true`:
491+
If watched namespaces change for a controller, it might be desirable to propagate these changes to
492+
`InformerEventSources` associated with the controller. In order to express this,
493+
`InformerEventSource` implementations interested in following such changes need to be
494+
configured appropriately so that the `followControllerNamespaceChanges` method returns `true`:
491495

492496
```java
493497

@@ -501,7 +505,7 @@ public class MyReconciler
501505

502506
InformerEventSource<ConfigMap, TestCustomResource> configMapES =
503507
new InformerEventSource<>(InformerConfiguration.from(ConfigMap.class)
504-
.setAndFollowControllerNamespaceChanges(context)
508+
.withNamespacesInheritedFromController(context)
505509
.build(), context);
506510

507511
return EventSourceInitializer.nameEventSources(configMapES);

0 commit comments

Comments
 (0)