Skip to content

docs: fixes and improvements #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions docs/documentation/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,36 @@ layout: docs
permalink: /docs/faq
---

## Q: How can I access events?
### Q: How can I access the events which triggered the Reconciliation?
In the v1.* version events were exposed to `Reconciler` (in v1 called `ResourceController`). This
included events (Create, Update) of the custom resource, but also events produced by Event Sources. After
long discussions also with developers of golang version (controller-runtime), we decided to remove access to
these events. We already advocated to not use events in the reconciliation logic, since events can be lost.
Instead reconcile all the resources on every execution of reconciliation. On first this might sound a little
opinionated, but there was a sound agreement between the developers that this is the way to go.
opinionated, but there was a sound agreement between the developers that this is the way to go.

### Q: Can I re-schedule a reconciliation, possibly with a specific delay?
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)
, see:

```java
@Override
public UpdateControl<MyCustomResource> reconcile(
EventSourceTestCustomResource resource, Context context) {
...
return UpdateControl.updateStatus(resource).rescheduleAfter(10, TimeUnit.SECONDS);
}
```

without an update:

```java
@Override
public UpdateControl<MyCustomResource> reconcile(
EventSourceTestCustomResource resource, Context context) {
...
return UpdateControl.<MyCustomResource>noUpdate().rescheduleAfter(10, TimeUnit.SECONDS);
}
```

Although you might consider using `EventSources`, to handle reconciliation triggering in a smarter way.
Loading