-
Notifications
You must be signed in to change notification settings - Fork 672
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
manifest: add annotations #44
Conversation
@vbatts Can you provide a few examples of what annotations are for? We have a list in appc you can steal: https://github.com/appc/spec/blob/master/spec/aci.md#image-manifest-schema
|
@philips good point. Also, while I like the ACI array of |
@vbatts the reason we did that is because JSON hash maps have no ordering or rules for key collision. In fact most JSON libraries have no way of telling you you have duplicate keys. The goal was to avoid "mysterious" bugs. But, this spec already does this for things like volumes so I am OK with making it a hashmap. cc @jonboulle |
Yeah, I don't expect order in this list, but I see where that is valuable. The key-collision is undefined behaviour IMO. Though the ACI approach would leave that up to the implementation to handle it gracefully. |
@vbatts right, it is a workaround to a library and JSON spec problem. But, I am OK with the spec saying "don't do that". |
re: hashmaps, I still see no need to require a particular format for |
@wking because specifying a golang |
On Wed, Apr 27, 2016 at 12:21:59PM -0700, Vincent Batts wrote:
So the Markdown should say ‘JSON’ or ‘object’ 1. The whole field is |
@wking we need to dictate some sort of schema for tooling and display. I disagree with your assessment. |
On Wed, Apr 27, 2016 at 01:49:47PM -0700, Brandon Philips wrote:
“@wking we need to dictate some sort of schema for tooling and
display.”
I think any tooling / display that intends to consume this information
should be the one specifying the structure.
|
The tooling needs some expectation that there will be key/value strings so On Wed, Apr 27, 2016 at 2:46 PM W. Trevor King notifications@github.com
|
On Wed, Apr 27, 2016 at 03:14:18PM -0700, Brandon Philips wrote:
You can do all of those things with opaque JSON. In fact, there are a |
Again as someone who has been involved in building tools (actool, quay, As a general rule I would rather we lean towards restrictive schema's On Wed, Apr 27, 2016 at 3:23 PM W. Trevor King notifications@github.com
|
On Wed, Apr 27, 2016 at 03:58:44PM -0700, Brandon Philips wrote:
You're suggesting a semi-opaque field and I'm trying to understand why I think the point of having an opaque field is that we can stop |
I don't think the string to string object precludes storage of structured types. A user can very easily serialize a structured type to bytes and store it in a string field. What it does allow is flexibility in the serialization format a user chooses. For example a user may want to store a plaintext paragraph under a "description" annotation, or a build system may want to store a proto with build metadata. However string->string is less flexible in other ways, e.g. it would prevent generic field based ACL'ing to apply inside an annotation value. A similar discussion happened regarding kubernetes objects: kubernetes/kubernetes#1201 I'd like to highlight the conclusion here:
We originally went with string->string annotations and found it suitable in use cases, and preferable in most so we decided to stick with it. It's possible that same arguments don't apply here but I think there was a consensus here that a decision one way or the other was relatively inconsequential. |
FWIW I'm in favor of map of string to string. |
On Wed, Apr 27, 2016 at 04:18:19PM -0700, Mike Danese wrote: Ahh, thanks for giving this some technical grounding :). It sounds And it sounds like JSON-parsing library support wasn't an issue |
@wking Sorry, i don't get that impression from you links. But rather that it would cause unwanted complexity. |
@mikedanese Thanks for your input. I'm also in favor of a string-string hashmap, but was willing to be convinced of an ordered array of |
On Wed, Apr 27, 2016 at 07:13:04PM -0700, Vincent Batts wrote:
Links were for JSON-library support, and relevant snippets from each
There are some concerns around backwards compatibility in 3, but if |
What does the order imply? Arrays are not friendly to multiple owners. JSON merge patch replaces lists e.g.:
but
https://tools.ietf.org/html/rfc7396 So the api either need to define a nonstandard merge routine or the user always read before write to ensure that other annotations aren't mucked with (which also requires transaction support). |
@mikedanese good point, which was not where my thought was (regarding outcome of merging). I don't care to solve such problems in this spec. I was referring to two parts. 1) perhaps users of the annotations field may value having the list be ordered. 2) if there were multiple keys (for whatever awful reason), then it could be more allowable by the data structure. As it is, I'm more of the mind to have it be a string-string hashmap. I can add wording around lack of order and all keys are unique. |
Updated. PTAL. |
Are annotations intended to be set by tooling? We can recommend aggressive namespacing and versioning to avoid conflicts. e.g.: {
"annotations": {
"ociplugin.v1alpha1.jenkins.io/started": "1461862737",
"ociplugin.v1alpha1.jenkins.io/finished": "1461862772",
"ociplugin.v1alpha1.jenkins.io/started-by": "mikedanese",
"ociplugin.v1alpha1.jenkins.io/user-agent": "workstation-anacron",
"clair.beta.coreos.com/started": "1461862940",
"clair.beta.coreos.com/vulnerability-report": "{\"passed\":true,\"description\":\"I'd say this image is good to go\"}",
"clair.beta.coreos.com/vulnerability-report-gpg": "owEBRgG5/pANAwACAX9bb5A9WD91AawWYgh0ZXN0LnR4dFciRQFmb28gYmFyCokBHAQAAQIABgUCVyJFAQAKCRB/W2+QPVg/dcreB/9k2E4Ygj7aTkdEWr3geIqG6O8nKe+4ni4BSbK/8aRrFkghccNcw4JbZq/kHBLFQnTccwMr0uSx6zVV7M5sF/7r78rThBB5gDY3y/hPhILztOXCoilb9nAZDsxyz6zK00bMEGCakYLVE8tafZQVYeqkP50J7W3kJfn1maCE+cSmd+nP7UaWWIcSSAiHSvgxqGVMEceahuAMf+iCI5mDtImDFLzUTwz4eNlgOBrq6FIlrbK5cPXLi1ZfZaoUnlRI2E2C26crXFgf61z40vqVoSlu59i0voRkqcB1n3leSGvG88UoOQyv9r7643ZSdWq0H1u1I2Ipoh2pdrexE1HO+vSI",
}
} |
Metapoint: I think it's useful to consider the application of a spec when designing a spec to observe and potentially avoid problems that exist in usage. I wouldn't drive the design with usability issues but perhaps they can serve as tie breakers. |
@mikedanese +1 on aggressive namespacing. Wording from appc that can be a source of inspiration:
|
This introduces OPTIONAL annotations, which are consistent with the annotations in the runtime-spec. While the spec does not exclude use of arbitrary fields, this OPTIONAL property gives a guided place for manifest authors to isolate their arbitrary metadata. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Updated. PTAL. |
LGTM |
Typos from 78c7ff7 (manifest: add annotations, 2016-04-27, opencontainers#44). Signed-off-by: W. Trevor King <wking@tremily.us>
The 'null' option has been in the JSON Schema since 78c7ff7 (manifest: add annotations, 2016-04-27, opencontainers#44), although I expect it was accidental. The spec has clearly not allowed: "annotations": null since 873b9b6 (Add some text about extensions, 2016-06-26, opencontainers#164) landed with the following (still current) requirements: Annotations MUST be a key-value map where both the key and value MUST be strings. and: If there are no annotations then this property MUST either be absent or be an empty map. Folks without annotations should not set the property at all, or they should set it to: "annotations": {} Signed-off-by: W. Trevor King <wking@tremily.us>
The 'null' option has been in the JSON Schema since 78c7ff7 (manifest: add annotations, 2016-04-27, opencontainers#44), although I expect it was accidental. The spec has clearly not allowed: "annotations": null since 873b9b6 (Add some text about extensions, 2016-06-26, opencontainers#164) landed with the following (still current) requirements: Annotations MUST be a key-value map where both the key and value MUST be strings. and: If there are no annotations then this property MUST either be absent or be an empty map. Folks without annotations should not set the property at all, or they should set it to: "annotations": {} Signed-off-by: W. Trevor King <wking@tremily.us>
This introduces OPTIONAL annotations, which are consistent with the
annotations in the runtime-spec.
While the spec does not exclude use of arbitrary fields, this OPTIONAL
property gives a guided place for manifest authors to isolate their
arbitrary metadata.
Signed-off-by: Vincent Batts vbatts@hashbangbash.com