Files
cozystack/packages/core/talos/hack/gen-profiles.sh
Aleksei Sviridkin e002f8d5e5 feat(talos)!: bump Talos to v1.14.2
Talos v1.14.2 ships DRBD 9.3.4 and ZFS 2.4.4. The v1.13 line tops
out at DRBD 9.3.3, which lacks the 9.3.4 fixes for a sender thread
pinning a CPU while its connection is down, for two-phase-commit
retries and hangs that leave drbdadm disconnect stuck, and for two
nodes ending UpToDate with different data after a reconnect.

Talos v1.14 no longer publishes ghcr.io/siderolabs/installer, so the
imager profiles take installer-base as the base installer, which is
also what upstream's own v1.14 imager profiles use.

BREAKING CHANGE: Talos v1.14 no longer loads kernel modules on demand,
so every node must list drbd_transport_tcp in machine.kernel.modules
before it is upgraded, or DRBD cannot connect to its peers.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-30 04:23:38 +03:00

109 lines
3.3 KiB
Bash
Executable File

#!/bin/sh
set -e
set -u
TMPDIR=$(mktemp -d)
PROFILES="initramfs kernel iso installer nocloud metal"
ARCHES="amd64 arm64"
# Every extension below is published for arm64 too, but not every one is
# worth installing there:
# - amd-ucode and intel-ucode are x86 CPU microcode, which an arm64 kernel
# never loads;
# - the arm64 builds of amdgpu and i915 are empty, carrying a manifest and no
# files at all.
# bnx2-bnx2x, intel-ice-firmware and qlogic-firmware are firmware for PCIe
# NICs whose drivers (bnx2, bnx2x, ice, qed) the arm64 Talos kernel builds as
# modules, so arm64 servers with those cards need them as much as x86 ones.
# drbd and zfs are what Cozystack itself needs on every node.
EXTENSIONS_amd64="amd-ucode amdgpu bnx2-bnx2x intel-ice-firmware i915 intel-ucode qlogic-firmware drbd zfs"
EXTENSIONS_arm64="bnx2-bnx2x intel-ice-firmware qlogic-firmware drbd zfs"
mkdir -p images/talos/profiles
printf "fetching talos version: "
talos_version=${1:-$(skopeo --override-os linux --override-arch amd64 list-tags docker://ghcr.io/siderolabs/imager | jq -r '.Tags[]' | grep '^v[0-9]\+.[0-9]\+.[0-9]\+$' | sort -V | tail -n 1)}
echo "$talos_version"
export "TALOS_VERSION=$talos_version"
crane export ghcr.io/siderolabs/extensions:${TALOS_VERSION} | tar x -O image-digests > $TMPDIR/image-digests
for arch in $ARCHES; do
eval "extensions=\$EXTENSIONS_$arch"
# amd64 keeps the unsuffixed names that the Makefile and other tooling
# read the Talos version from.
suffix=""
[ "$arch" = amd64 ] || suffix="-$arch"
system_extensions=""
for extension in $extensions; do
printf "fetching %s version for %s: " "$extension" "$arch"
image=$(grep -F "/$extension:" $TMPDIR/image-digests)
echo "$image"
# Fail here rather than in the imager if upstream drops an arch.
crane manifest "$image" | jq -e --arg arch "$arch" '.manifests | any(.platform.architecture == $arch)' >/dev/null || {
echo "$image has no $arch image" >&2
exit 1
}
system_extensions="$system_extensions
- imageRef: $image"
done
for profile in $PROFILES; do
file="images/talos/profiles/$profile$suffix.yaml"
echo "writing profile $file"
case "$profile" in
initramfs|kernel|iso)
image_options="{}"
out_format="raw"
platform="metal"
kind="$profile"
;;
installer)
image_options="{}"
out_format="raw"
platform="metal"
kind="installer"
;;
metal)
image_options="{ diskSize: 1306525696, diskFormat: raw }"
out_format=".xz"
platform="metal"
kind="image"
;;
nocloud)
image_options="{ diskSize: 1306525696, diskFormat: raw }"
out_format=".xz"
platform="nocloud"
kind="image"
;;
*)
echo "Unknown profile: $profile" >&2
exit 1
;;
esac
cat > "$file" <<EOT
# this file generated by hack/gen-profiles.sh
# do not edit it
arch: ${arch}
platform: ${platform}
secureboot: false
version: ${TALOS_VERSION}
input:
kernel:
path: /usr/install/${arch}/vmlinuz
initramfs:
path: /usr/install/${arch}/initramfs.xz
baseInstaller:
imageRef: "ghcr.io/siderolabs/installer-base:${TALOS_VERSION}"
systemExtensions:${system_extensions}
output:
kind: ${kind}
imageOptions: ${image_options}
outFormat: ${out_format}
EOT
done
done