Skip to content

Commit

Permalink
Add support for other podman runtimes
Browse files Browse the repository at this point in the history
While the podman runtime is still enforced, the script now supports
several other runtimes. The KRUNVM_RUNNER_RUNTIME variable should
contain the word podman, followed by the plus sign, followed by the
runtime to use, e.g. podman+krun will pass the value of krun to the
--runtime option of podman create/run.
  • Loading branch information
efrecon committed Apr 6, 2024
1 parent 7ce876f commit 5c6c4f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/microvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ run_krunvm() {
buildah unshare krunvm "$@"
}

_podman_runtime() {
_runtime=${KRUNVM_RUNNER_RUNTIME#podman+}
[ -z "$_runtime" ] && _runtime="krun"
printf %s\\n "$_runtime"
}


# Automatically select a microVM runtime based on the available commands. Set
# the KRUNVM_RUNNER_RUNTIME variable.
Expand Down Expand Up @@ -48,7 +54,7 @@ microvm_runtime() {
case "$KRUNVM_RUNNER_RUNTIME" in
podman*)
check_command podman
check_command krun
check_command "$(_podman_runtime)"
;;
krunvm)
check_command krunvm
Expand Down Expand Up @@ -143,7 +149,7 @@ microvm_run() {
case "$KRUNVM_RUNNER_RUNTIME" in
podman*)
set -- \
--runtime "krun" \
--runtime "$(_podman_runtime)" \
--rm \
--tty \
--name "$KRUNVM_RUNNER_NAME" \
Expand Down

0 comments on commit 5c6c4f9

Please sign in to comment.