Skip to content

Commit 333cb34

Browse files
authored
Merge pull request #107 from Obmondo/fix/kilroy-production-cluster-nvme-nodes-issue
fix(capi-cluster/hetzner/bare-metal): fix boot issue for UEFI based servers, when using Ubuntu 26.04
2 parents b5be947 + 83121f4 commit 333cb34

5 files changed

Lines changed: 43 additions & 75 deletions

File tree

argocd-helm-charts/capi-cluster/charts/hetzner/templates/HetznerBareMetalMachine.yaml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,22 @@ spec:
3535
postInstallScript: |
3636
#!/bin/bash
3737
38-
{{/* Give highest priority to the Network Card / Connection entry in the boot order.
39-
Otherwise, we cannot boot the servers into rescue mode, and need to reach out to the
40-
Hetzner support team. */}}
41-
if [ ! -d /sys/firmware/efi ]; then
42-
echo "legacy BIOS boot — skipping EFI boot-order adjustment"
43-
else
44-
NETBOOT=$(efibootmgr -v \
45-
| grep -E "Network (Card|Connection)" \
46-
| sed 's/Boot\([0-9A-F]*\).*/\1/' \
47-
| head -n1)
48-
if [ -z "$NETBOOT" ]; then
49-
echo "no EFI network boot entry found — skipping boot-order adjustment"
50-
else
51-
CURRENT_ORDER=$(efibootmgr | grep "BootOrder:" | cut -d' ' -f2)
52-
NEW_ORDER=$(echo "$CURRENT_ORDER" | sed "s/$NETBOOT,\?//g" | sed "s/^/$NETBOOT,/" | sed 's/,$//')
53-
efibootmgr -o "$NEW_ORDER"
54-
fi
55-
fi
38+
{{- include "hetzner.efiBootOrderScript" . | nindent 6 }}
5639
5740
mkdir -p /etc/cloud/cloud.cfg.d && touch /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
5841
echo "network: { config: disabled }" > /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
5942
6043
apt-get update && apt-get install -y cloud-init apparmor apparmor-utils
6144
45+
{{/* Hetzner's OS images ship a prebuilt host-only dracut initramfs from
46+
their image-build machine, whose devexists hooks are pinned to THAT
47+
machine's ESP UUID. On UEFI hosts the initramfs then waits ~3min for
48+
a partition that doesn't exist and drops to the dracut emergency
49+
shell — the server looks dead from outside. apt's update-initramfs
50+
run does not replace those hooks; only a forced dracut rebuild
51+
against this host does. */}}
52+
dracut --force --regenerate-all
53+
6254
cloud-init clean --logs
6355
swraid: 1
6456
swraidLevel: {{ ($nodeGroup.raid).level | default 1 }}

argocd-helm-charts/capi-cluster/charts/hetzner/templates/HetznerBareMetalMachineTemplate.yaml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,22 @@ spec:
3838
postInstallScript: |
3939
#!/bin/bash
4040
41-
{{/* Give highest priority to the Network Card / Connection entry in the boot order.
42-
Otherwise, we cannot boot the servers into rescue mode, and need to reach out to the
43-
Hetzner support team. */}}
44-
if [ ! -d /sys/firmware/efi ]; then
45-
echo "legacy BIOS boot — skipping EFI boot-order adjustment"
46-
else
47-
NETBOOT=$(efibootmgr -v \
48-
| grep -E "Network (Card|Connection)" \
49-
| sed 's/Boot\([0-9A-F]*\).*/\1/' \
50-
| head -n1)
51-
if [ -z "$NETBOOT" ]; then
52-
echo "no EFI network boot entry found — skipping boot-order adjustment"
53-
else
54-
CURRENT_ORDER=$(efibootmgr | grep "BootOrder:" | cut -d' ' -f2)
55-
NEW_ORDER=$(echo "$CURRENT_ORDER" | sed "s/$NETBOOT,\?//g" | sed "s/^/$NETBOOT,/" | sed 's/,$//')
56-
efibootmgr -o "$NEW_ORDER"
57-
fi
58-
fi
41+
{{- include "hetzner.efiBootOrderScript" . | nindent 10 }}
5942
6043
mkdir -p /etc/cloud/cloud.cfg.d && touch /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
6144
echo "network: { config: disabled }" > /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
6245
6346
apt-get update && apt-get install -y cloud-init apparmor apparmor-utils
6447
48+
{{/* Hetzner's OS images ship a prebuilt host-only dracut initramfs
49+
from their image-build machine, whose devexists hooks are pinned
50+
to THAT machine's ESP UUID. On UEFI hosts the initramfs then
51+
waits ~3min for a partition that doesn't exist and drops to the
52+
dracut emergency shell — the server looks dead from outside.
53+
apt's update-initramfs run does not replace those hooks; only a
54+
forced dracut rebuild against this host does. */}}
55+
dracut --force --regenerate-all
56+
6557
cloud-init clean --logs
6658
swraid: 1
6759
swraidLevel: {{ (.Values.controlPlane.bareMetal.raid).level | default 1 }}

argocd-helm-charts/capi-cluster/charts/hetzner/templates/KubeadmConfig.yaml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,8 @@ spec:
178178
preKubeadmCommands:
179179
- set -x
180180

181-
{{/* Give highest priority to the Network Card / Connection entry in the boot order.
182-
Otherwise, we cannot boot the servers into rescue mode, and need to reach out to the
183-
Hetzner support team. */}}
184181
- |
185-
if [ ! -d /sys/firmware/efi ]; then
186-
echo "legacy BIOS boot — skipping EFI boot-order adjustment"
187-
else
188-
NETBOOT=$(efibootmgr -v \
189-
| grep -E "Network (Card|Connection)" \
190-
| sed 's/Boot\([0-9A-F]*\).*/\1/' \
191-
| head -n1)
192-
if [ -z "$NETBOOT" ]; then
193-
echo "no EFI network boot entry found — skipping boot-order adjustment"
194-
else
195-
CURRENT_ORDER=$(efibootmgr | grep "BootOrder:" | cut -d' ' -f2)
196-
NEW_ORDER=$(echo "$CURRENT_ORDER" | sed "s/$NETBOOT,\?//g" | sed "s/^/$NETBOOT,/" | sed 's/,$//')
197-
efibootmgr -o "$NEW_ORDER"
198-
fi
199-
fi
182+
{{- include "hetzner.efiBootOrderScript" . | nindent 6 }}
200183
201184
- export NETWORK_INTERFACE=$(ip route get 8.8.8.8 | awk '{print $5; exit}')
202185

argocd-helm-charts/capi-cluster/charts/hetzner/templates/KubeadmControlPlane.yaml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -373,29 +373,9 @@ spec:
373373
- chmod +x /connect-nat-gateway.sh && /connect-nat-gateway.sh
374374
{{- end }}
375375

376-
{{/* Give highest priority to the Network Card / Connection entry in the boot order.
377-
Otherwise, we cannot boot the servers into rescue mode, and need to reach out to the
378-
Hetzner support team. Guarded: legacy-BIOS hosts have no EFI
379-
variables (efibootmgr errors out), and an EFI host without a
380-
network boot entry would otherwise call `efibootmgr -o` with
381-
an empty argument. */}}
382376
{{- if eq .Values.mode "bare-metal" }}
383377
- |
384-
if [ ! -d /sys/firmware/efi ]; then
385-
echo "legacy BIOS boot — skipping EFI boot-order adjustment"
386-
else
387-
NETBOOT=$(efibootmgr -v \
388-
| grep -E "Network (Card|Connection)" \
389-
| sed 's/Boot\([0-9A-F]*\).*/\1/' \
390-
| head -n1)
391-
if [ -z "$NETBOOT" ]; then
392-
echo "no EFI network boot entry found — skipping boot-order adjustment"
393-
else
394-
CURRENT_ORDER=$(efibootmgr | grep "BootOrder:" | cut -d' ' -f2)
395-
NEW_ORDER=$(echo "$CURRENT_ORDER" | sed "s/$NETBOOT,\?//g" | sed "s/^/$NETBOOT,/" | sed 's/,$//')
396-
efibootmgr -o "$NEW_ORDER"
397-
fi
398-
fi
378+
{{- include "hetzner.efiBootOrderScript" . | nindent 8 }}
399379
{{- end }}
400380

401381
{{/*

argocd-helm-charts/capi-cluster/charts/hetzner/templates/_helpers.tpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,24 @@ Output: e.g. `dedicated=gpu:NoSchedule,workload=batch:PreferNoSchedule`
3939
{{- end -}}
4040
{{- join "," $taints -}}
4141
{{- end -}}
42+
43+
{{/* Give highest priority to the Network Card / Connection entry in the boot order.
44+
Otherwise, we cannot boot the servers into rescue mode, and need to reach out to the
45+
Hetzner support team. */}}
46+
{{- define "hetzner.efiBootOrderScript" -}}
47+
if [ ! -d /sys/firmware/efi ]; then
48+
echo "legacy BIOS boot — skipping EFI boot-order adjustment"
49+
else
50+
NETBOOT=$(efibootmgr -v \
51+
| grep -E "Network (Card|Connection|Device)" \
52+
| sed 's/Boot\([0-9A-F]*\).*/\1/' \
53+
| head -n1)
54+
if [ -z "$NETBOOT" ]; then
55+
echo "no EFI network boot entry found — skipping boot-order adjustment"
56+
else
57+
CURRENT_ORDER=$(efibootmgr | grep "BootOrder:" | cut -d' ' -f2)
58+
NEW_ORDER=$(echo "$CURRENT_ORDER" | sed "s/$NETBOOT,\?//g" | sed "s/^/$NETBOOT,/" | sed 's/,$//')
59+
efibootmgr -o "$NEW_ORDER"
60+
fi
61+
fi
62+
{{- end -}}

0 commit comments

Comments
 (0)