Skip to content

Commit

Permalink
Merge pull request #2 from kimitoboku/add_docker_mount_option
Browse files Browse the repository at this point in the history
Add mounts option for tinet spec.
  • Loading branch information
AkiRa committed Jan 19, 2020
2 parents 7b7db02 + cb832af commit 662cef0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type Node struct {
Image string `yaml:"image"`
Interfaces []Interface `yaml:"interfaces" mapstructure:"interfaces"`
Sysctls []Sysctl `yaml:"sysctls" mapstructure:"sysctls"`
Mounts []string `yaml:"mounts,flow"`
}

// Interface
Expand Down Expand Up @@ -367,6 +368,13 @@ func CreateNode(node Node) []string {
createNodeCmd += fmt.Sprintf("--sysctl %s ", sysctl.Sysctl)
}
}

if len(node.Mounts) != 0 {
for _, mount := range node.Mounts {
createNodeCmd += fmt.Sprintf("-v %s ", mount)
}
}

createNodeCmd += node.Image
} else if node.Type == "netns" {
createNodeCmd = fmt.Sprintf("ip netns add %s", node.Name)
Expand All @@ -377,6 +385,13 @@ func CreateNode(node Node) []string {
createNodeCmd += fmt.Sprintf("--sysctl %s ", sysctl.Sysctl)
}
}

if len(node.Mounts) != 0 {
for _, mount := range node.Mounts {
createNodeCmd += fmt.Sprintf("-v %s ", mount)
}
}

createNodeCmd += node.Image
} else {
// err := fmt.Errorf("unknown nodetype %s", node.Type)
Expand Down

0 comments on commit 662cef0

Please sign in to comment.