Merge pull request #285 from sameo/topic/network-bats

Add Initial networking BATs
This commit is contained in:
Antonio Murdaca 2016-12-20 16:49:04 +01:00 committed by GitHub
commit ac7943c707
8 changed files with 196 additions and 2 deletions

View file

@ -17,6 +17,8 @@ const (
seccompProfilePath = "/etc/ocid/seccomp.json"
apparmorProfileName = "ocid-default"
cgroupManager = "cgroupfs"
cniConfigDir = "/etc/cni/net.d/"
cniBinDir = "/opt/cni/bin/"
)
var commentedConfigTemplate = template.Must(template.New("config").Parse(`
@ -81,6 +83,17 @@ cgroup_manager = "{{ .CgroupManager }}"
# pause is the path to the statically linked pause container binary, used
# as the entrypoint for infra containers.
pause = "{{ .Pause }}"
# The "ocid.network" table contains settings pertaining to the
# management of CNI plugins.
[ocid.network]
# network_dir is is where CNI network configuration
# files are stored.
network_dir = "{{ .NetworkDir }}"
# plugin_dir is is where CNI plugin binaries are stored.
plugin_dir = "{{ .PluginDir }}"
`))
// TODO: Currently ImageDir isn't really used, so we haven't added it to this
@ -113,6 +126,10 @@ func DefaultConfig() *server.Config {
Pause: pausePath,
ImageDir: filepath.Join(ocidRoot, "store"),
},
NetworkConfig: server.NetworkConfig{
NetworkDir: cniConfigDir,
PluginDir: cniBinDir,
},
}
}

View file

@ -66,6 +66,12 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
if ctx.GlobalIsSet("cgroup-manager") {
config.CgroupManager = ctx.GlobalString("cgroup-manager")
}
if ctx.GlobalIsSet("cni-config-dir") {
config.NetworkDir = ctx.GlobalString("cni-config-dir")
}
if ctx.GlobalIsSet("cni-plugin-dir") {
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
}
return nil
}
@ -157,6 +163,14 @@ func main() {
Name: "cgroup-manager",
Usage: "cgroup manager (cgroupfs or systemd)",
},
cli.StringFlag{
Name: "cni-config-dir",
Usage: "CNI configuration files directory",
},
cli.StringFlag{
Name: "cni-plugin-dir",
Usage: "CNI plugin binaries directory",
},
}
// remove once https://github.com/urfave/cli/pull/544 lands