wasm: add support for OCI registries #37635
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to: #33212
This is a prototype implementation of fetching WASM plugins from OCI registries. I want to know if the implementation goes in the right direction, share my findings and challenges I faced and hear your opinion on whether it's worth developing it further.
Image format:
I assumed we will support the following image format, as it is widely adopted by registries.
Fetching proces:
According to the OCI spec, we have to perform 2 subsequent requests:
GET /v2/<repo>/manifests/<tag>
andGET /v2/<repo>/blobs/<digest>
. This is done byOciImageManifestsFetcher
andOciImageBlobFetcher
.Authentication and authorization:
This is not covered by the OCI distribution spec, but different registries support different authentication methods. I tested ECR and Docker Hub, and they work as follows:
X-Amz-Security-Token
in the URL).auth.docker.io
using basic authentication.Redirects:
This is also not described in the OCI distribution spec, but both ECR and Docker returns 307 with temporary location to requests for /blobs.
Dynamic cluster resolution:
Because of redirect responses with locations, which we can't predict, we will probably need
envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig
, but it does not work if the hostname is not resolved by the filter, socreateWasm
would have to resolve DNS names...API changes
I wanted to reuse as much as we already have, so I did not add
oci_uri
to the API. Instead, I'm checking if the URI starts withoci://
. Additionally, I addedbasic_credentials
to send basic auth header.Reading a secret:
Reading a secret during plugin creation can't be done if the secret is for outbound traffic, because in such a case the filter is created with the factory method that takes
Envoy::Server::Configuration::ServerFactoryContext
, which does not provideTransportSocketFactoryContext
required to read the secret. Making this work would require to change many other filter factories in the code base.