Add instance resource allocation example#424
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Unikraft Cloud example that demonstrates explicit per-instance resource allocation (memory and vCPUs) using both the kraft CLI and direct Platform API calls.
Changes:
- Introduces a new example directory with a Python HTTP server, container packaging, and a Kraftfile for deployment.
- Documents end-to-end workflows (deploy/create/start/query/logs/stop/delete) for both CLI and API usage.
- Adds a small client-side validation script plus templated configuration files.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| instance-resource-allocation-roxana/README.md | Documentation and command walkthroughs for CLI + API resource allocation workflows |
| instance-resource-allocation-roxana/Dockerfile | Builds a minimal Python image running the demo HTTP server |
| instance-resource-allocation-roxana/Kraftfile | Unikraft Cloud packaging/runtime configuration for the example |
| instance-resource-allocation-roxana/server.py | Simple HTTP server used as the deployed workload |
| instance-resource-allocation-roxana/test_resources.py | Client script to verify the deployed instance responds as expected |
| instance-resource-allocation-roxana/ukc.config.template | Template for required Unikraft Cloud environment variables |
| instance-resource-allocation-roxana/app.config | Centralized example naming + default resource settings for API scripts |
| instance-resource-allocation-roxana/.gitignore | Prevents committing local ukc.config credentials |
| instance-resource-allocation-roxana/api/pkg-image.sh | Packages the image for Unikraft Cloud (CLI-based) |
| instance-resource-allocation-roxana/api/push-image.sh | Pushes the packaged image to the registry (CLI-based) |
| instance-resource-allocation-roxana/api/list-images.sh | Lists images via Platform API |
| instance-resource-allocation-roxana/api/create-instance.sh | Creates an instance via Platform API with explicit memory_mb/vcpus |
| instance-resource-allocation-roxana/api/start-instance.sh | Starts an instance via Platform API |
| instance-resource-allocation-roxana/api/stop-instance.sh | Stops an instance via Platform API |
| instance-resource-allocation-roxana/api/list-instances.sh | Lists instances via Platform API |
| instance-resource-allocation-roxana/api/get-instance-info.sh | Retrieves instance info via Platform API |
| instance-resource-allocation-roxana/api/query.sh | Queries the instance endpoint using the fqdn derived from API output |
| instance-resource-allocation-roxana/api/get-instance-logs.sh | Retrieves logs via Platform API and decodes output |
| instance-resource-allocation-roxana/api/delete-instance.sh | Deletes an instance via Platform API |
Comments suppressed due to low confidence (2)
instance-resource-allocation-roxana/api/start-instance.sh:15
- This script pipes
curloutput directly intojqwithout preservingcurl's stderr/exit status. Other examples in this repo capturecurloutput toout/errand only runjqon success (e.g.basic-ops/api/start-instance.sh). Without that, failures are harder to diagnose and can surface as confusingjqparse errors.
"${UKC_API}/instances/start" \
-d "{
'name': '${INSTANCE_NAME}'
}" | jq
instance-resource-allocation-roxana/api/stop-instance.sh:15
- This script pipes
curloutput directly intojqwithout preservingcurl's stderr/exit status. Other examples in this repo capturecurloutput toout/errand only runjqon success (e.g.basic-ops/api/stop-instance.sh). Without that, failures are harder to diagnose and can surface as confusingjqparse errors.
"${UKC_API}/instances/stop" \
-d "{
'name': '${INSTANCE_NAME}'
}" | jq
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
stancu-anamaria
left a comment
There was a problem hiding this comment.
I reviewed the implementation and followed the README. The instructions are clear, and the commands worked as expected. I didn't find any issues
Dan-Andrei-Simionescu
left a comment
There was a problem hiding this comment.
The scripts and commands work just fine, also, the README is written nicely.
Summary
This PR adds a new Unikraft Cloud example for Instance Resource Allocation.
The example documents how to configure memory and virtual CPU allocation for instances running on Unikraft Cloud, both through the
kraftCLI and through the Unikraft Cloud Platform API.Current contents
instance-resource-allocationexampleDockerfile,Kraftfile,server.py,test_resources.py, ukc.config.template)Scope of the example
The example is intended to cover:
-M/--memory-V/--vcpusStatus
Ready for review.