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
5 changes: 4 additions & 1 deletion elements/bluefin-server/os-release-flatcar.bst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
kind: manual
description: Create custom Flatcar-compatible os-release metadata to support Flatcar system extensions (sysext).

# %{flatcar-board} — derived from the `arch` option, never hardcoded here.
(@): include/arch.yml

build-depends:
# Needed so the manual-element sandbox provides /bin/sh and coreutils (cat, ln, mkdir, sed).
- freedesktop-sdk.bst:public-stacks/runtime-minimal.bst
Expand Down Expand Up @@ -45,7 +48,7 @@ config:
ANSI_COLOR="0;38;5;208"
HOME_URL="https://github.com/projectbluefin/server"
BUG_REPORT_URL="https://github.com/projectbluefin/server/issues"
FLATCAR_BOARD="amd64-usr"
FLATCAR_BOARD="%{flatcar-board}"
CPE_NAME="cpe:/o:flatcar-linux:flatcar_linux:${FLATCAR_VERSION}"
IMAGE_VERSION=${FSDK_VERSION}
EOF
Expand Down
12 changes: 12 additions & 0 deletions elements/k3s/k3s-bin.bst
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ sources:

config:
install-commands:
- |
# The pinned `sources` entry above is the upstream amd64 asset (its
# SHA256 comes from sha256sum-amd64.txt). Nothing downstream inspects
# the ELF, so under any other `arch` this would silently stage an
# x86-64 binary into a foreign rootfs. Fail closed instead; adding the
# k3s-arm64 source is a deliberate, separate change.
if [ "%{arch}" != "x86_64" ]; then
echo "ERROR: elements/k3s/k3s-bin.bst pins the upstream k3s amd64 binary;" >&2
echo " arch=%{arch} has no pinned source. Add an arch-conditional" >&2
echo " source (k3s-arm64) before building k3s for %{arch}." >&2
exit 1
fi
- install -D -m 0755 k3s "%{install-root}/usr/bin/k3s"
9 changes: 8 additions & 1 deletion elements/oci/k3s-sysext.bst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ description: |
metadata, Bluefin tuning defaults, and a tmpfiles.d entry that seeds
those defaults into /etc/rancher/k3s/config.yaml.d/.

# %{systemd-arch} — the extension-release ARCHITECTURE= value, derived from
# the `arch` option rather than hardcoded in the staged source file.
(@): include/arch.yml

build-depends:
# Core runtime for /bin/sh, coreutils, install, and sha256sum.
- base/base-stack.bst
Expand Down Expand Up @@ -54,8 +58,11 @@ config:
# systemd units (not enabled; provisioning can enable them).
cp -a k3s.service k3s-agent.service sysext/usr/lib/systemd/system/

# Extension identity required by systemd-sysext.
# Extension identity required by systemd-sysext. ARCHITECTURE= is
# generated from the build's `arch` option so it can never disagree
# with the architecture of the k3s binary staged above.
cp -a extension-release.k3s sysext/usr/lib/extension-release.d/
echo "ARCHITECTURE=%{systemd-arch}" >> sysext/usr/lib/extension-release.d/extension-release.k3s

# Tuning defaults shipped in /usr and seeded into /etc via tmpfiles.
cp -a 50-bluefin-tuning.yaml sysext/usr/share/bluefin/k3s/
Expand Down
1 change: 0 additions & 1 deletion files/k3s/sysext/extension-release.k3s
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
NAME=k3s
ID=_any
VERSION_ID=v1.36.2+k3s1
ARCHITECTURE=x86-64
25 changes: 25 additions & 0 deletions include/arch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Single source of truth for CPU-architecture identity strings.
#
# project.conf declares `options.arch` (aarch64, x86_64) and binds it to
# `%{arch}`. Artifacts that have to restate that choice in a vendor-specific
# spelling read it from here instead of hardcoding a literal, so the build
# axis and the identity written into the image cannot drift apart.
#
# %{arch} BuildStream / uname -m x86_64 aarch64
# %{systemd-arch} systemd `ARCHITECTURE=` x86-64 arm64
# %{flatcar-board} Flatcar `FLATCAR_BOARD=` amd64-usr arm64-usr
#
# `options.arch.values` in project.conf constrains the axis to the two
# architectures mapped below, so an unmapped architecture cannot be selected.
#
# Included by:
# elements/oci/k3s-sysext.bst -> %{systemd-arch}
# elements/bluefin-server/os-release-flatcar.bst -> %{flatcar-board}
variables:
(?):
- arch == "x86_64":
systemd-arch: "x86-64"
flatcar-board: "amd64-usr"
- arch == "aarch64":
systemd-arch: "arm64"
flatcar-board: "arm64-usr"