Skip to content

Commit 37d5379

Browse files
Merge pull request openshift#8316 from honza/master-count-template
OCPBUGS-32981: baremetal: template the number of master nodes
2 parents 4bbb027 + 81cd894 commit 37d5379

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh renamed to data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh.template

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ until oc get baremetalhosts -n openshift-machine-api; do
1010
sleep 20
1111
done
1212

13-
N="0"
14-
while [ "$N" -eq "0" ] ; do
15-
echo "Waiting for control-plane bmh to appear..."
16-
sleep 20
17-
N=$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane --no-headers=true | wc -l)
18-
done
13+
N="{{ .PlatformData.BareMetal.MasterHostCount }}"
1914
echo "Waiting for $N masters to become provisioned"
2015
while [ "$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane -o json | jq '.items[].status.provisioning.state' | grep provisioned -c)" -lt "$N" ]; do
2116
echo "Waiting for $N masters to become provisioned"

pkg/asset/ignition/bootstrap/baremetal/template.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ type TemplateData struct {
5858
// Hosts is the information needed to create the objects in Ironic.
5959
Hosts []*baremetal.Host
6060

61+
// How many of the Hosts are control plane machines?
62+
MasterHostCount int
63+
6164
// ProvisioningNetwork displays the type of provisioning network being used
6265
ProvisioningNetwork string
6366

@@ -100,6 +103,12 @@ func GetTemplateData(config *baremetal.Platform, networks []types.MachineNetwork
100103

101104
templateData.Hosts = config.Hosts
102105

106+
for _, host := range config.Hosts {
107+
if host.IsMaster() {
108+
templateData.MasterHostCount++
109+
}
110+
}
111+
103112
templateData.ProvisioningIP = config.BootstrapProvisioningIP
104113
templateData.ProvisioningNetwork = string(config.ProvisioningNetwork)
105114
templateData.ExternalStaticIP = config.BootstrapExternalStaticIP

0 commit comments

Comments
 (0)