Skip to content

🌱 Use IgnoreNotFound when fetching related objects in controllers#1906

Draft
abdullah599 wants to merge 2 commits intov1.1.xfrom
abd/1894
Draft

🌱 Use IgnoreNotFound when fetching related objects in controllers#1906
abdullah599 wants to merge 2 commits intov1.1.xfrom
abd/1894

Conversation

@abdullah599
Copy link
Copy Markdown

@abdullah599 abdullah599 commented Mar 27, 2026

What this PR does / why we need it:
Uses client.IgnoreNotFound when fetching related objects (Machine, Cluster, HetznerCluster, HetznerBareMetalMachine) across all controllers. This prevents repeated reconciliation loops when related objects are missing due to dangling references (the controller cannot fix these inconsistencies, so it should stop reconciling instead of retrying indefinitely).

Which issue(s) this PR fixes:
Fixes #1894

Special notes for your reviewer:
Base branch is v1.1.x.

TODOs:

  • squash commits
  • include documentation
  • add unit tests

@abdullah599 abdullah599 self-assigned this Mar 27, 2026
@abdullah599 abdullah599 requested a review from janiskemper March 27, 2026 09:30
@github-actions github-actions bot added size/S Denotes a PR that changes 20-50 lines, ignoring generated files. area/code Changes made in the code directory labels Mar 27, 2026
if err != nil {
return reconcile.Result{}, client.IgnoreNotFound(err)
}
if cluster == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if cluster == nil i.e. the owner ref is not set yet, even then we can return without reque because once owner ref is set (i.e. there is an update) , the object will be reconciled again.

Similar at other places

  • GetOwnerMachine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code Changes made in the code directory size/S Denotes a PR that changes 20-50 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants