diff --git a/CHANGELOG.md b/CHANGELOG.md index f59547cbb..c7a41b484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ IMPROVEMENTS: * driver: Export `NOMAD_JOB_NAME` environment variable [GH-1804] * driver/docker: Support Docker volumes [GH-1767] * driver/docker: Allow Docker logging to be configured [GH-1767] + * driver/rkt: Support rkt volumes (rkt >= 1.0.0 required) [GH-1812] BUG FIXES: * agent: Handle the SIGPIPE signal preventing panics on journalctl restarts diff --git a/client/driver/rkt.go b/client/driver/rkt.go index 159bd1ede..499102b88 100644 --- a/client/driver/rkt.go +++ b/client/driver/rkt.go @@ -38,7 +38,7 @@ const ( // minRktVersion is the earliest supported version of rkt. rkt added support // for CPU and memory isolators in 0.14.0. We cannot support an earlier // version to maintain an uniform interface across all drivers - minRktVersion = "0.14.0" + minRktVersion = "1.0.0" // The key populated in the Node Attributes to indicate the presence of the // Rkt driver @@ -47,6 +47,9 @@ const ( // rktVolumesConfigOption is the key for enabling the use of custom // bind volumes. rktVolumesConfigOption = "rkt.volumes.enabled" + + // rktCmd is the command rkt is installed as. + rktCmd = "rkt" ) // RktDriver is a driver for running images via Rkt @@ -147,7 +150,7 @@ func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, e return false, nil } - outBytes, err := exec.Command("rkt", "version").Output() + outBytes, err := exec.Command(rktCmd, "version").Output() if err != nil { delete(node.Attributes, rktDriverAttr) return false, nil @@ -168,7 +171,7 @@ func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, e minVersion, _ := version.NewVersion(minRktVersion) currentVersion, _ := version.NewVersion(node.Attributes["driver.rkt.version"]) if currentVersion.LessThan(minVersion) { - // Do not allow rkt < 0.14.0 + // Do not allow ancient rkt versions d.logger.Printf("[WARN] driver.rkt: please upgrade rkt to a version >= %s", minVersion) node.Attributes[rktDriverAttr] = "0" } @@ -203,7 +206,7 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e insecure := false if trustPrefix != "" { var outBuf, errBuf bytes.Buffer - cmd := exec.Command("rkt", "trust", "--skip-fingerprint-review=true", fmt.Sprintf("--prefix=%s", trustPrefix), fmt.Sprintf("--debug=%t", debug)) + cmd := exec.Command(rktCmd, "trust", "--skip-fingerprint-review=true", fmt.Sprintf("--prefix=%s", trustPrefix), fmt.Sprintf("--debug=%t", debug)) cmd.Stdout = &outBuf cmd.Stderr = &errBuf if err := cmd.Run(); err != nil { @@ -331,7 +334,7 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e return nil, fmt.Errorf("failed to set executor context: %v", err) } - absPath, err := GetAbsolutePath("rkt") + absPath, err := GetAbsolutePath(rktCmd) if err != nil { return nil, err } diff --git a/website/source/docs/drivers/docker.html.md b/website/source/docs/drivers/docker.html.md index 0b05dabbd..fb4635812 100644 --- a/website/source/docs/drivers/docker.html.md +++ b/website/source/docs/drivers/docker.html.md @@ -315,7 +315,7 @@ Some networking modes like `container` or `none` will require coordination outside of Nomad. First-class support for these options may be improved later through Nomad plugins or dynamic job configuration. -## Host Requirements +## Client Requirements Nomad requires Docker to be installed and running on the host alongside the Nomad agent. Nomad was developed against Docker `1.8.2` and `1.9`. @@ -333,7 +333,7 @@ user to the `docker` group so you can run Nomad without root: For the best performance and security features you should use recent versions of the Linux Kernel and Docker daemon. -## Agent Configuration +## Client Configuration The `docker` driver has the following [client configuration options](/docs/agent/config.html#options): @@ -392,7 +392,7 @@ client { } ``` -## Agent Attributes +## Client Attributes The `docker` driver will set the following client attributes: diff --git a/website/source/docs/drivers/rkt.html.md b/website/source/docs/drivers/rkt.html.md index 6f83e636a..b721f3b18 100644 --- a/website/source/docs/drivers/rkt.html.md +++ b/website/source/docs/drivers/rkt.html.md @@ -75,10 +75,15 @@ The `rkt` driver supports the following configuration in the job spec: * `debug` - (Optional) Enable rkt command debug option. -## Task Directories +* `volumes` - (Optional) A list of `host_path:container_path` strings to bind + host paths to container paths. Can only be run on clients with the + `rkt.volumes.enabled` option set to true. -The `rkt` driver currently does not support mounting of the `alloc/` and `local/` directories. -Once support is added, version `v0.10.0` or above of `rkt` will be required. + ```hcl + config { + volumes = ["/path/on/host:/path/in/container"] + } + ``` ## Client Requirements @@ -87,15 +92,24 @@ The `trust_prefix` must be accessible by the node running Nomad. This can be an internal source, private to your cluster, but it must be reachable by the client over HTTP. +## Client Configuration + +The `rkt` driver has the following [client configuration +options](/docs/agent/config.html#options): + +* `rkt.volumes.enabled`: Defaults to `false`. Allows tasks to bind host paths + (`volumes`) inside their container. Disabled by default as it removes the + isolation between containers' data. + ## Client Attributes The `rkt` driver will set the following client attributes: * `driver.rkt` - Set to `1` if rkt is found on the host node. Nomad determines -this by executing `rkt version` on the host and parsing the output -* `driver.rkt.version` - Version of `rkt` eg: `0.8.1`. Note that the minimum required -version is `0.14.0` -* `driver.rkt.appc.version` - Version of `appc` that `rkt` is using eg: `0.8.1` + this by executing `rkt version` on the host and parsing the output +* `driver.rkt.version` - Version of `rkt` eg: `1.1.0`. Note that the minimum required + version is `1.0.0` +* `driver.rkt.appc.version` - Version of `appc` that `rkt` is using eg: `1.1.0` Here is an example of using these properties in a job file: @@ -105,7 +119,7 @@ job "docs" { constraint { attribute = "${driver.rkt.version}" operator = ">" - value = "0.8" + value = "1.2" } } ```