Update README.api.md with the revised cmdline format.

Everything old is new again, we're back to a simple string for the
commandline, but this time with template goodness for URL expansion.
This commit is contained in:
David Anderson 2017-02-22 01:05:34 -08:00
parent 7642226388
commit 0d99a2ad1f

View File

@ -30,15 +30,10 @@ following specification, with **_italicized_** entries being optional:
- **kernel** (string): the URL of the kernel to boot. - **kernel** (string): the URL of the kernel to boot.
- **_initrd_** (list of strings): URLs of initrds to load. The kernel - **_initrd_** (list of strings): URLs of initrds to load. The kernel
will flatten all the initrds into a single filesystem. will flatten all the initrds into a single filesystem.
- **_cmdline_** (object): commandline parameters for the kernel. Each - **_cmdline_** (string): commandline parameters for the kernel. The
key/value pair maps to key=value, where value can be: commandline is processed by Go's text/template library. Within the
- **string**: the value is passed verbatim to the kernel template, a `URL` function is available that takes a URL and
- **true**: the value is omitted, only the key is passed to the rewrites it such that Pixiecore proxies the request.
kernel.
- **object**: the value is a URL that Pixiecore will rewrite such
that it proxies the request (see below for why you'd want that).
- **url** (string): any URL. Pixiecore will rewrite the URL such
that it proxies the request.
- **_message_** (string): A message to display before booting the - **_message_** (string): A message to display before booting the
provided configuration. Note that displaying this message is on provided configuration. Note that displaying this message is on
a _best-effort basis only_, as particular implementations of the a _best-effort basis only_, as particular implementations of the
@ -95,7 +90,7 @@ detail of Pixiecore and are subject to breaking change at any
time. time.
For the curious, the current implementation translates API server For the curious, the current implementation translates API server
provided URLs into `<pixiecore HTTP endpoint>/f/<signed URL provided URLs into `<pixiecore HTTP endpoint>/_/file?name=<signed URL
blob>`. The signed URL blob is a base64-encoding of running NaCL's blob>`. The signed URL blob is a base64-encoding of running NaCL's
secretbox authenticated encryption function over the server-provided secretbox authenticated encryption function over the server-provided
URL, using an ephemeral key generated when Pixiecore starts. This URL, using an ephemeral key generated when Pixiecore starts. This
@ -145,10 +140,7 @@ Boot from HTTPS, with extra commandline flags.
{ {
"kernel": "https://files.local/kernel", "kernel": "https://files.local/kernel",
"initrd": ["https://files.local/initrd"], "initrd": ["https://files.local/initrd"],
"cmdline": { "cmdline": "selinux=1 coreos.autologin"
"selinux": "1",
"coreos.autologin": true
}
} }
``` ```
@ -167,12 +159,7 @@ Provide a proxied cloud-config and an unproxied other URL.
{ {
"kernel": "https://files.local/kernel", "kernel": "https://files.local/kernel",
"initrd": ["https://files.local/initrd"], "initrd": ["https://files.local/initrd"],
"cmdline": { "cmdline": "cloud-config-url={{ URL \"https://files.local/cloud-config\" }} non-proxied-url=https://files.local/something-else"
"cloud-config-url": {
"url": "https://files.local/cloud-config"
},
"non-proxied-url": "https://files.local/something-else"
}
} }
``` ```
@ -187,13 +174,26 @@ directly from upstream servers.
## Deprecated features ## Deprecated features
### Kernel commandline as a string ### Kernel commandline as an object
The `cmdline` parameter returned by the API server can also be a plain The `cmdline` parameter returned by the API server can also be a JSON
string instead of an object. That string is the full verbatim object, where each key/value pair is one commandline parameter. The
commandline to be passed to the booting kernel. format is:
This form was replaced by the object form to allow Pixiecore to do - **_cmdline_** (object): commandline parameters for the kernel. Each
additional processing of the commandline before passing it to the key/value pair maps to key=value, where value can be:
booting kernel - specifically to allow for URL translation and - **string**: the value is passed verbatim to the kernel
proxying. - **true**: the value is omitted, only the key is passed to the
kernel.
- **object**: the value is a URL that Pixiecore will rewrite such
that it proxies the request (see below for why you'd want that).
- **url** (string): any URL. Pixiecore will rewrite the URL such
that it proxies the request.
This form was replaced by the use of Go's text/template to allow for
inline URL substitution, without having to construct a cumbersome JSON
object, and to resolve issues with non-deterministic commandline
parameter ordering.
There are currently no plans to remove this form of the `cmdline`
value, though its use is discouraged.