This repo houses the code for the demo we will be presenting during our keynote at KubeCon NA 2024.
.
├── Cargo.lock
├── Cargo.toml
├── README.md
├── demo-guest
├── demo-main
├── puml
└── target
demo-guest:x86_64-hyperlight-nonenative Hyperlight guest application (built separately withcargo hyperlight).demo-main: HTTP server using Hyperlight's host SDK.
Hyperlight executes arbitrary code safely and quickly. It does that by booting up an OS-less VM that executes functions.
demo-guestexports two guest functions:PrintOutput, andDereferenceRawNullPointer.
Note: OS-less VMs cannot make any syscalls, so we escape the VM to make host function calls to, say, print to standard output.
- Rust 1.89+ (pinned via
rust-toolchain.toml) cargo-hyperlight: install withcargo install cargo-hyperlight
# 1. Build the guest binary
cd demo-guest
cargo hyperlight build --release
cd ..
# 2. Copy the guest binary where demo-main expects it
cp demo-guest/target/x86_64-hyperlight-none/release/demo-guest demo-main/demo-guest-release
# 3. Run the host
cd demo-main
cargo run --releaseTo spawn a Hyperlight VM and attach a debugger to it, you:
- Start a devcontainer
- Build the guest in debug mode and copy the binary:
cd demo-guest
cargo hyperlight build
cp target/x86_64-hyperlight-none/debug/demo-guest ../demo-main/demo-guest-debug
cd ..- Run the demo with the
gdbfeature:
cd demo-main
cargo run --features gdb- Open a separate terminal and send an HTTP request to the demo server to spawn a cold Hyperlight VM:
curl http://localhost:3030/hyperlight/hello-world/cold
- Attach a debugger to the spawned VM by using one of the
Run and Debugconfigurations in your VSCode editor:
Remote LLDB attachRemote GDB attach
- Enjoy debugging!