Skip to content

Commit be63c92

Browse files
Merge pull request #9987 from honza/bmh-arch
OCPBUGS-62125: baremetal: set baremetalhost architecture
2 parents d20bf6a + 9688776 commit be63c92

File tree

2 files changed

+440
-58
lines changed

2 files changed

+440
-58
lines changed

pkg/asset/machines/baremetal/hosts.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package baremetal
33
import (
44
"fmt"
55

6+
"github.com/coreos/stream-metadata-go/arch"
67
baremetalhost "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
78
hardware "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1/profile"
89
"github.com/pkg/errors"
@@ -121,6 +122,17 @@ func Hosts(config *types.InstallConfig, machines []machineapi.Machine, userDataS
121122

122123
numRequiredMasters := len(machines)
123124
numMasters := 0
125+
126+
controlPlaneArch := ""
127+
if config.ControlPlane != nil {
128+
controlPlaneArch = arch.RpmArch(string(config.ControlPlane.Architecture))
129+
}
130+
computeArch := ""
131+
132+
if len(config.Compute) > 0 {
133+
computeArch = arch.RpmArch(string(config.Compute[0].Architecture))
134+
}
135+
124136
for _, host := range config.Platform.BareMetal.Hosts {
125137

126138
// We only infer arbiter hosts if we are in an arbiter deployment
@@ -177,11 +189,13 @@ func Hosts(config *types.InstallConfig, machines []machineapi.Machine, userDataS
177189
Name: machine.ObjectMeta.Name,
178190
}
179191
newHost.Spec.Online = true
192+
newHost.Spec.Architecture = controlPlaneArch
180193

181194
// userDataSecret carries a reference to the master ignition file
182195
newHost.Spec.UserData = &corev1.SecretReference{Name: userDataSecret}
183196
numMasters++
184197
} else {
198+
newHost.Spec.Architecture = computeArch
185199
// Pause workers until the real control plane is up.
186200
newHost.ObjectMeta.Annotations = map[string]string{
187201
"baremetalhost.metal3.io/paused": "",
@@ -213,6 +227,12 @@ func ArbiterHosts(config *types.InstallConfig, machines []machineapi.Machine, us
213227

214228
numRequiredArbiters := len(machines)
215229
numArbiters := 0
230+
231+
arbiterArch := ""
232+
if config.Arbiter != nil {
233+
arbiterArch = arch.RpmArch(string(config.Arbiter.Architecture))
234+
}
235+
216236
for _, host := range config.Platform.BareMetal.Hosts {
217237
// We make sure to keep an accurate count of known masters when explicitly set
218238
if host.IsMaster() {
@@ -270,6 +290,7 @@ func ArbiterHosts(config *types.InstallConfig, machines []machineapi.Machine, us
270290
Name: machine.ObjectMeta.Name,
271291
}
272292
newHost.Spec.Online = true
293+
newHost.Spec.Architecture = arbiterArch
273294

274295
// userDataSecret carries a reference to the arbiter ignition file
275296
newHost.Spec.UserData = &corev1.SecretReference{Name: userDataSecret}

0 commit comments

Comments
 (0)