Skip to content

Commit

Permalink
Merge pull request #645 from achanda/mount_dirs
Browse files Browse the repository at this point in the history
Mount task and alloc dirs in the rkt driver
  • Loading branch information
dadgar committed Jan 5, 2016
2 parents 468cb18 + 9ebc143 commit 7db04aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/driver/rkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
// Inject the environment variables.
envVars := TaskEnvironmentVariables(ctx, task)

// Clear the task directories as they are not currently supported.
envVars.ClearTaskLocalDir()
envVars.ClearAllocDir()
envVars.SetAllocDir(filepath.Join("/", allocdir.SharedAllocName))
envVars.SetTaskLocalDir(filepath.Join("/", allocdir.TaskLocal))

for k, v := range envVars.Map() {
cmdArgs = append(cmdArgs, fmt.Sprintf("--set-env=%v=%v", k, v))
Expand All @@ -162,6 +161,13 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
// Append the run command.
cmdArgs = append(cmdArgs, "run", "--mds-register=false", img)

// Mount allc and task dirs
local, ok := ctx.AllocDir.TaskDirs[task.Name]
if !ok {
return nil, fmt.Errorf("Failed to find task local directory: %v", task.Name)
}
cmdArgs = append(cmdArgs, fmt.Sprintf("--volume %s,kind=empty,readOnly=false,source=%s --mount volume=data,target=%s", task.Name, local, ctx.AllocDir.SharedDir))

// Check if the user has overriden the exec command.
if execCmd, ok := task.Config["command"]; ok {
cmdArgs = append(cmdArgs, fmt.Sprintf("--exec=%v", execCmd))
Expand Down

0 comments on commit 7db04aa

Please sign in to comment.