Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Plan for merge into skopeo #1

Open
cgwalters opened this issue Sep 23, 2021 · 10 comments
Open

Plan for merge into skopeo #1

cgwalters opened this issue Sep 23, 2021 · 10 comments

Comments

@cgwalters
Copy link
Owner

cgwalters commented Sep 23, 2021

I think this project is probably close to suitable to propose for inclusion into github.com/containers/skopeo/

There's stuff that are somewhere between nice-to-have and must-have:

  • API documentation
  • API review for stabilization (use of HTTP/1.1 seems OK, but is there an even simpler option?)
  • done: Sample code in e.g. Python (and/or extract the Rust code from Fetch via container-image-proxy ostreedev/ostree-rs-ext#98 )
  • done: Maybe drop the "run via listening on port" since it's an anti-pattern, even if useful for debugging?

Also: should we think about trying to support writes via this proxy too? It would be a large scope increase and not important for my use cases right now. But it'd be good to avoid ruling it out.

@cgwalters
Copy link
Owner Author

cgwalters commented Sep 24, 2021

Also: should we think about trying to support writes via this proxy too?

OK actually, in practice for testing stuff right now I am exporting the booted host as a container:

$ ostree-ext-cli container export --repo=/sysroot/ostree/repo 7d0941f170264ef62aabf2727bb979ccc958502384178b963d28f7baa6663c93 containers-storage:localhost/fcos

And today in ostree-ext's code that indirects in an inefficient way via an oci: directory.

Sooo....maybe we should support pushes too.

@cgwalters
Copy link
Owner Author

We're having a review session on this now and one thing that came up - if we used not-HTTP and instead e.g. DBus we would have support for file descriptor passing, which could make a lot of sense for this. For example, fetching the manifest could just be passing a sealed memfd, and most importantly fetching blobs could be passing back the read half of a pipe(). That would in turn naturally allow things like concurrent blob fetches.

@cgwalters
Copy link
Owner Author

cgwalters commented Sep 24, 2021

Another thing that came up: we need to double check our validation of blobs - in HTTP it's hard for a server to return an error at the very end of writing data.

Options:

  • The proxy doesn't validate blob checksums, it's on the caller
  • The proxy adds an API like /checkerrors that the caller has to invoke
  • We address this by having the proxy do decompression too - then we need to return a chunked encoding (decompressed length may be unknown) and chunked encoding inherently supports returning errors in e.g. the final chunk. A downside of this though is it's a lot more data to copy over the socket/pipe.
  • Or, we just use not-HTTP for this (per above) which would more naturally support errors

@lucab
Copy link

lucab commented Sep 28, 2021

I guess one key design point is whether the client wants streaming data or bulky blobs. The latter seems overall easier to handle (through sealed memfd and without HTTP, as you mentioned), if it still meets the expected requirements.

@cgwalters
Copy link
Owner Author

cgwalters commented Sep 28, 2021

I guess one key design point is whether the client wants streaming data or bulky blobs.

I am not aware of any case in which a caller cares about byte-by-byte parsing, it's basically "fetch this small JSON blob" or "fetch and streaming parse a large tarball". A model of memfd chunks can be mapped to a byte stream too of course. But probably simplest is pipe().

@cgwalters
Copy link
Owner Author

The more I think about the more it does feel like this should be generalized to an out-of-process containers/image backend - more precisely an out-of-process implementation of Image. Which would mean we support something like: skopeo copy docker://quay.io/coreos/fedora:latest socket://3 or so where we pass fd 3 as a socketpair. A tricky aspect of this then is that everything becomes push rather than pull from the perspective of the caller, and the API becomes more involved. But it's much more rigorous.

@cgwalters
Copy link
Owner Author

xref krustlet/krustlet#564 (comment)
it would also be good to split out the Rust code for interacting with this to a separate crate, as mentioned.

cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 6, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
@cgwalters
Copy link
Owner Author

containers/skopeo#1476

cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 6, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
@cgwalters
Copy link
Owner Author

OK I spent about 2 hours trying to do a DBus interface
https://github.com/cgwalters/container-image-proxy/tree/dbus
and what I ended up hitting is that the Go DBus bindings are simply not prepared to act as a "raw server" in the DBus sense.

It's not trivial to implement.

And then what I realized is that there's the better option for this case I used for https://github.com/coreos/bootupd/blob/main/src/ipc.rs - SOCK_SEQPACKET where we do something super simple like JSON inside.

@mtrmac
Copy link

mtrmac commented Oct 8, 2021

Another thing that came up: we need to double check our validation of blobs - in HTTP it's hard for a server to return an error at the very end of writing data.

FWIW if the consumer cares about digest validation, it seems conceptually simpler for the consumer to do its own validation. Of course Skopeo, or whatever other server, can technically do that validation just as well (and the code has already been written); it just feels simpler to me to say “we rely on digest validation, so here’s the code that always enforces it (and maybe a unit test that clearly demonstrates that)” than relying on cross-repo coordination and integration tests.


An entirely unrelated note: A bit surprisingly, the SHA256 computation is quite noticeable in the total run time, vs. network copies and (memory-cached) disk writes. So if performance is very important for this use, it might be worth comparing the performance of the Go implementation, and the client’s (Rust?) one.

cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 9, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 12, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 12, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 12, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 12, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 12, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 13, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 13, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 13, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 13, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 13, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
cgwalters added a commit to cgwalters/skopeo that referenced this issue Oct 14, 2021
This imports the code from https://github.com/cgwalters/container-image-proxy

First, assume one is operating on a codebase that isn't Go, but wants
to interact with container images - we can't just include the Go containers/image
library.

The primary intended use case of this is for things like
[ostree-containers](ostreedev/ostree-rs-ext#18)
where we're using container images to encapsulate host operating system
updates, but we don't want to involve the [containers/image](github.com/containers/image/)
storage layer.

Vendoring the containers/image stack in another project is a large lift; the stripped
binary for this proxy standalone weighs in at 16M (I'm sure the lack
of LTO and the overall simplicity of the Go compiler is a large factor).
Anyways, I'd like to avoid shipping another copy.

This command is marked as experimental, and hidden.  The goal is
just to use it from the ostree stack for now, ideally shipping at least
in CentOS 9 Stream relatively soon.   We can (and IMO should)
change and improve it later.

A lot more discussion in cgwalters/container-image-proxy#1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants