From 6dbc3a29c7afbc406c644f67e77525a17c66c9f2 Mon Sep 17 00:00:00 2001 From: JanMa Date: Wed, 12 Aug 2020 20:28:03 +0200 Subject: [PATCH] Update docs for nspawn driver There have been some new config options added in recent releases of the nspawn driver. This commit updates the docs accordingly. --- .../pages/docs/drivers/external/nspawn.mdx | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/website/pages/docs/drivers/external/nspawn.mdx b/website/pages/docs/drivers/external/nspawn.mdx index 78eb7458c..bab39c448 100644 --- a/website/pages/docs/drivers/external/nspawn.mdx +++ b/website/pages/docs/drivers/external/nspawn.mdx @@ -52,12 +52,17 @@ The `nspawn` driver supports the following configuration in the job spec: * [`console`](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--console=MODE) - (Optional) Configures how to set up standard input, output and error output for the container. -* `image` - Path to the image to be used in the container. This can either be a - [directory](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#-D) - or the path to a file system +* `image` - The image to be used in the container. This can either be the path + to a + [directory](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#-D), + the path to a file system [image](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#-i) - or block device. Can be specified as a relative path from the configured Nomad - plugin directory. **This option is mandatory**. + or block device or the name of an image registered with + [`systemd-machined`](https://www.freedesktop.org/software/systemd/man/systemd-machined.service.html). + A path can be specified as a relative path from the configured Nomad plugin + directory. **This option is mandatory**. +* `image_download` - (Optional) Download the used image according to the + settings defined in this block. Structure is documented below. * [`pivot_root`](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--pivot-root=) - (Optional) Pivot the specified directory to the be containers root directory. * [`resolv_conf`](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--resolv-conf=) - @@ -113,10 +118,22 @@ The `nspawn` driver supports the following configuration in the job spec: } ``` +The `image_download` block supports the following arguments: +* `url` - The URL of the image to download. The URL must be of type `http://` or + `https://`. **This option is mandatory**. +* [`verify`](https://www.freedesktop.org/software/systemd/man/machinectl.html#pull-tar%20URL%20%5BNAME%5D) - + (Optional) `no` (default), `signature` or `checksum`. Whether to verify the + image before making it available. +* `force` - (Optional) `true` or `false` (default) If a local copy already + exists, delete it first and replace it by the newly downloaded image. +* `type` - (Optional) `tar` (default) or `raw`. The type of image to download. + ## Networking -Currently the `nspawn` driver only supports host networking. +The `nspawn` driver has support for host networking and also bridge mode +networking. It can therefore be used with Nomad's [Consul Connect +integration][consul_connect_integration]. ## Client Requirements @@ -131,6 +148,7 @@ The `nspawn` driver requires the following: ## Plugin Options * `enabled` - The `nspawn` driver may be disabled on hosts by setting this option to `false` (defaults to `true`). +* `volumes` - Enable support for Volumes in the driver (defaults to `true`). An example of using these plugin options with the new [plugin syntax][plugin] is shown below: @@ -139,6 +157,7 @@ syntax][plugin] is shown below: plugin "nspawn" { config { enabled = true + volumes = true } } ``` @@ -160,3 +179,4 @@ The `nspawn` driver will set the following client attributes: [plugin-options]: #plugin-options [client_options]: /docs/configuration/client#options [docker_driver]: /docs/drivers/docker#using-the-port-map +[consul_connect_integration]: /docs/integrations/consul-connect