Skip to content

Commit c076f9f

Browse files
committed
docs update
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 1ea7b72 commit c076f9f

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

Diff for: docs/documentation/dependent-resources.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ conditionally creating an `Ingress`:
239239

240240
@ControllerConfiguration
241241
public class WebPageStandaloneDependentsReconciler
242-
implements Reconciler<WebPage>, ErrorStatusHandler<WebPage>,
243-
EventSourceInitializer<WebPage> {
242+
implements Reconciler<WebPage>, ErrorStatusHandler<WebPage> {
244243

245244
private KubernetesDependentResource<ConfigMap, WebPage> configMapDR;
246245
private KubernetesDependentResource<Deployment, WebPage> deploymentDR;
@@ -307,16 +306,12 @@ public class WebPageStandaloneDependentsReconciler
307306
There are multiple things happening here:
308307

309308
1. Dependent resources are explicitly created and can be access later by reference.
310-
2. Event sources are produced by the dependent resources, but needs to be explicitly registered in
311-
this case by implementing
312-
the [`EventSourceInitializer`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/EventSourceInitializer.java)
313-
interface.
314-
3. The input html is validated, and error message is set in case it is invalid.
315-
4. Reconciliation of dependent resources is called explicitly, but here the workflow
309+
2. The input html is validated, and error message is set in case it is invalid.
310+
3. Reconciliation of dependent resources is called explicitly, but here the workflow
316311
customization is fully in the hand of the developer.
317-
5. An `Ingress` is created but only in case `exposed` flag set to true on custom resource. Tries to
312+
4. An `Ingress` is created but only in case `exposed` flag set to true on custom resource. Tries to
318313
delete it if not.
319-
6. Status is set in a different way, this is just an alternative way to show, that the actual state
314+
5. Status is set in a different way, this is just an alternative way to show, that the actual state
320315
can be read using the reference. This could be written in a same way as in the managed example.
321316

322317
See the full source code of

Diff for: docs/documentation/features.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,19 @@ related [method](https://github.com/java-operator-sdk/java-operator-sdk/blob/mai
491491
492492
### Registering Event Sources
493493
494-
To register event sources, your `Reconciler` has to implement the
495-
[`EventSourceInitializer`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/EventSourceInitializer.java)
496-
interface and initiliaze a list of event sources to register. One way to see this in action is
494+
To register event sources, your `Reconciler` has to override the `prepareEventSources` and return
495+
list of event sources to register. One way to see this in action is
497496
to look at the
498497
[tomcat example](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/sample-operators/tomcat-operator/src/main/java/io/javaoperatorsdk/operator/sample/TomcatReconciler.java)
499498
(irrelevant details omitted):
500499
501500
```java
502501
503502
@ControllerConfiguration
504-
public class TomcatReconciler implements Reconciler<Tomcat>, EventSourceInitializer<Tomcat> {
503+
public class TomcatReconciler implements Reconciler<Tomcat> {
505504
505+
// omitted code
506+
506507
@Override
507508
public List<EventSource> prepareEventSources(EventSourceContext<Tomcat> context) {
508509
var configMapEventSource =
@@ -511,9 +512,9 @@ public class TomcatReconciler implements Reconciler<Tomcat>, EventSourceInitiali
511512
.withSecondaryToPrimaryMapper(
512513
Mappers.fromAnnotation(ANNOTATION_NAME, ANNOTATION_NAMESPACE)
513514
.build(), context));
514-
return EventSourceInitializer.nameEventSources(configMapEventSource);
515+
return EventSourceUtils.nameEventSources(configMapEventSource);
515516
}
516-
...
517+
517518
}
518519
```
519520
@@ -678,7 +679,7 @@ configured appropriately so that the `followControllerNamespaceChanges` method r
678679

679680
@ControllerConfiguration
680681
public class MyReconciler
681-
implements Reconciler<TestCustomResource>, EventSourceInitializer<TestCustomResource> {
682+
implements Reconciler<TestCustomResource> {
682683

683684
@Override
684685
public Map<String, EventSource> prepareEventSources(
@@ -689,7 +690,7 @@ public class MyReconciler
689690
.withNamespacesInheritedFromController(context)
690691
.build(), context);
691692

692-
return EventSourceInitializer.nameEventSources(configMapES);
693+
return EventSourceUtils.nameEventSources(configMapES);
693694
}
694695

695696
}

Diff for: docs/documentation/v5-0-migration.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ permalink: /docs/v5-0-migration
1212
1. [Result of managed dependent resources](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/dependent/managed/ManagedDependentResourceContext.java#L55-L57)
1313
is not `Optional` anymore. In case you use this result, simply use the result
1414
objects directly.
15+
2. `EventSourceInitializer` is not a separate interface anymore. It is part of the `Reconciler` interface with a
16+
default implementation. You can simply remove this interface from your reconciler. The
17+
[`EventSourceUtils`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/EventSourceUtils.java#L11-L11)
18+
contains all the utility classes for naming that was in the interface before.

Diff for: docs/documentation/workflows.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ page sample):
122122
@ControllerConfiguration(
123123
labelSelector = WebPageDependentsWorkflowReconciler.DEPENDENT_RESOURCE_LABEL_SELECTOR)
124124
public class WebPageDependentsWorkflowReconciler
125-
implements Reconciler<WebPage>, ErrorStatusHandler<WebPage>, EventSourceInitializer<WebPage> {
125+
implements Reconciler<WebPage>, ErrorStatusHandler<WebPage> {
126126

127127
public static final String DEPENDENT_RESOURCE_LABEL_SELECTOR = "!low-level";
128128
private static final Logger log =
@@ -147,7 +147,7 @@ public class WebPageDependentsWorkflowReconciler
147147

148148
@Override
149149
public Map<String, EventSource> prepareEventSources(EventSourceContext<WebPage> context) {
150-
return EventSourceInitializer.nameEventSources(
150+
return EventSourceUtils.nameEventSources(
151151
configMapDR.initEventSource(context),
152152
deploymentDR.initEventSource(context),
153153
serviceDR.initEventSource(context),

0 commit comments

Comments
 (0)