Skip to content

metal3: Link BareMetalHost and Metal3Machine details to each other#902

Open
mastermaxx03 wants to merge 1 commit into
headlamp-k8s:mainfrom
mastermaxx03:metal3-chain
Open

metal3: Link BareMetalHost and Metal3Machine details to each other#902
mastermaxx03 wants to merge 1 commit into
headlamp-k8s:mainfrom
mastermaxx03:metal3-chain

Conversation

@mastermaxx03

@mastermaxx03 mastermaxx03 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the link between a BareMetalHost and its Metal3Machine clickable in the detail views. A host is consumed by a machine, and the machine records which host it claimed, so this lets you click straight from one to the other instead of copying a name and searching for it. First piece of the resource chain.

Included

  • On the BareMetalHost detail, the Consumer field links to its Metal3Machine when the consumer is one; other consumer kinds stay plain text.
  • On the Metal3Machine detail, the BareMetalHost field links to the host it claimed, read from the metal3.io/BareMetalHost annotation.
  • A small parseHostAnnotation helper with unit tests for the "namespace/name" parsing.

How to test

  • A cluster with the Metal3 and CAPM3 CRDs installed, a host with a consumerRef pointing at a Metal3Machine, and that machine carrying the metal3.io/BareMetalHost annotation.
  • cd metal3 && npm install && npm start, then run Headlamp.
  • Open a BareMetalHost that has a consumer, click the Consumer link to reach its Metal3Machine, then click that machine's BareMetalHost link back.

@mastermaxx03

Copy link
Copy Markdown
Contributor Author

@illume @Rozzii

Copilot AI left a comment

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.

Pull request overview

Adds cross-navigation between Metal3 resources in the Headlamp Metal3 plugin so users can quickly jump between a BareMetalHost and the Metal3Machine that consumes/claims it (and vice versa), reducing manual copy/search workflows. This PR also includes the stacked Metal3Machine/Metal3MachineTemplate views and supporting helpers/tests needed for the navigation to be usable end-to-end.

Changes:

  • Link BareMetalHost.spec.consumerRef to the Metal3Machine detail view when the consumer kind is Metal3Machine.
  • Link Metal3Machine detail view back to its claimed BareMetalHost by parsing the metal3.io/BareMetalHost annotation (namespace/name), with unit tests.
  • Add Metal3MachineTemplate list/detail views (including a formatted hostSelector summary + tests), expand Metal3 sidebar/routes, and include sample YAML for local testing.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
metal3/src/BareMetalHost/Details.tsx Makes the Consumer field clickable when it references a Metal3Machine.
metal3/src/Metal3Machine/Details.tsx Adds a BareMetalHost field that links to the claimed host when the annotation parses as namespace/name.
metal3/src/Metal3Machine/hostAnnotation.ts Introduces HOST_ANNOTATION constant and parseHostAnnotation helper used by the detail link logic.
metal3/src/Metal3Machine/hostAnnotation.test.ts Unit tests for parseHostAnnotation parsing/validation behavior.
metal3/src/index.tsx Registers sidebar entries and routes for Metal3Machines and Metal3MachineTemplates; updates baremetalhosts route sidebar key.
metal3/src/Metal3Machine/List.tsx Adds Metal3Machine list view with provisioned/providerID/cluster columns.
metal3/src/Metal3MachineTemplate/List.tsx Adds Metal3MachineTemplate list view including formatted hostSelector and other key columns.
metal3/src/Metal3MachineTemplate/Details.tsx Adds Metal3MachineTemplate detail view with key blueprint fields.
metal3/src/Metal3MachineTemplate/hostSelector.ts Adds formatHostSelector helper for a stable, readable selector summary.
metal3/src/Metal3MachineTemplate/hostSelector.test.ts Unit tests for formatHostSelector.
metal3/test-files/metal3machine.yaml Adds sample Metal3Machine/Metal3MachineTemplate objects demonstrating the host annotation and template fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: mastermaxx03 <srivastavaanimesh22@gmail.com>
@mastermaxx03 mastermaxx03 marked this pull request as ready for review July 14, 2026 17:08
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 this pull request may close these issues.

2 participants