-
Notifications
You must be signed in to change notification settings - Fork 146
discovery: return only best matching templates. #596
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>My app</title> | ||
<meta name="ac-discovery" content="example.com/myapp https://storage.example.com/myapp-{version}-{os}-{arch}.{ext}"> | ||
<meta name="ac-discovery-pubkeys" content="example.com https://example.com/pubkeys.gpg"> | ||
</head> | ||
|
||
<body> | ||
<h1>My App</h1> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,18 @@ curl $(echo "$urltmpl" | sed -e "s/{name}/$name/" -e "s/{version}/$version/" -e | |
|
||
where _name_, _version_, _os_, and _arch_ are set to their respective values for the image, and _ext_ is either `aci` or `aci.asc` for retrieving an App Container Image or signature respectively. | ||
|
||
The client MUST accept only best matching templates. Best matching templates are the one where all the templates labels can be substituted and with the highest number of substituted labels. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's a little underspecified here which labels clients should/may require. We should probably call that out specifically There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't really get the rationale here. If all client-supplied labels must be substituted, then won't be "highest number of substituted labels" always be equal to the number of client-supplied labels? Or are you talking about templates where the same variable might exist multiple times? e.g. given client-supplied label There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That was the original idea in #580, in this patch there isn't the requirement to substitute all the client supplied labels but to return only the templates that match the highest number of client-supplied labels. Perhaps, If you agree on this new idea, the spec description needs your help for better wording 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
but in the text you have
Perhaps it should just be this instead?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, I'll try to reword it:
Where
|
||
|
||
For example given these meta tags: | ||
```html | ||
<meta name="ac-discovery" content="example.com https://storage.example.com/{os}/{arch}/{name}-{version}.{ext}"> | ||
<meta name="ac-discovery" content="example.com https://mirror.storage.example.com/{os}/{arch}/{name}-{version}.{ext}"> | ||
<meta name="ac-discovery" content="example.com https://storage.example.com/{os}/{arch}/{name}-latest.{ext}"> | ||
``` | ||
|
||
If the client requires the image name _name_ and labels _version_, _os_, _arch_ only the first two templates will be rendered since they match 3 labels (while the the last matches only 2 labels since it doesn't match the _version_ label). | ||
If the client requires the image name _name_ and labels _os_, _arch_ only the last template will be rendered since in the first template '{version}' cannot be substituted. | ||
|
||
Note that multiple `ac-discovery` tags MAY be returned for a given prefix-match (for example, with different scheme names representing different transport mechanisms). | ||
In this case, the client implementation MAY choose which to use at its own discretion. | ||
Public discovery implementations SHOULD always provide at least one HTTPS URL template. | ||
|
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.
Really we should probably error if this happens, but I guess this is OK