Skip to content

Commit 9781a9a

Browse files
committed
docs
1 parent 0e55c64 commit 9781a9a

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

docs/documentation/patterns-best-practices.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Thanks to the declarative nature of Kubernetes resources, operators that deal on
9494
Kubernetes resources can operator in a stateless fashion, i.e. they do not need to maintain
9595
information about the state of these resources, as it should be possible to completely rebuild
9696
the resource state from its representation (that's what declarative means, after all).
97-
However, this usually doesn't hold true anymore when dealing with external resources and it
97+
However, this usually doesn't hold true anymore when dealing with external resources, and it
9898
might be necessary for the operator to keep track of this external state so that it is available
9999
when another reconciliation occurs. While such state could be put in the primary resource's
100100
status sub-resource, this could become quickly difficult to manage if a lot of state needs to be
@@ -105,9 +105,19 @@ advised to put such state into a separate resource meant for this purpose such a
105105
Kubernetes Secret or ConfigMap or even a dedicated Custom Resource, which structure can be more
106106
easily validated.
107107

108-
## Stopping (or not) Operator in case of Informer Errors During Startup
108+
## Stopping (or not) Operator in case of Informer Errors
109109

110110
It can
111111
be [configured](https://github.com/java-operator-sdk/java-operator-sdk/blob/2cb616c4c4fd0094ee6e3a0ef2a0ea82173372bf/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L168-L168)
112-
on Operator level, if it should stop in case of informer errors on startup.
112+
if the operator should stop in case of any informer error happens on startup. By default, if there ia an error on
113+
startup and the informer for example has no permissions list the target resources (both the primary resource or
114+
secondary resources) the operator will stop instantly. This behavior can be altered by setting the mentioned flag
115+
to `false`, so operator will start even some informers are not started. In this case - same as in case when an informer
116+
is started at first but experienced problems later - will continuously retry the connection indefinitely with an
117+
exponential backoff. The operator will just stop if there is a fatal
118+
error, [currently](https://github.com/java-operator-sdk/java-operator-sdk/blob/0e55c640bf8be418bc004e51a6ae2dcf7134c688/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerWrapper.java#L64-L66)
119+
that is when a resource cannot be deserialized. The typical use case for changing this flag is when a list of namespaces
120+
is watched by a controller. In is better to start up the operator, so it can handle other namespaces while there
121+
might be a permission issue for some resources in another namespace.
122+
113123

operator-framework/src/test/java/io/javaoperatorsdk/operator/InformerRelatedBehaviorITS.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import static org.junit.jupiter.api.Assertions.assertThrows;
2323

2424
/**
25-
* The test relies on a special minikube configuration: "min-request-timeout" to have a very low
26-
* value, see: "minikube start --extra-config=apiserver.min-request-timeout=3"
25+
* The test relies on a special api server configuration: "min-request-timeout" to have a very low
26+
* value, use: "minikube start --extra-config=apiserver.min-request-timeout=3"
2727
*
2828
* <p>
2929
* This is important when tests are affected by permission changes, since the watch permissions are

0 commit comments

Comments
 (0)