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

Add ability to load OCI with pre-fetch artifacts #1858

Closed
jsturtevant opened this issue Oct 6, 2023 · 2 comments · Fixed by #1874
Closed

Add ability to load OCI with pre-fetch artifacts #1858

jsturtevant opened this issue Oct 6, 2023 · 2 comments · Fixed by #1874

Comments

@jsturtevant
Copy link
Contributor

Background

This issue in runwasi containerd/runwasi#108 and the approach outlined in https://docs.google.com/document/d/11shgC3l6gplBjWF1VJCWvN_9do51otscAm0hBDGSSAc. Also the changes proposed in #1857

Proposed changes

In kubernetes based environment, the OCI artifacts might be already pre-pulled but the OCI client requires pulling them:

pub async fn load_app(&self, client: &mut Client, reference: &str) -> Result<LockedApp> {
// Fetch app
client.pull(reference).await.with_context(|| {
format!("cannot pull Spin application from registry reference {reference:?}")
})?;

It would be nice to have a function similiar to let app = spin_loader::from_file(PathBuf::from("/spin.toml"), Some(working_dir.clone())).await.context("unable to find app file")?;

but for spin.json that OCI artifacts use.

I've prototyped this working with this change used in deislabs/containerd-wasm-shims#164. But there might be better ways to approach it.

@vdice
Copy link
Member

vdice commented Oct 6, 2023

Thanks for creating this @jsturtevant; it shouldn't be a problem to refactor as suggested and provide an additional method for loading an OCI-based Spin app from an already-fetched config (no pull involved).

@itowlson
Copy link
Contributor

itowlson commented Oct 9, 2023

@jsturtevant Looking at your diff I can't imagine any reason we'd do it differently (though I might suggest naming the new function something like load_pulled_app or load_from_cache) - would you like to send a PR, or would you rather we implemented it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants