Skip to content

Conversation

@guettli
Copy link
Collaborator

@guettli guettli commented Nov 27, 2025

Some changes of this PR got extracted, so that the PR gets smaller and easier to review:

🌱 Remove usage of FailureReason and FailureMessage (baremetal) by guettli · Pull Request #1716 · syself/cluster-api-provider-hetzner

  • Add/extended comments to some parts.
  • move rate-limit handling code up, to return early if rate-limit is active.
  • avoid usage of capierrors package.
  • test code: Align capi-machine name and infra-machine name. Remediation code depends on that capi feature.
  • tee tmp/test-unit-unfiltered.log in test-unis.sh: Write unmodfied output to tmp directory. This is handy if you want to see all logs, without running tests again.
  • export func GetAssociatedHost(), so that it can be re-used.
  • refactored getAssociatedHost() to getAssociatedHostAndPatchHelper(), so that the code can be re-used.
  • add log when hbmm is deleting.
  • avoid duplicate implemenation of splitHostKey()
  • refactored setOwnerRemediatedConditionNew() to setOwnerRemediatedConditionToFailed(): Avoid duplicated code by adding functionality to setOwnerRemediatedConditionToFailed(): Use the same message for the created Event and the condition, and set Phase to PhaseDeleting.
  • removed named return parameters: return res, nil --> return reconcile.Result{}, nil
  • hbmm have an annotation pointing to the hbmh. The reference is a string in the format "namespace/hbmh-name". The namespace will be ignored from now on, because cross-namespace references are not allowed. This is not a breaking change, because we expect that both namespace strings are always equal.

@github-actions github-actions bot added size/L Denotes a PR that changes 200-800 lines, ignoring generated files. area/hack Changes made in the hack directory area/code Changes made in the code directory area/api Changes made in the api directory labels Nov 27, 2025
@guettli guettli requested a review from janiskemper November 27, 2025 12:48
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

I didn't fully understand the remediation part. Please add some explanation for the refactoring in the PR description

@guettli
Copy link
Collaborator Author

guettli commented Nov 27, 2025

I didn't fully understand the remediation part. Please add some explanation for the refactoring in the PR description

can you please point me to a line in the code?

@guettli guettli requested a review from janiskemper November 27, 2025 15:49
@janiskemper
Copy link
Contributor

@guettli I didn't understand the reason for this part "refactored setOwnerRemediatedConditionNew() to setOwnerRemediatedConditionToFailed()"

@guettli
Copy link
Collaborator Author

guettli commented Dec 2, 2025

@guettli I didn't understand the reason for this part "refactored setOwnerRemediatedConditionNew() to setOwnerRemediatedConditionToFailed()"

When you look at the places where setOwnerRemediatedConditionToFailed() gets used, then you might see that the same code was repeated. But it was not consistently. It makes sense to have the same message in the condition and in the event. Additionally, Phase = infrav1.PhaseDeleting should be set. So added this to the function and gave it a (from my perspective) better name.

do you want something to be changed here?

@janiskemper
Copy link
Contributor

okay understood it now. Can you plz add this information to the PR description?

@guettli
Copy link
Collaborator Author

guettli commented Dec 3, 2025

okay understood it now. Can you plz add this information to the PR description?

done. Anything else which is blocking? I would like to merge the PR.

@guettli guettli merged commit 566b4ad into main Dec 3, 2025
8 of 10 checks passed
@guettli guettli deleted the tg/pre--remove-failure-reason--baremetal--on-top-main branch December 3, 2025 12:04
guettli added a commit that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Changes made in the api directory area/code Changes made in the code directory area/hack Changes made in the hack directory size/L Denotes a PR that changes 200-800 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants