java-operator-sdk
java-operator-sdk copied to clipboard
isLastAttempt() is false on the single call to handle error when max-attempts is zero
Bug Report
To track the issue raised by https://github.com/quarkiverse/quarkus-operator-sdk/issues/380
The problem is that the first reconcile loop has no information from the RetryConfiguration if the builded RetryInfo will actually provide a nextDelay.
As it seems that retryConfiguration cannot be null (there is always a default one), Instead of
@Override
public boolean isLastAttempt() {
return controller.getConfiguration().getRetryConfiguration() == null;
}
may be something like
@Override
public boolean isLastAttempt() {
return controller.getConfiguration().getRetryConfiguration().isActive()l;
}
The GenericRetryConfiguration may return false when max-attemps is 0.
A repro https://github.com/scrocquesel/java-operator-sdk/blob/gh-1395/operator-framework/src/test/java/io/javaoperatorsdk/operator/ErrorStatusHandlerLastAttemptIT.java
I think it should be rather nullable, thus controller.getConfiguration().getRetryConfiguration() should return an Optional?
That is better describing the domain, that there might not be a retry.
I think it should be rather nullable, thus
controller.getConfiguration().getRetryConfiguration()should return anOptional?That is better describing the domain, that there might not be a retry.
It means that the configuration process is aware of why a given config for a given implementation would not produce a retry so it can set an empty RetryConfiguration instead of the given config/implementation.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
@scrocquesel fixed this here: https://github.com/java-operator-sdk/java-operator-sdk/pull/1595 pls take a look if you have some time.
it is quite simple this way.