Skip to content

Commit 09180ab

Browse files
authored
docs: fixes and improvements (#839)
1 parent 5a7d1be commit 09180ab

File tree

3 files changed

+224
-46
lines changed

3 files changed

+224
-46
lines changed

docs/documentation/faq.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,36 @@ layout: docs
55
permalink: /docs/faq
66
---
77

8-
## Q: How can I access events?
8+
### Q: How can I access the events which triggered the Reconciliation?
99
In the v1.* version events were exposed to `Reconciler` (in v1 called `ResourceController`). This
1010
included events (Create, Update) of the custom resource, but also events produced by Event Sources. After
1111
long discussions also with developers of golang version (controller-runtime), we decided to remove access to
1212
these events. We already advocated to not use events in the reconciliation logic, since events can be lost.
1313
Instead reconcile all the resources on every execution of reconciliation. On first this might sound a little
14-
opinionated, but there was a sound agreement between the developers that this is the way to go.
14+
opinionated, but there was a sound agreement between the developers that this is the way to go.
15+
16+
### Q: Can I re-schedule a reconciliation, possibly with a specific delay?
17+
Yes, this can be done using [`UpdateControl`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/UpdateControl.java) and [`DeleteControl`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DeleteControl.java)
18+
, see:
19+
20+
```java
21+
@Override
22+
public UpdateControl<MyCustomResource> reconcile(
23+
EventSourceTestCustomResource resource, Context context) {
24+
...
25+
return UpdateControl.updateStatus(resource).rescheduleAfter(10, TimeUnit.SECONDS);
26+
}
27+
```
28+
29+
without an update:
30+
31+
```java
32+
@Override
33+
public UpdateControl<MyCustomResource> reconcile(
34+
EventSourceTestCustomResource resource, Context context) {
35+
...
36+
return UpdateControl.<MyCustomResource>noUpdate().rescheduleAfter(10, TimeUnit.SECONDS);
37+
}
38+
```
39+
40+
Although you might consider using `EventSources`, to handle reconciliation triggering in a smarter way.

0 commit comments

Comments
 (0)