Skip to content

Commit

Permalink
Merge pull request #48 from SoftwareDefinedVehicle/remove-k8s
Browse files Browse the repository at this point in the history
Remove k8s related packages
  • Loading branch information
mikehaller authored Dec 1, 2022
2 parents 47a4057 + c86eb00 commit b6630fb
Show file tree
Hide file tree
Showing 39 changed files with 257 additions and 1,527 deletions.
10 changes: 5 additions & 5 deletions meta-leda-bsp/recipes-bsp/grub/files/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ terminal_input serial
# Default Kernel command line options
CMDLINE="console=ttyS0,115200 rootwait"

# A full-features SDV image including convenient tools
# A full-features SDV image with container runtime and including convenient tools
# Index 0
menuentry "SDV Full (with K8S + developer tools)" {
menuentry "SDV Full (with tools)" {
linux (hd0,gpt4)/boot/bzImage root=/dev/vda4 $CMDLINE rauc.slot=SDV_A
}

# A minimally featured SDV image, only to start k3s and necessary dependencies
# A minimally featured SDV image, only to start containers and necessary dependencies
# Index 1
menuentry "SDV Minimal (with k8s)" {
menuentry "SDV Minimal" {
linux (hd0,gpt5)/boot/bzImage root=/dev/vda5 $CMDLINE rauc.slot=SDV_B
}

# A minimalistic rescue partition, intended for a future "automated rescue" use case
# For now, can be used for manual rescue operations.
# Index 2
menuentry "SDV Rescue (with cloud + self-updater, no K8S)" {
menuentry "SDV Rescue" {
linux (hd0,gpt3)/boot/bzImage root=/dev/vda3 $CMDLINE rauc.slot=SDV_R
}
40 changes: 30 additions & 10 deletions meta-leda-components/classes/sdv-container-cache.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@

# Define defaults, which can be overridden within the recipe
export CONTAINER_ARCH
export SKOPEO_AUTH_PARAMETER

CONTAINER_OS ??= "linux"
CONTAINER_REGISTRY_REQUIRES_AUTH ??= "1"
CONTAINER_REGISTRY_REQUIRES_AUTH ??= "0"
CONTAINER_SKIP_MISSING_ARCH ??= "0"
SDV_DL_FILENAME ??= "${PN}-${PV}-${TARGET_ARCH}-${SDV_IMAGE_TAG}.tar"
SDV_DL_FILE ??= "${DL_DIR}/${SDV_DL_FILENAME}"

K3S_AGENT_PRELOAD_DIR ??= "/var/lib/rancher/k3s/agent/images"
CONTAINERS_TARGET_PATH ??= "/var/containers/images"

# Override this to specify a different location
SKOPEO_AUTH_JSON_FILE ??= "${TOPDIR}/auth.json"
SKOPEO_AUTH_PARAMETER = ""

FALSE = "0"
TRUE = "1"
Expand All @@ -30,6 +35,7 @@ CONTAINER_ARCH[doc] = "Specify the container machine architecture, e.g. amd64, a
CONTAINER_OS[doc] = "Specify the container operatin system, e.g. linux"
CONTAINER_REGISTRY_REQUIRES_AUTH[doc] = "Specify if the container registry requires authentication: 1=true (default) and 0=false"
CONTAINER_SKIP_MISSING_ARCH[doc] = "Set to 1 to ignore errors due to missing container image architecture in remote container registry: 1=skip 0=fail build"
CONTAINERS_TARGET_PATH[doc] = "The location on the rootfs to store container archives"
SDV_DL_FILE[doc] = "Specify how the archive is downloaded"

do_fetch_container[depends] += "skopeo-native:do_populate_sysroot"
Expand All @@ -39,7 +45,7 @@ do_fetch_container[depends] += "jq-native:do_populate_sysroot"
do_compile[noexec] = "1"
do_fetch_container[nostamp] = "1"
do_unpack_container[nostamp] = "1"

do_fetch_container[network] = "1"

contains_tag() {
retvalue="${TRUE}"
Expand Down Expand Up @@ -74,10 +80,24 @@ do_fetch_container() {

if [ ${CONTAINER_REGISTRY_REQUIRES_AUTH} -eq 1 ]
then
if ! PATH=/usr/bin:${PATH} skopeo login --authfile ~/auth.json ${CONTAINER_REGISTRY} ;
if [ -z "${SKOPEO_AUTH_JSON_FILE}" ]
then
bbwarn "Not logged into ${CONTAINER_REGISTRY}, download of container image ${SDV_IMAGE_REF} may fail!"
fi
bbfatal "Auth file for skopeo not set, please set SKOPEO_AUTH_JSON_FILE"
exit 1
else
if [ ! -r "${SKOPEO_AUTH_JSON_FILE}" ]
then
bbfatal "Auth file as set by SKOPEO_AUTH_JSON_FILE not found: ${SKOPEO_AUTH_JSON_FILE}"
exit 2
fi
SKOPEO_AUTH_PARAMETER="--authfile ${SKOPEO_AUTH_JSON_FILE}"
if ! PATH=/usr/bin:${PATH} skopeo login ${SKOPEO_AUTH_PARAMETER} ${CONTAINER_REGISTRY} ;
then
bbwarn "Not logged into ${CONTAINER_REGISTRY}, download of container image ${SDV_IMAGE_REF} may fail!"
fi
fi
else
SKOPEO_AUTH_PARAMETER=""
fi

if [ -z "$CONTAINER_ARCH" ]
Expand Down Expand Up @@ -122,7 +142,7 @@ do_fetch_container() {
--override-arch ${CONTAINER_ARCH} \
--override-os ${CONTAINER_OS} \
copy \
--authfile ~/auth.json \
${SKOPEO_AUTH_PARAMETER} \
--additional-tag ${SDV_IMAGE_REF}:${SDV_IMAGE_TAG} \
docker://${SDV_IMAGE_REF}:${SDV_IMAGE_TAG} \
docker-archive:${SDV_DL_FILE}:${SDV_IMAGE_REF} ;
Expand Down Expand Up @@ -163,13 +183,13 @@ do_unpack_container() {
}

do_install() {
mkdir -p ${D}${K3S_AGENT_PRELOAD_DIR}
cp --no-dereference --preserve=mode,links -v ${S}/${SDV_DL_FILENAME} ${D}${K3S_AGENT_PRELOAD_DIR}/
mkdir -p ${D}${CONTAINERS_TARGET_PATH}
cp --no-dereference --preserve=mode,links -v ${S}/${SDV_DL_FILENAME} ${D}${CONTAINERS_TARGET_PATH}/
}

addtask do_fetch_container before do_unpack_container after do_fetch
addtask do_unpack_container before do_install after do_fetch_container

FILES:${PN} += "${K3S_AGENT_PRELOAD_DIR}/${SDV_DL_FILENAME}"
FILES:${PN} += "${CONTAINERS_TARGET_PATH}/${SDV_DL_FILENAME}"

PACKAGES = "${PN}"

This file was deleted.

Loading

0 comments on commit b6630fb

Please sign in to comment.