Skip to content

Commit 0ff1d63

Browse files
Make Hook the default OSIE:
With the recent update in Hook to publish the kernel and initrd we can make make hook the default in the sandbox. Original OSIE can still be used by updating deploy/compose/.env and setting OSIE_DOWNLOAD_URL to an OSIE URL and TINKERBELL_USE_HOOK to false. Currently only an x86_64 Hook is published so only x86_64 machines can be provisioned with the sandbox using Hook. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent 6ea787f commit 0ff1d63

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

deploy/compose/.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-1790-23d78ea47f794d0e5c934b604579c26e5fce97f5.tar.gz"
1+
#OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-1790-23d78ea47f794d0e5c934b604579c26e5fce97f5.tar.gz"
2+
OSIE_DOWNLOAD_URL="https://github.com/tinkerbell/hook/releases/download/5.10.57/hook-x86_64.tar.gz"
3+
TINKERBELL_USE_HOOK="true"
24
TINK_CLI_IMAGE="quay.io/tinkerbell/tink-cli:sha-8ea8a0e5"
35
TINK_SERVER_IMAGE="quay.io/tinkerbell/tink:sha-8ea8a0e5"
46
BOOTS_SERVER_IMAGE="quay.io/tinkerbell/boots:sha-94f43947"

deploy/compose/docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ services:
2929
osie-work:
3030
image: alpine
3131
entrypoint: /scripts/lastmile.sh
32-
command: ["${OSIE_DOWNLOAD_URL}", "/source", "/source", "/destination"]
32+
command:
33+
[
34+
"${OSIE_DOWNLOAD_URL}",
35+
"/source",
36+
"/source",
37+
"/destination",
38+
"${TINKERBELL_USE_HOOK}",
39+
]
3340
volumes:
3441
- ${REPO_TOP_LEVEL:-.}/osie:/scripts
3542
- ${REPO_TOP_LEVEL:-.}/state/webroot/misc/osie/current:/source

deploy/compose/osie/lastmile.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,50 @@ osie_move_helper_scripts() {
2424
cp "${source_dir}"/workflow-helper.sh "${source_dir}"/workflow-helper-rc "${dest_dir}"/
2525
}
2626

27+
# hook_rename_files renames the kernel and initrd files from the github downloaded tar
28+
# to the default names that the OSIE installer in Boots is expecting.
29+
# See https://github.com/tinkerbell/boots/blob/78d4f74e6944ae3bd04e1297dc8e354fc93d9320/installers/osie/main.go#L160 and
30+
# https://github.com/tinkerbell/boots/blob/78d4f74e6944ae3bd04e1297dc8e354fc93d9320/installers/osie/main.go#L168
31+
hook_rename_files() {
32+
local src_kernel="$1"
33+
local src_initrd="$2"
34+
local dest_dir="$3"
35+
mv "${src_kernel}" "${dest_dir}/vmlinuz-x86_64"
36+
mv "${src_initrd}" "${dest_dir}/initramfs-x86_64"
37+
}
38+
2739
# main runs the functions in order to download, extract, and move helper scripts
2840
main() {
2941
local url="$1"
3042
local extract_dir="$2"
3143
local source_dir="$3"
3244
local dest_dir="$4"
45+
local use_hook="$5"
3346

3447
if [ ! -f "${extract_dir}"/osie.tar.gz ]; then
3548
echo "downloading osie..."
3649
osie_download "${url}" "${extract_dir}"
3750
else
3851
echo "osie already downloaded"
3952
fi
40-
if [ ! -f "${source_dir}"/workflow-helper.sh ] && [ ! -f "${source_dir}"/workflow-helper-rc ]; then
41-
echo "extracting osie..."
42-
osie_extract "${extract_dir}" "${source_dir}"
53+
54+
if [ "${use_hook}" == "true" ]; then
55+
if [ ! -f "${source_dir}"/hook-x86_64-kernel ] && [ ! -f "${source_dir}"/hook-x86_64-initrd.img ]; then
56+
echo "extracting hook..."
57+
osie_extract "${extract_dir}" "${source_dir}"
58+
else
59+
echo "hook files already exist, not extracting"
60+
fi
61+
hook_rename_files "${source_dir}"/hook-x86_64-kernel "${source_dir}"/hook-x86_64-initrd.img "${source_dir}"
4362
else
44-
echo "osie files already exist, not extracting"
63+
if [ ! -f "${source_dir}"/workflow-helper.sh ] && [ ! -f "${source_dir}"/workflow-helper-rc ]; then
64+
echo "extracting osie..."
65+
osie_extract "${extract_dir}" "${source_dir}"
66+
else
67+
echo "osie files already exist, not extracting"
68+
fi
69+
osie_move_helper_scripts "${source_dir}" "${dest_dir}"
4570
fi
46-
osie_move_helper_scripts "${source_dir}" "${dest_dir}"
4771
}
4872

49-
main "$1" "$2" "$3" "$4"
73+
main "$1" "$2" "$3" "$4" "$5"

deploy/compose/registry/registry_images.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:latest
2+
quay.io/tinkerbell/tink-worker:latest tink-worker:latest
23
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:sha-5e1f0fd8
34
quay.io/tinkerbell-actions/image2disk:v1.0.0 image2disk:v1.0.0
45
quay.io/tinkerbell-actions/cexec:v1.0.0 cexec:v1.0.0

0 commit comments

Comments
 (0)