-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
Description
Actually, when the secret is not yet created, the mysql schema sample is throwing some errors in SchemaDependentResource due to orElseThrow
.
The same apply with the reconciler
I'm trying to avoid these exceptions because there are not really exceptions, but just the fact that some requirement are not yet satisfied. So I tried,
@Override
public Schema desired(MySQLSchema primary, Context<MySQLSchema> context) {
return context.getSecondaryResource(Secret.class)
.map(secret -> new Schema(primary.getMetadata().getName(), primary.getSpec().getEncoding()))
.orElse(null);
}
But AbstractDependentResource.logForOperation
produces an NPE and even if it doesn't, I think that create
should not be call.
It is not clear what to do in such a case. I don't feel like exception are the way to go because it raise a call to updateErrorStatus
when it should definitely not. Should desired return an Optional<R>
?