Skip to content

Commit 0c840bf

Browse files
committed
feat: Added metal3 BMH selection tip
Also included the metal3 tips and tricks section that was missing
1 parent d6df339 commit 0c840bf

File tree

3 files changed

+109
-2
lines changed

3 files changed

+109
-2
lines changed

asciidoc/edge-book/edge.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Tips and tricks for Edge components
135135
136136
include::../tips/eib.adoc[leveloffset=+1]
137137
include::../tips/elemental.adoc[leveloffset=+1]
138-
138+
include::../tips/metal3.adoc[leveloffset=+1]
139139
140140
//--------------------------------------------
141141
// Third-Party Integration

asciidoc/edge-book/versions.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
:version-sriov-network-operator-chart: 304.0.2+up1.5.0
9898
:version-sriov-upstream: 1.5.0
9999

100+
// capi-provider-metal3
101+
// edu, Oct 9, 2025 :: Used to link the CRDs on the docs site like
102+
// https://doc.crds.dev/github.com/metal3-io/cluster-api-provider-metal3/infrastructure.cluster.x-k8s.io/Metal3MachineTemplate/[email protected]#spec-template-spec-hostSelector-matchLabels
103+
:version-capi-provider-metal3: [email protected]
100104

101105
// ============================================================================
102106
// Manual Version Entries

asciidoc/tips/metal3.adoc

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1+
[#tips-metal3]
12
= *Metal^3^*
3+
:revdate: 2025-10-07
4+
:page-revdate: {revdate}
5+
:experimental:
6+
7+
ifdef::env-github[]
8+
:imagesdir: ../images/
9+
:tip-caption: :bulb:
10+
:note-caption: :information_source:
11+
:important-caption: :heavy_exclamation_mark:
12+
:caution-caption: :fire:
13+
:warning-caption: :warning:
14+
endif::[]
15+
16+
:imagesdir: ../images/
17+
18+
== Ironic
19+
20+
=== Predictable network names
221

3-
.Ironic:
422
Due to a link:../components/metal3.adoci#L31[known issue], if you are trying to configure predictable names for the target OS network devices and you end up in errors, seeing that the discovered device names have different naming pattern, then you have a couple of options:
523

624
_Option 1:_ Use two network configuration secrets, one for the inspection/provisioning phase and another for the deployed OS.
@@ -102,3 +120,88 @@ now in the output files you should have the UUIDs that you can use in your confi
102120
3. Alternatively, if you don't use OpenSUSE or SLES, you can use the nmc through the Edge Image Builder container image:
103121
`podman run -it --rm -v $(pwd):/path/to/your/config:Z --entrypoint=/usr/bin/nmc registry.suse.com/edge/{version-edge-registry}/edge-image-builder:{version-eib} generate --confi
104122
g-dir /path/to/your/config --output-dir /where/you/want/it`
123+
124+
== `BareMetalHost` selection and Cluster association
125+
126+
Once a Metalˆ3ˆ cluster object and its corresponding associated objects are created, a process to choose which `BareMetalHost` will be part of
127+
the cluster is performed.
128+
This process connects a `BareMetalHost` with a specific `Metal3MachineTemplate` using standard
129+
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/[Kubernetes labels] and selectors.
130+
131+
As an example, each `BareMetalHost` is labeled to identify its properties and intended cluster
132+
(e.g., its cluster-role, the cluster name, location, etc.):
133+
134+
----
135+
apiVersion: metal3.io/v1alpha1
136+
kind: BareMetalHost
137+
metadata:
138+
name: mynode1
139+
labels:
140+
cluster-role: control-plane
141+
cluster: foobar
142+
location: madrid
143+
datacenter: xyz
144+
<snip>
145+
---
146+
apiVersion: metal3.io/v1alpha1
147+
kind: BareMetalHost
148+
metadata:
149+
name: mynode2
150+
labels:
151+
cluster-role: worker
152+
cluster: foobar
153+
location: madrid
154+
datacenter: xyz
155+
<snip>
156+
---
157+
apiVersion: metal3.io/v1alpha1
158+
kind: BareMetalHost
159+
metadata:
160+
name: mynode3
161+
labels:
162+
cluster-role: worker
163+
cluster: foobar2
164+
location: madrid
165+
datacenter: xyz
166+
<snip>
167+
...
168+
----
169+
170+
Then, the `Metal3MachineTemplate` object uses the https://doc.crds.dev/github.com/metal3-io/cluster-api-provider-metal3/infrastructure.cluster.x-k8s.io/Metal3MachineTemplate/{version-capi-provider-metal3}#spec-template-spec-hostSelector[`spec.hostSelector`] field to match the desired `BareMetalHost`.
171+
172+
Both https://doc.crds.dev/github.com/metal3-io/cluster-api-provider-metal3/infrastructure.cluster.x-k8s.io/Metal3MachineTemplate/{version-capi-provider-metal3}#spec-template-spec-hostSelector-matchLabels[`matchLabels`] (for exact key-value matching) and https://doc.crds.dev/github.com/metal3-io/cluster-api-provider-metal3/infrastructure.cluster.x-k8s.io/Metal3MachineTemplate/{version-capi-provider-metal3}#spec-template-spec-hostSelector-matchExpressions[`matchExpressions`] (for more complex rules) can be used:
173+
174+
----
175+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
176+
kind: Metal3MachineTemplate
177+
metadata:
178+
name: foobar-cluster-controlplane
179+
namespace: mynamespace
180+
spec:
181+
template:
182+
spec:
183+
hostSelector:
184+
matchLabels:
185+
cluster-role: control-plane
186+
cluster: foobar
187+
<snip>
188+
---
189+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
190+
kind: Metal3MachineTemplate
191+
metadata:
192+
name: foobar-cluster-worker
193+
namespace: mynamespace
194+
spec:
195+
template:
196+
spec:
197+
hostSelector:
198+
matchExpressions:
199+
- { key: cluster-role, operator: In, values: [worker] }
200+
- { key: cluster, operator: In, values: [foobar] }
201+
<snip>
202+
----
203+
204+
[NOTE]
205+
====
206+
Kubernetes namespaces can be also used to better organize the different objects.
207+
====

0 commit comments

Comments
 (0)