From 23b7042dd575d0fe4352a6ae614b7c8b34aa4fde Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Mon, 4 Dec 2017 14:12:30 -0500 Subject: [PATCH] add ability to specify user for rkt --- CHANGELOG.md | 1 + client/driver/rkt.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf493a9435..51d6229eedc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ IMPROVEMENTS: * driver/docker: Adds support for `ulimit` and `sysctl` options [GH-3568] * driver/docker: Adds support for StopTimeout (set to the same value as kill_timeout [GH-3601] + * driver/rkt: Add support for passing through user [GH-3612] * driver/qemu: Support graceful shutdowns on unix platforms [GH-3411] * template: Updated to consul template 0.19.4 [GH-3543] * core/enterprise: Return 501 status code in Nomad Pro for Premium end points diff --git a/client/driver/rkt.go b/client/driver/rkt.go index 206d5f94fc0..4af31126a06 100644 --- a/client/driver/rkt.go +++ b/client/driver/rkt.go @@ -569,6 +569,11 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (*StartResponse, } + // If a user has been specified for the task, pass it through to the user + if task.User != "" { + prepareArgs = append(prepareArgs, fmt.Sprintf("--user=%s", task.User)) + } + // Add user passed arguments. if len(driverConfig.Args) != 0 { parsed := ctx.TaskEnv.ParseAndReplace(driverConfig.Args)