Closed
Description
Bug Report
What did you do?
I created Reconciler on primary resource and CRUDKubernetesDependentResource connected with it. On the next step i triggered reconciliation which should update dependent resource.
What did you expect to see?
Single call of desired
method
What did you see instead? Under which circumstances?
Two calls of desired
method - second is redundant.
Additional context
After analysis i assume the root cause is HERE. The desired
method is called here even if Optional returned from computedDesired
has value. It's a pretty common mistake during using optionals, that orElse
is called instead of orElseGet
when we really need lazy evaluation.
Possible Solution
Just make desired
call lazily evaluated by using orElseGet
;)
Environment
$ Mention java-operator-sdk version from pom.xml file
3.1.1
Metadata
Metadata
Assignees
Labels
No labels