Skip to content

Conversation

@jsturtevant
Copy link
Contributor

This PR makes a few changes to the the RuntimeContext API regarding OCI:

@jsturtevant
Copy link
Contributor Author

The wasmedge error looks like something with k3s, going to re-trigger

NAMESPACE     NAME                                     READY   STATUS              RESTARTS   AGE
kube-system   metrics-server-648b5df564-vfq4j          0/1     Running             0          8s
kube-system   coredns-77ccd57875-zcdxr                 1/1     Running             0          8s
kube-system   local-path-provisioner-957fdf8bc-qdlnl   1/1     Running             0          8s
kube-system   helm-install-traefik-crd-rtw9s           0/1     Completed           0          8s
kube-system   helm-install-traefik-tsb9m               0/1     Error               0          8s
default       wasi-demo-79d9475fd-5bnwj                0/2     ContainerCreating   0          0s
default       wasi-demo-79d9475fd-6tvpx                0/2     ContainerCreating   0          0s
default       wasi-demo-79d9475fd-xl4xf                0/2     ContainerCreating   0          0s

Signed-off-by: James Sturtevant <jstur@microsoft.com>
Mossaka
Mossaka previously approved these changes Nov 16, 2023
Copy link
Collaborator

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! :-)

I'm not sure how I feel about WasiLoadingStrategy. I personally would make it part of the entrypoint.

Something like:

pub struct Entrypoint<'a> {
    // The entrypoint function in the wasm module.
    // Usualy "_start".
    pub func: String,

    // A name that can be used to identify the module.
    // Usualy the name of the wasm file.
    pub name: Option<String>,

    // The raw arg0 provived in the OCI spec.
    pub arg0: Option<&'a Path>,

    // The source for the WASI module / components
    pub srouce: WasiSource<'a>,
}

// The source for a WASI module / components.
pub enum WasiSource<'a> {
    // The WASI module is a file in the file system.
    // This case is only valid with WASI preview1 modules.
    File(PathBuf),

    // The WASI module / component is provided in the OCI spec.
    // For a WASI preview 1 module this is usually a single element array.
    // For a WASI preview 2 component this is an array of one or more
    // elements, where each element is a component.
    // Runtimes can additionally provide a list of layer types they support,
    // and they will be included in this array, e.g., a `toml` file with the
    // runtime configuration.
    Oci(&'a [WasmLayer]),    
}

@jsturtevant
Copy link
Contributor Author

I'm not sure how I feel about WasiLoadingStrategy. I personally would make it part of the entrypoint.

nice! I was struggling with the entrypoint vs loading strategy but hadn't figured it out yet. They shared similar data and logic, I believe your suggestion resolves the dissonance I was feeling. Will give this a go

Signed-off-by: James Sturtevant <jstur@microsoft.com>
@jsturtevant jsturtevant changed the title Use OCI loading strategy Consolidate the RuntimeContext API to use one EntryPoint and expose Source for WASI files Nov 17, 2023
Copy link
Collaborator

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks @jsturtevant !
Just two minor nits, and I'm happy for this to be merged :-)

Signed-off-by: James Sturtevant <jstur@microsoft.com>
Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm!

@Mossaka Mossaka merged commit 3550a2d into containerd:main Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants