Skip to content

AbstractDependentResource reconciles two times on update #1535

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

Closed
psemeniuk opened this issue Oct 11, 2022 · 1 comment · Fixed by #1537
Closed

AbstractDependentResource reconciles two times on update #1535

psemeniuk opened this issue Oct 11, 2022 · 1 comment · Fixed by #1537

Comments

@psemeniuk
Copy link

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

@metacosm
Copy link
Collaborator

Indeed! 🤦🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants