Skip to content

🌱 re-read hardwareDetails#2096

Open
guettli wants to merge 7 commits into
mainfrom
tg/re-read-hardwareDetails
Open

🌱 re-read hardwareDetails#2096
guettli wants to merge 7 commits into
mainfrom
tg/re-read-hardwareDetails

Conversation

@guettli

@guettli guettli commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Always refresh HardwareDetails in actionRegistering instead of only setting it when nil. This means hardware changes (e.g. NIC replacement → new IP) are picked up automatically on re-registration without manual intervention.

When the refreshed details differ from the previously stored ones, the controller logs a "HardwareDetails changed" message with old and new values.

Fixes #1789

Related: #2095

guettli and others added 2 commits June 11, 2026 13:29
Always refresh HardwareDetails in actionRegistering so hardware changes
(e.g. NIC replacement → new IP) are picked up automatically. Log a
message when the refreshed details differ from the previously stored
ones so the change is visible in the controller logs.

Fixes: #1789

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Committing as: info@thomas-guettler.de
@github-actions github-actions Bot added size/XS Denotes a PR that changes 0-20 lines, ignoring generated files. area/code Changes made in the code directory labels Jun 11, 2026
@janiskemper

Copy link
Copy Markdown
Contributor

can you explain how this fixes the issues?

@guettli

guettli commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

can you explain how this fixes the issues?

Before the HardwareDetails got only set, when they were nil:

if s.scope.HetznerBareMetalHost.Spec.Status.HardwareDetails == nil

Now they get set always. This means, if the HardwareDetails were outdated, they get updated.

@janiskemper

Copy link
Copy Markdown
Contributor

how is that related to the vswitch issue?

@guettli

guettli commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

@janiskemper

how is that related to the vswitch issue?

I suggest to update HardwareDetails to include the vSwitch IP. Otherwise the security check is useless: When we allow the sender to include data to a list, which gets used by the receiver to check the data of the sender, then this is loop. Caph must read the data from somewhere else, not from CSR/Node.

Comment thread pkg/services/baremetal/host/host.go Outdated
return actionError{err: fmt.Errorf("failed to get hardware details: %w", err)}
}
if existing := s.scope.HetznerBareMetalHost.Spec.Status.HardwareDetails; existing != nil && !reflect.DeepEqual(*existing, hardwareDetails) {
s.scope.Info("HardwareDetails changed", "old", existing, "new", hardwareDetails)

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.

use an event here as well, otherwise you wouldn't be able to see this on the object-level

@ashish1099

Copy link
Copy Markdown

we can either query vswitch api to get the details before populating the hardwaredetails (with internal ips) <- I havent did this but I think it should be doable.

or we simply reconcile to whatever node.status.address reports

@guettli

guettli commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

or we simply reconcile to whatever node.status.address reports

@ashish1099

or we simply reconcile to whatever node.status.address reports

The task of the CSR is to check if the node can be trusted. When the node provides the IP list, which CSR will use to validate the node, then we do no need to make this check at all. I am open to discuss if we should drop the IP check completely.

But checking input, which uses a list given by the input, makes no sense. Or I am missing something, then please correct me!

@guettli

guettli commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

we can either query vswitch api to get the details before populating the hardwaredetails (with internal ips) <- I havent did this but I think it should be doable.

@ashish1099 Can you provide a PR?

@github-actions github-actions Bot added size/M Denotes a PR that changes 50-200 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-20 lines, ignoring generated files. labels Jun 12, 2026
janiskemper
janiskemper previously approved these changes Jun 12, 2026
@ashish1099

Copy link
Copy Markdown

we can either query vswitch api to get the details before populating the hardwaredetails (with internal ips) <- I havent did this but I think it should be doable.

@ashish1099 Can you provide a PR?

https://github.com/Obmondo/cluster-api-provider-hetzner/pull/4/changes

I did a quick patch here.

the problem is on hetzner you can only setup the vswitch in the post/prekubeadmin stage and by then hardware details is given already, so we would never get those internal IP (if you are on vswithc)

I was tempted to use the vswitch api query but then appending the node spec just make it easy if there are more IPs

@guettli

guettli commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

we can either query vswitch api to get the details before populating the hardwaredetails (with internal ips) <- I havent did this but I think it should be doable.

@ashish1099 Can you provide a PR?

https://github.com/Obmondo/cluster-api-provider-hetzner/pull/4/changes

I did a quick patch here.

the problem is on hetzner you can only setup the vswitch in the post/prekubeadmin stage and by then hardware details is given already, so we would never get those internal IP (if you are on vswithc)

I was tempted to use the vswitch api query but then appending the node spec just make it easy if there are more IPs

@ashish1099 have you understood why I don't want to read the node object, to validate the node object? If not, please try to undestand that first. Of course, this is easier. But if we would do that, then checking the IP makes no sense.

guettli and others added 2 commits June 26, 2026 15:51
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Committing as: thomas.guettler@syself.com
@ashish1099

Copy link
Copy Markdown

@ashish1099 have you understood why I don't want to read the node object, to validate the node object? If not, please try to undestand that first. Of course, this is easier. But if we would do that, then checking the IP makes no sense.

That make sense, so vswitch api query seems to be a correct way to me

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/M Denotes a PR that changes 50-200 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Always set HetznerBareMetalHost.Spec.Status.HardwareDetails

3 participants