@@ -29,6 +29,7 @@ import (
2929 "github.com/hashicorp/go-hclog"
3030 log "github.com/hashicorp/go-hclog"
3131 "github.com/hashicorp/nomad/client/stats"
32+ "github.com/hashicorp/nomad/client/taskenv"
3233 "github.com/hashicorp/nomad/drivers/shared/eventer"
3334 "github.com/hashicorp/nomad/plugins/base"
3435 "github.com/hashicorp/nomad/plugins/drivers"
@@ -118,7 +119,7 @@ var (
118119 capabilities = & drivers.Capabilities {
119120 SendSignals : true ,
120121 Exec : true ,
121- FSIsolation : drivers .FSIsolationNone ,
122+ FSIsolation : drivers .FSIsolationImage ,
122123 NetIsolationModes : []drivers.NetIsolationMode {drivers .NetIsolationModeGroup , drivers .NetIsolationModeTask },
123124 }
124125)
@@ -385,18 +386,19 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
385386 if skipOverride (key ) {
386387 continue
387388 }
388- if key == "NOMAD_SECRETS_DIR" {
389- containerConfig .SecretsDir = val
390- }
391- if key == "NOMAD_TASK_DIR" {
392- containerConfig .TaskDir = val
393- }
394- if key == "NOMAD_ALLOC_DIR" {
395- containerConfig .AllocDir = val
396- }
397389 containerConfig .Env = append (containerConfig .Env , fmt .Sprintf ("%s=%s" , key , val ))
398390 }
399391
392+ // Setup source paths for secrets, task and alloc directories.
393+ containerConfig .SecretsDirSrc = cfg .TaskDir ().SecretsDir
394+ containerConfig .TaskDirSrc = cfg .TaskDir ().LocalDir
395+ containerConfig .AllocDirSrc = cfg .TaskDir ().SharedAllocDir
396+
397+ // Setup destination paths for secrets, task and alloc directories.
398+ containerConfig .SecretsDirDest = cfg .Env [taskenv .SecretsDir ]
399+ containerConfig .TaskDirDest = cfg .Env [taskenv .TaskLocalDir ]
400+ containerConfig .AllocDirDest = cfg .Env [taskenv .AllocDir ]
401+
400402 containerConfig .ContainerSnapshotName = fmt .Sprintf ("%s-snapshot" , containerName )
401403 if cfg .NetworkIsolation != nil && cfg .NetworkIsolation .Path != "" {
402404 containerConfig .NetworkNamespacePath = cfg .NetworkIsolation .Path
0 commit comments