Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HIP] Hyperfile #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

danbugs
Copy link
Contributor

@danbugs danbugs commented Nov 26, 2024

This PR adds a HIP for Hyperfile—a TOML configuration file for sandbox configuration and run options.

The goal is to enable host applications built with Hyperlight to be configurable in a non-programmatic way, allowing users to modify microVM settings without directly altering the host code.

You can view the rendered file here.

This PR adds a HIP for Hyperfile—a TOML configuration file for sandbox configuration and run options.

The goal is to enable host applications built with Hyperlight to be configurable in a non-programmatic way,
allowing users to modify microVM settings without directly altering the host code.

Signed-off-by: danbugs <[email protected]>
@danbugs danbugs added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 26, 2024
@ludfjig
Copy link
Contributor

ludfjig commented Nov 27, 2024

Let's make sure we put every kv in the toml under a table such as [memory] or [runtimeoptinos] to make it forward compatible in case we need to add more fields. I also think we should avoid the name "override" in the fields. Btw, this is probably a good time as well to introduce a builder to UninitializedSandbox, and maybe even change the UninitializedSandbox::new api to be more ergonomic.

@dblnz
Copy link
Contributor

dblnz commented Nov 28, 2024

There are two aspects that would need clarifying:

  1. How do we treat the case of an older or newer Hyperfile than Hyperlight is being used?
    Example: I am using a Hyperfile that I took from a colleague but it matches a different version of Hyperlight than the one I have. The might not have some fields defined or has additional ones that are no longer valid.
    Should we define some kind of versioning?

  2. Is this meant to accommodate multiple configurations or is it used for setting defaults?
    Example: An user has multiple types of sandboxes, how are their configurations chosen?
    Do we add something like a special section for each type of configuration so that the user can mention which one to use, or do we use the Hyperfile for default values?


## Design Details

### Rough Sketch of a `hyperfile.toml`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered being able to specify multiple different named sandbox configurations in the same file that can be referenced by name when creating the sandboxes?

I can see a use case for wanting to specify different configurations.

This would work similar to how runtime classes work in containerd.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this I imagine one of the entries would be a default one which would be used if no named sandbox configuration is used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just doing this in separate files? config1.toml and config2.toml. It would simplify parsing alot, especially if we use the same struct for the config value itself, AND serde toml deserialization. And then you could do something like Config::FromFile(...) on the one you want to use.

Copy link
Contributor

@devigned devigned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to the proposal. Nice work with the structure and content.

I'm curious to see where @marosset's comment leads. I haven't fully thought through it, but I think I'm in favor a default and additional named configurations.

`hyperfile.toml` to define configurable sandbox settings. This allows end users to adjust
microVM parameters without modifying the host's code, ensuring the integrity of the host
application while providing flexibility to users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you see this as the host's responsibility to specify/resolve where these files are at runtime? We could possibly determine the default for a Sandbox via a well known environment variable , however if the host wanted to provide different types of Sandbox with different configurations for each type it would need to specify how this is done , I don't think that is something that can be done in Hyperlight itself, regardless of if this is done in single files or with named configurations in a single file.

@simongdavies
Copy link
Contributor

We should consider how the config file can be used by solutions built on top of hyperlight, e.g. hyperlight-wasm has its own builder and slightly modified configuration, solutions such as this may want to hide/add/restrict configuration items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants