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

proxy: Add GetConfig, add manifest list support, add an integration test #1495

Merged
merged 10 commits into from
Nov 16, 2021

Conversation

cgwalters
Copy link
Contributor

proxy: Add an API to fetch the config upconverted to OCI

While the caller could fetch this today as a blob, it'd be in
either docker or oci schema. In keeping with the model of having
this proxy only expose OCI, add an API which uses the c/image logic
to do the conversion.

This is necessary for callers to get the diffIDs, and in general
to implement something like an external skopeo copy.


proxy: Add a helper to return a byte array

Since this is shared between the manifest and config paths.


proxy: Use float → int helper for pipeid

Just noticed while scrolling past the code.


tests/integration/proxy_test: New test that exercises proxy.go

I debated adding "reverse dependency testing" using
https://crates.io/crates/containers-image-proxy
but I think it's easier to reuse the test infrastructure here.

This also starts fleshing out a Go client for the proxy (not
that this is going to be something most Go projects would want
versus vendoring c/image...but hey, maybe it'll be useful).

Now what I hit in trying to use the main test images is currently
the proxy fails on manifest lists, so I'll need to fix that.


proxy: Add support for manifest lists

We need to support manifest lists. I'm not sure how I missed this
originally. At least now we have integration tests that cover this.

The issue here is fairly subtle - the way c/image works right now,
image.FromUnparsedImage does pick a matching image from a list
by default. But it also overrides GetManifest() to return the
original manifest list, which defeats our goal here.

Handle this by adding explicit manifest list support code. We'll
want this anyways for future support for GetRawManifest or so
which exposes OCI manifest lists to the client.


proxy_test: Add a helper method to call without fd

To verify in one place.


proxy_test: Add helper to read all from a reply

Prep for testing GetConfig.


proxy_test: Test GetConfig

Now that we have a test suite, let's use it more.


@cgwalters
Copy link
Contributor Author

cgwalters commented Nov 8, 2021

vet: integration/proxy_test.go:186:3: unknown field Pdeathsig in struct literal

Blah. Annoying when Windows/MacOS come to rain on my Linux happy place.

)

// This image is known to be x86_64 only right now
const knownNotManifestListedImage_x8664 = "docker://quay.io/coreos/11bot"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sure there's a better image for this, maybe something in quay.io/libpod?

@vrothberg
Copy link
Member

Thanks, @cgwalters! I will have a look at this PR tomorrow morning.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Only a minor nit. Could you sign (git commit -s) your commits? I am not sure why the CI isn't barking on that but our contributing guidelines require that.

@cgwalters cgwalters force-pushed the proxy-config branch 2 times, most recently from d4c90db to e02e864 Compare November 10, 2021 13:51
@cgwalters
Copy link
Contributor Author

Only a minor nit. Could you sign (git commit -s) your commits?

Done!

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
@lsm5 @mtrmac @rhatdan PTAL

@cgwalters
Copy link
Contributor Author

Of these I think 982aa51 could use specific review. I find the c/image APIs here a bit confusing.

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good overall.

Do note the DiffID comment.

@mtrmac
Copy link
Contributor

mtrmac commented Nov 10, 2021

Of these I think 982aa51 could use specific review. I find the c/image APIs here a bit confusing.

Looks fine to me.

While the caller could fetch this today as a blob, it'd be in
either docker or oci schema.  In keeping with the model of having
this proxy only expose OCI, add an API which uses the c/image logic
to do the conversion.

This is necessary for callers to get the diffIDs, and in general
to implement something like an external `skopeo copy`.

Signed-off-by: Colin Walters <walters@verbum.org>
Since this is shared between the manifest and config paths.

Signed-off-by: Colin Walters <walters@verbum.org>
Just noticed while scrolling past the code.

Signed-off-by: Colin Walters <walters@verbum.org>
I debated adding "reverse dependency testing" using
https://crates.io/crates/containers-image-proxy
but I think it's easier to reuse the test infrastructure here.

This also starts fleshing out a Go client for the proxy (not
that this is going to be something most Go projects would want
versus vendoring c/image...but hey, maybe it'll be useful).

Now what I hit in trying to use the main test images is currently
the proxy fails on manifest lists, so I'll need to fix that.

Signed-off-by: Colin Walters <walters@verbum.org>
We need to support manifest lists. I'm not sure how I missed this
originally.  At least now we have integration tests that cover this.

The issue here is fairly subtle - the way c/image works right now,
`image.FromUnparsedImage` does pick a matching image from a list
by default.  But it also overrides `GetManifest()` to return the
original manifest list, which defeats our goal here.

Handle this by adding explicit manifest list support code.  We'll
want this anyways for future support for `GetRawManifest` or so
which exposes OCI manifest lists to the client.

Signed-off-by: Colin Walters <walters@verbum.org>
To verify in one place.

Signed-off-by: Colin Walters <walters@verbum.org>
Prep for testing `GetConfig`.

Signed-off-by: Colin Walters <walters@verbum.org>
Now that we have a test suite, let's use it more.

Signed-off-by: Colin Walters <walters@verbum.org>
To fix compilation on MacOS.

I think actually we want to use this pervasively in our tests
on Linux; it doesn't really matter when run inside a transient
container, but `PDEATHSIG` is useful for persistent containers (e.g.)
toolbox and when running outside of a pid namespace, e.g. on a host
system shell directly or in systemd.

Signed-off-by: Colin Walters <walters@verbum.org>
By Go convention.

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Contributor Author

CI failure looks unrelated, is there a way to retrigger or should I just repush?

@vrothberg
Copy link
Member

I retriggered, let's see what's going on.

@vrothberg
Copy link
Member

And one more time

@vrothberg vrothberg merged commit 0029782 into containers:main Nov 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants