Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ until oc get baremetalhosts -n openshift-machine-api; do
sleep 20
done

N="0"
while [ "$N" -eq "0" ] ; do
echo "Waiting for control-plane bmh to appear..."
sleep 20
N=$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane --no-headers=true | wc -l)
done
N="{{ .PlatformData.BareMetal.MasterHostCount }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.sh.template files don't get shellcheck run on them. It's better to pass this as an environment variable in the systemd service so that we don't lose linting on shell scripts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a follow-up #8322

echo "Waiting for $N masters to become provisioned"
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
echo "Waiting for $N masters to become provisioned"
Expand Down
9 changes: 9 additions & 0 deletions pkg/asset/ignition/bootstrap/baremetal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type TemplateData struct {
// Hosts is the information needed to create the objects in Ironic.
Hosts []*baremetal.Host

// How many of the Hosts are control plane machines?
MasterHostCount int

// ProvisioningNetwork displays the type of provisioning network being used
ProvisioningNetwork string

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

templateData.Hosts = config.Hosts

for _, host := range config.Hosts {
if host.IsMaster() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the Role optional for the user to provide? I'm not aware that we default it anywhere. See https://github.com/openshift/installer/blob/master/pkg/types/baremetal/validation/platform.go#L305-L318

*installConfig.ControlPlane.Replicas is the canonical source of this information.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a follow-up #8322

templateData.MasterHostCount++
}
}

templateData.ProvisioningIP = config.BootstrapProvisioningIP
templateData.ProvisioningNetwork = string(config.ProvisioningNetwork)
templateData.ExternalStaticIP = config.BootstrapExternalStaticIP
Expand Down