-
Couldn't load subscription status.
- Fork 881
rkt/image: check that discovery labels match manifest labels #2311
rkt/image: check that discovery labels match manifest labels #2311
Conversation
|
Can we land this in such a way that won't break today's |
|
This doesn't break the "implicit latest" when you don't specify any labels: However, using the label: |
|
@iaguis and your second example works today right? |
|
We can also try to not break today's But this won't fix the problem that, a future rkt fetch/run, will go to the store and won't find an image with label version==latest (so fetching it again, additionally: is this "magic" behavior used by some users instead of using I think that the current problem is the lack of explanation on what implies fetching/running by image name and labels (for example users accustomed with docker thinking that For this I opened some appc/spec PRs with two different ways of doing this:
So I think we should primarily clarify how to do "latest" pattern in appc/spec and accept possible breakage since making it compatible with current experience (which IMHO is not correct) will subsequently cause other incompatibilities. I think this deserves a broader discussion. Perhaps opening too much related issues has caused some confusion (sorry for this), so let me know if I should try another path (like providing a document explaining the current issues or something else). |
Yes. |
Yeah! This is the right way of doing current implicit latest. The problem is that, as asked by @jonboulle, some user do |
|
I think I agree with the summaries in #2311 (comment) and #2311 (comment), that the likelihood of the |
|
also cc @alban for review since he's been quiet |
I'll happily do it. Will a recap of the current "problems", the possible solutions and the related appc/spec and rkt PRs will be too much? |
| // the ones in the image manifest. | ||
| func (v *validator) ValidateLabels(labels map[types.ACIdentifier]string) error { | ||
| for n, rv := range labels { | ||
| if av, ok := v.manifest.GetLabel(n.String()); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it also return an error if ok == false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh! Right! Need to improve the tests to also match these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
Since the fetch works without specifying ":latest" on the command line, the change is ok for me. |
Probably too much for some, but I'll never argue against thoroughness ;-) - as long as there's a tldr section |
ea955e0 to
c6c3de0
Compare
|
@sgotti the code LGTM. Do you mind adding something in CHANGELOG.md, in the vUNRELEASED section? That would help @s-urbaniak when doing the next release (#2378) :) |
|
@alban Sure. Will do. |
c6c3de0 to
addc99f
Compare
Tried to add something understandable in the CHANGELOG.md (since the latest pattern can be confusing). Please let me know how it can be improved. |
addc99f to
6529268
Compare
CHANGELOG.md
Outdated
|
|
||
| #### New features and UX changes | ||
|
|
||
| - Ensure that the initial name and labels used for discovery matches the name and labels in the Image Manifest as specified in the appc spec ([#2311](https://github.com/coreos/rkt/pull/2311)). Now users calling `rkt prepare/run/fetch example.com/aci:latest` but receiving an aci with a different version (like v2.0) will receive a validation error. With the current rkt "latest" pattern, users that want to use the "latest" image should use `rkt prepare/run/fetch example.com/aci` or if they want to bypass a locally cached image in the store and fetch an updated image (if the ACI's image discovery provides it) should use `rkt --no-store prepare/run/fetch example.com/aci`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/matches/match/
The last sentence is a bit confusing, also, --no-store needs to go after prepare/run/fetch. How about:
Users wanting the latest image should use
rkt prepare/run/fetch example.com/aciwithout any labels. If the discovery server supports the "latest" pattern, the user can bypass a locally cached image in the store and fetch an updated image usingrkt prepare/run/fetch --no-store example.com/acioption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Will update with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After that, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks.
The spec in the discovery part says: "Implementations MUST ensure that the initial name and labels used for discovery matches the name and labels in the Image Manifest." Actually rkt just checks that the names matches but ignore the labels. This patch also check the labels. Like the other validation parts the check is executed only if the user doesn't pass `--insecure-options=image` A functional test is added. With this patch users calling `rkt fetch example.com/aci:latest` but receiving an aci with a different version (like v2.0) will receive a validation error.
6529268 to
15b33b1
Compare
The spec in the discovery part says: "Implementations MUST ensure
that the initial name and labels used for discovery matches the name and
labels in the Image Manifest."
Actually rkt just checks that the names matches but ignore the labels.
This patch also check the labels. Like the other validation parts the
check is executed only if the user doesn't pass
--insecure-options=imageA functional test is added.
With this patch users calling
rkt fetch example.com/aci:latestbutreceiving an aci with a different version (like v2.0) will receive a
validation error.
This will fix a part of #2305 (since it will error on users running
rkt fetch example.com/aci:latestto get the latest image if they don't have image verification disabled)