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 <jakobweinstock@gmail.com>
This commit is contained in:
Jacob Weinstock 2021-08-12 16:40:41 -06:00
parent 6ea787f947
commit 0ff1d633cd
4 changed files with 42 additions and 8 deletions

View File

@ -1,4 +1,6 @@
OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-1790-23d78ea47f794d0e5c934b604579c26e5fce97f5.tar.gz" #OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-1790-23d78ea47f794d0e5c934b604579c26e5fce97f5.tar.gz"
OSIE_DOWNLOAD_URL="https://github.com/tinkerbell/hook/releases/download/5.10.57/hook-x86_64.tar.gz"
TINKERBELL_USE_HOOK="true"
TINK_CLI_IMAGE="quay.io/tinkerbell/tink-cli:sha-8ea8a0e5" TINK_CLI_IMAGE="quay.io/tinkerbell/tink-cli:sha-8ea8a0e5"
TINK_SERVER_IMAGE="quay.io/tinkerbell/tink:sha-8ea8a0e5" TINK_SERVER_IMAGE="quay.io/tinkerbell/tink:sha-8ea8a0e5"
BOOTS_SERVER_IMAGE="quay.io/tinkerbell/boots:sha-94f43947" BOOTS_SERVER_IMAGE="quay.io/tinkerbell/boots:sha-94f43947"

View File

@ -29,7 +29,14 @@ services:
osie-work: osie-work:
image: alpine image: alpine
entrypoint: /scripts/lastmile.sh entrypoint: /scripts/lastmile.sh
command: ["${OSIE_DOWNLOAD_URL}", "/source", "/source", "/destination"] command:
[
"${OSIE_DOWNLOAD_URL}",
"/source",
"/source",
"/destination",
"${TINKERBELL_USE_HOOK}",
]
volumes: volumes:
- ${REPO_TOP_LEVEL:-.}/osie:/scripts - ${REPO_TOP_LEVEL:-.}/osie:/scripts
- ${REPO_TOP_LEVEL:-.}/state/webroot/misc/osie/current:/source - ${REPO_TOP_LEVEL:-.}/state/webroot/misc/osie/current:/source

View File

@ -24,12 +24,25 @@ osie_move_helper_scripts() {
cp "${source_dir}"/workflow-helper.sh "${source_dir}"/workflow-helper-rc "${dest_dir}"/ cp "${source_dir}"/workflow-helper.sh "${source_dir}"/workflow-helper-rc "${dest_dir}"/
} }
# hook_rename_files renames the kernel and initrd files from the github downloaded tar
# to the default names that the OSIE installer in Boots is expecting.
# See https://github.com/tinkerbell/boots/blob/78d4f74e6944ae3bd04e1297dc8e354fc93d9320/installers/osie/main.go#L160 and
# https://github.com/tinkerbell/boots/blob/78d4f74e6944ae3bd04e1297dc8e354fc93d9320/installers/osie/main.go#L168
hook_rename_files() {
local src_kernel="$1"
local src_initrd="$2"
local dest_dir="$3"
mv "${src_kernel}" "${dest_dir}/vmlinuz-x86_64"
mv "${src_initrd}" "${dest_dir}/initramfs-x86_64"
}
# main runs the functions in order to download, extract, and move helper scripts # main runs the functions in order to download, extract, and move helper scripts
main() { main() {
local url="$1" local url="$1"
local extract_dir="$2" local extract_dir="$2"
local source_dir="$3" local source_dir="$3"
local dest_dir="$4" local dest_dir="$4"
local use_hook="$5"
if [ ! -f "${extract_dir}"/osie.tar.gz ]; then if [ ! -f "${extract_dir}"/osie.tar.gz ]; then
echo "downloading osie..." echo "downloading osie..."
@ -37,13 +50,24 @@ main() {
else else
echo "osie already downloaded" echo "osie already downloaded"
fi fi
if [ ! -f "${source_dir}"/workflow-helper.sh ] && [ ! -f "${source_dir}"/workflow-helper-rc ]; then
echo "extracting osie..." if [ "${use_hook}" == "true" ]; then
osie_extract "${extract_dir}" "${source_dir}" if [ ! -f "${source_dir}"/hook-x86_64-kernel ] && [ ! -f "${source_dir}"/hook-x86_64-initrd.img ]; then
echo "extracting hook..."
osie_extract "${extract_dir}" "${source_dir}"
else
echo "hook files already exist, not extracting"
fi
hook_rename_files "${source_dir}"/hook-x86_64-kernel "${source_dir}"/hook-x86_64-initrd.img "${source_dir}"
else else
echo "osie files already exist, not extracting" if [ ! -f "${source_dir}"/workflow-helper.sh ] && [ ! -f "${source_dir}"/workflow-helper-rc ]; then
echo "extracting osie..."
osie_extract "${extract_dir}" "${source_dir}"
else
echo "osie files already exist, not extracting"
fi
osie_move_helper_scripts "${source_dir}" "${dest_dir}"
fi fi
osie_move_helper_scripts "${source_dir}" "${dest_dir}"
} }
main "$1" "$2" "$3" "$4" main "$1" "$2" "$3" "$4" "$5"

View File

@ -1,4 +1,5 @@
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:latest quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:latest
quay.io/tinkerbell/tink-worker:latest tink-worker:latest
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:sha-5e1f0fd8 quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:sha-5e1f0fd8
quay.io/tinkerbell-actions/image2disk:v1.0.0 image2disk:v1.0.0 quay.io/tinkerbell-actions/image2disk:v1.0.0 image2disk:v1.0.0
quay.io/tinkerbell-actions/cexec:v1.0.0 cexec:v1.0.0 quay.io/tinkerbell-actions/cexec:v1.0.0 cexec:v1.0.0