Fix OCI errors#645
Conversation
5d2423b to
606ff18
Compare
|
Hi, and thanks for your contribution! How does this impact clients trying to connect to servers that have not been updated to conform to the latest spec changes, and might return one of the two removed variants? I definitely agree with adding the new one, not sure about the removals. |
|
Hi @radu-matei, |
oci errors updated to be even with https://github.com/opencontainers/distribution-spec/blob/main/spec.md#errors-2 * TAG_INVALID and MANIFEST_UNVERIFIED were removed from OCI spec: opencontainers/distribution-spec#206 * TOO_MANY_REQUESTS was added Signed-off-by: jwhb <jwhy@jwhy.de>
| /// This operation is unsupported | ||
| Unsupported, | ||
| /// Too many requests from client | ||
| Toomanyrequests, |
There was a problem hiding this comment.
Can this be TooManyRequests to match the casing style of other enums? The serde macro on line 39 will change these all to SCREAMING_SNAKE_CASE. If the casing is incorrect then it will not be cased correctly.
To clarify:
Toomanyrequests->TOOMANYREQUESTSTooManyRequests->TOO_MANY_REQUESTS
There was a problem hiding this comment.
I already fiddled with the SCREAMING_SNAKE_CASE and, as you said, putting TooManyRequests will map to TOO_MANY_REQUESTS. In the OCI spec it is TOOMANYREQUESTS, so I tricked the screaming snake with the value Toomanyrequests.
I hope I understood you correctly, but I couldn't make it work with TooManyRequests.
There was a problem hiding this comment.
So in the PR description I previously mentioned TOO_MANY_REQUESTS, which doesn't exist in the spec...
|
I agree with @radu-matei's assumption. Let's leave in "deprecated" error operations to retain backwards compatibility. It is quite possible there are several OCI registries still relying and reporting those errors. It doesn't affect any existing behaviour if we keep it in; in fact it will be more assistive to the user if we continue to report these errors until we can be completely sure they've been deprecated. Feel free to add a comment to those operations to note they've been deprecated with a link to the deprecation notice in the spec's changelog. That way we have a note to look back to in future refactors. |
Ahh... Never mind. I see now why the casing is different. Yay for consistency! LGTM |
add deprecation notice for ManifestUnverified and TagInvalid. both error codes have been removed from the OCI dist spec. ref: https://github.com/opencontainers/distribution-spec/blob/main/spec.md\#error-codes Signed-off-by: jwhb <jwhy@jwhy.de>
|
Could you please also add a deserialization test for the new variant? Thank you so much! |
I would, but apparently there is nothing to deserialize. We know the error code No body in the response. The OCI dist spec says:
Should we assume an error object like so? {
"errors": [
{
"code": "TOOMANYREQUESTS",
"message": "pull request limit exceeded",
"detail": "You have reached your pull rate limit."
},
]
}EDIT: @radu-matei: I just added the deserialization test. The JSON is just a blind guess. |
Signed-off-by: jwhb <jwhy@jwhy.de>
Changes
OCI errors were updated to be even with the spec:
TAG_INVALIDandMANIFEST_UNVERIFIEDwere removed from OCI spec: Resolve several open issues opencontainers/distribution-spec#206TOOMANYREQUESTSwas addedTested on CentOS 8.2.2004 and KinD with Kubernetes v1.21.1.
Why?
After bootstrapping a krustlet-wasi node I received this error:
and after that more conveniently: