Commit API spec and design doc#444
Conversation
Still TODO: - Appendices A-E. - Resolve diffs between spec.md and concrete API definition. - Define process for updating the API specification. - Additional API specifications covering: * Logging / monitoring / observability contract * Runtime container contract / environment
|
|
||
| * **Revisions**, which are immutable snapshots of code + config, created by a | ||
|
|
||
| * **Configuration**, which acts as a stream of environments for Revisions. |
There was a problem hiding this comment.
The diagram @mchmarny has in his docs PR would be fantastic here.
There was a problem hiding this comment.
You mean https://github.com/mchmarny/elafros/blob/master/docs/overview/images/api-objects.png ?
That's one of about 5-6 pictures that needs to be added to the PR.
|
Much credit to @cooperneil for much of the original prose of the document. |
docs/spec/overview.md
Outdated
| * a single resource that can be watched to see a history of all | ||
| revisions created | ||
|
|
||
| * enables (but doesn’t mandate) PATCH semantics for new revisions to |
There was a problem hiding this comment.
parallelism fail: "provides enables PATCH semantics"
There was a problem hiding this comment.
Configuration:
- provides a single referenceable...
- provides a single resource ...
- enables ...
- provides the ability
There was a problem hiding this comment.
I think I can just omit "enables" here, and say "provides (but does not mandate) PATCH semantics ..."
| change to configuration, such as updating an env variable, | ||
| inheriting all other configuration and source/image. | ||
|
|
||
| When creating an initial route and performing the first deployment, |
There was a problem hiding this comment.
This paragraph will want to change with a resolution to #412
There was a problem hiding this comment.
I think another layer of this document will be necessary after formalizing #412, but in its original form, this doc describes operating on the core elafros building blocks
docs/spec/spec.md
Outdated
| selfLink: ... | ||
| ... | ||
| spec: | ||
| rollout: |
There was a problem hiding this comment.
Current API has traffic bumped up a level, and no rollout field.
docs/spec/errors.md
Outdated
| - type: BuildFailed | ||
| status: True | ||
| reason: BuildStepFailed # could also be SourceMissing, etc | ||
| # reason is for machine consumption, message is for human consumption |
There was a problem hiding this comment.
I think this is in conflict with the recommendation in #351, where:
Reason is typically defined in terms of a string and so the values this takes on (while camelcase words) should be treated as opaque. Clients shouldn't programmatically act on their values, but bias towards using Reason as a terse explanation of the state for end-users
docs/spec/normative_examples.md
Outdated
| - revisionName: def | ||
| percent: 25 | ||
| conditions: | ||
| - type: RolloutInProgress |
There was a problem hiding this comment.
In the spirit of making terminal happy-path conditions true, perhaps we should flip this to change RolloutInProgress -> RolloutComplete
There was a problem hiding this comment.
We have a Ready condition today, to reflect the time until the referenced Revisions and Configurations are themselves first ready. After it becomes Ready I wouldn't expect transitions such as Configuration rollouts to affect readiness.
RolloutComplete with status: False (or conversely RolloutInProgress) certainly communicate a notable condition, but I wonder if this is adequately covered by .status.traffic and events?
docs/spec/spec.md
Outdated
| # +optional. composable Build spec, if omitted provide image directly | ||
| build: # This is a build.dev/v1alpha1.BuildTemplateSpec | ||
| source: | ||
| # oneof archive|manifest|repository: |
There was a problem hiding this comment.
this can be updated with the new proposed Build structure, featuring:
source:
git:
gcs:
custom:
@mattmoor - I can't recall the issue # that describes this form
|
|
||
| These are generally software engineres looking to build and run a | ||
| stateless software application, without concern about the underlying | ||
| infrastructure. |
There was a problem hiding this comment.
The developer personas are software engineers, who are looking to build and run a stateless software application without having to worry about the underlying infrastructure.
There was a problem hiding this comment.
I believe the comma in "software engineers, who are looking to build..." is unnecessary. I'm also unsure what a stateless non-software application would be; is it necessary to mention software? I'd rephrase this as:
The developer personas are software engineers looking to build and run a stateless application without worrying about the underlying infrastructure.
There was a problem hiding this comment.
D'oh, I copied this from another branch. Well, I'll copy it in because it may be useful, but we should merge it with @mchmarny 's docs.
docs/product/personas.md
Outdated
|
|
||
| * Hobbyist | ||
| * "Backend" SWE | ||
| * "Full stack" SWE |
There was a problem hiding this comment.
remove quotes:
Backend SWE
Full stack SWE
docs/product/personas.md
Outdated
| - Start a build | ||
| - Read build logs | ||
| * Language operator | ||
| - Create a build path/build pack |
There was a problem hiding this comment.
Maybe, to be parallel with the other sections this should say:
- Developer (starting a build and reading build logs)
- Language operator (creating a build path/build pack)
There was a problem hiding this comment.
I updated this to add User stories in addition to the prototypical job roles that the first section had.
docs/spec/errors.md
Outdated
| of the resource. | ||
|
|
||
| * other fields may provide status on the most-recently retrieved state | ||
| of the world as it relates to the resource (example: number of |
There was a problem hiding this comment.
most recently retrieved (no hyphen)
state of the system (not world) or state of the environment?
docs/spec/errors.md
Outdated
| @@ -0,0 +1,304 @@ | |||
| # Error Conditions and Reporting | |||
|
|
|||
| The standard kubernetes API pattern for reporting configuration errors | |||
docs/spec/overview.md
Outdated
| to any or all backing revisions. | ||
|
|
||
| **Revision** is an immutable snapshot of code and configuration. A | ||
| revision may have been created from a pre-built container image or |
docs/spec/overview.md
Outdated
| built from source. While there is a history of previous revisions, | ||
| only those currently referenced by a Route are addressable or | ||
| routable. Older inactive revisions need not be backed by underlying | ||
| resources, they may exist only as the revision metadata in |
There was a problem hiding this comment.
they exist only as revision metadata in storage.
docs/spec/overview.md
Outdated
|
|
||
| A **Configuration** describes the desired latest Revision state, and | ||
| creates and tracks the status of Revisions as the desired state is | ||
| updated. A configuration may include instructions on how to transform |
| rollouts | ||
|
|
||
| * a single resource that can be watched to see a history of all | ||
| revisions created |
docs/spec/overview.md
Outdated
| * a single resource that can be watched to see a history of all | ||
| revisions created | ||
|
|
||
| * enables (but doesn’t mandate) PATCH semantics for new revisions to |
There was a problem hiding this comment.
Configuration:
- provides a single referenceable...
- provides a single resource ...
- enables ...
- provides the ability
mattmoor
left a comment
There was a problem hiding this comment.
Super excited to see this. I read through a left comments.
When this goes in, I'll so another pass and open issues for the gaps.
|
|
||
| These are generally software engineres looking to build and run a | ||
| stateless software application, without concern about the underlying | ||
| infrastructure. |
docs/product/personas.md
Outdated
| - Start a build | ||
| - Read build logs | ||
| * Language operator | ||
| - Create a build path/build pack |
docs/spec/errors.md
Outdated
| ... | ||
| status: | ||
| latestReadyRevisionName: abc | ||
| latestCreatedRevisionName: bcd # Hasn't become became "Ready" |
docs/spec/errors.md
Outdated
| conditions: | ||
| - type: Complete | ||
| status: True | ||
| - type: BuildFailed |
There was a problem hiding this comment.
On the Build resource, this would just be Failed. On the Revision, it is qualified as BuildFailed.
docs/spec/errors.md
Outdated
| buildLogsLink: "http://logging.infra.mycompany.com/...?filter=..." | ||
| conditions: | ||
| - type: Complete | ||
| status: True |
There was a problem hiding this comment.
Complete implies success, so given the heading we should remove this in favor of just Failed.
I modeled this after Job, which does the same IIRC.
| BuildSpec of a Build resource in the Configuration. This describes: | ||
|
|
||
| * **What** to build (`build.source`): Source can be provided as an | ||
| archive, manifest file, or repository. |
docs/spec/normative_examples.md
Outdated
| build: # build.dev/v1alpha1.BuildTemplateSpec | ||
| source: | ||
| # oneof archive|manifest|repository: | ||
| archive: |
docs/spec/normative_examples.md
Outdated
| creation of two Revisions, one with the config change, and the other | ||
| with the new code deployment. It is expected that Revision will wait | ||
| for the `revisionTemplate.spec.container.image` to be live before | ||
| marking the Revision as "ready". |
There was a problem hiding this comment.
Change this last sentence to waiting for buildName to complete?
| source: | ||
| # oneof archive|manifest|repository: | ||
| archive: | ||
| url: https://... |
| revisionTemplate: # template for building Revision | ||
| metadata: | ||
| labels: | ||
| # One-of "function" or "app", convention for CLI/UI clients to list/select |
There was a problem hiding this comment.
"container" is a packaging format. "function" and "app" are calling styles, where a "function" typically has a single named endpoint (and possibly some supporting metadata/discovery URLs about typing etc), while an "app" has multiple HTTP endpoints.
There was a problem hiding this comment.
Ok, then I think we need to update like 99% of our samples, which IIRC I switched from serviceType: container to this kind of label w/ container :)
There was a problem hiding this comment.
I can see about putting together a PR to change this, but "container" doesn't really tell the UI much about what's going on inside (since both functions and apps end up being run as containers).
It's also valid to not supply the label, but then the UI will have to treat the Revision generically.
bobcatfish
left a comment
There was a problem hiding this comment.
So excited to see these docs in the repo! These will really help people understand the project.
Several of these pages currently have no links into them, could we add some links from DEVELOPMENT.md, maybe CONTRIBUTING.md as well?
| Configuration provides: | ||
|
|
||
| * a single referenceable resource for the route to perform automated | ||
| rollouts |
There was a problem hiding this comment.
your bulleted lists have one line too much whitespace:
-
single referenceable resource for the route to perform automated rollouts
-
a single resource that can be watched to see a history of all revisions created
v.s.
- single referenceable resource for the route to perform automated rollouts
- a single resource that can be watched to see a history of all revisions created
The former looks kinda strange, the latter is what one would expect to see and is easier on the eye
docs/spec/normative_examples.md
Outdated
|
|
||
| * Creating a revision from source | ||
|
|
||
| * Creating a function |
There was a problem hiding this comment.
could these be numbered and link to each section? and i think we should have 1 item for each of the 5 examples below e.g.
1. [Automatic rollout of a new Revision to existing Service - pre-built container](#1-automatic-rollout-of-a-new-revision-to-existing-service---pre-built-container)
2. [Creating Route and deploying first Revision - pre-built container](#2-creating-route-and-deploying-first-revision---pre-built-container)
3. [Manual rollout of a new Revision - config change only](#3-manual-rollout-of-a-new-revision---config-change-only)
4. [Deploy a Revision from source](#4-deploy-a-revision-from-source)
5. [Deploy a Function](#5-deploy-a-function)
There was a problem hiding this comment.
Added a TOC, though I used more free text than the literal section headings. I forget that github markdown doesn't automate convenient navigation.
docs/product/personas.md
Outdated
| # Elafros Personas | ||
|
|
||
| When discussing user actions, it is often helpful to [define specific | ||
| user roles](http://www.agilemodeling.com/artifacts/personas.htm) who |
There was a problem hiding this comment.
can we link to a different source of information about personas? or remove the link if we can't find anything better. the example persona on this page seems like a pretty classic example of 'so easy my grandmother could so it'
<end of rant>
There was a problem hiding this comment.
Thanks, I hadn't actually read the persona so much as Googled and picked out the first link where the leading 5 sentences made sense. I switched to Wikipedia, which seems less biased. If you can find a better reference, I'd be happy to switch the link again.
| @@ -0,0 +1,21 @@ | |||
| The goal of the Elafros project is to provide a common toolkit and API | |||
There was a problem hiding this comment.
instead of making this a separate doc, what do you think about putting this into the main README? it seems like it could be a good intro to the repo/project
There was a problem hiding this comment.
My plan is that some amount of the stuff in docs is eventually going to live at http://elafros.dev/
I'd be happy to have the README steal from some of these docs, though. (Maybe in a separate PR?)
| ``` | ||
|
|
||
|
|
||
| ## Configuration |
There was a problem hiding this comment.
it would be handy if these sections in the spec linked back to their explanations in the overview
There was a problem hiding this comment.
This tied in well with @mattmoor's suggestion. (Done)
|
|
||
|  | ||
|
|
||
| ## Route |
There was a problem hiding this comment.
This is the only heading, which stands out looking at the rendered form.
There was a problem hiding this comment.
Added headers for the others, to allow reference from other docs.
docs/spec/errors.md
Outdated
| - type: LatestRevisionReady | ||
| status: False | ||
| reason: RevisionMissing | ||
| message: "The latest Revision appears to have been deleted." |
There was a problem hiding this comment.
New emacs -- I had indent-tabs-mode non-nil.
docs/spec/spec.md
Outdated
| # build.template.arguments[_IMAGE], as the "promise" of a future build | ||
| # build.template.arguments[_IMAGE], as the "promise" of a future build. | ||
| # If buildName is provided, it is expected that this image will be | ||
| # present when the referenced build is complete. |
| - type: RolloutInProgress | ||
| status: False | ||
| - type: TrafficDropped | ||
| status: False |
There was a problem hiding this comment.
Doh, these comments don't create links, otherwise they'd be perfect :(
docs/spec/spec.md
Outdated
| @@ -233,7 +235,7 @@ status: | |||
| # the provenance of the revision, from the container | |||
| imageSource: | |||
| archive|manifest|repository: ... | |||
There was a problem hiding this comment.
I think this could use an update (if the intention is to match Build's source 1:1), or maybe even a qualification as something that needs more detailed specification (if we want it to match Grafeas, or some external standard).
| $ elafros revisions list --service my-service | ||
| Name Traffic Id Date Deployer Git sha | ||
| next 0% v3 2018-01-19 12:16 user1 64d79ce | ||
| current 100% v2 2018-01-18 20:34 user1 a6f92d1 |
There was a problem hiding this comment.
Yeah, these kind of things just seem to catch my eye for some reason. I'm reminded of the early ECR UI "screenshots" where all of the images had the same digest, but different sizes :)
| revisionTemplate: # template for building Revision | ||
| metadata: | ||
| labels: | ||
| # One-of "function" or "app", convention for CLI/UI clients to list/select |
There was a problem hiding this comment.
Ok, then I think we need to update like 99% of our samples, which IIRC I switched from serviceType: container to this kind of label w/ container :)
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: evankanderson, mattmoor The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is a conversion from GDoc-to-markdown (and cleanup) of the initial API spec written at Google and shared with various partners.
The goal is for this to become the official repo of the API specification.