aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/kpod/common.go5
-rw-r--r--cmd/kpod/main.go4
-rw-r--r--test/helpers.bash19
3 files changed, 17 insertions, 11 deletions
diff --git a/cmd/kpod/common.go b/cmd/kpod/common.go
index 339f56fdd..774215479 100644
--- a/cmd/kpod/common.go
+++ b/cmd/kpod/common.go
@@ -50,7 +50,7 @@ func getRuntime(c *cli.Context) (*libpod.Runtime, error) {
options.GraphDriverName = config.Storage
options.GraphDriverOptions = config.StorageOptions
- return libpod.NewRuntime(libpod.WithStorageConfig(options), libpod.WithConmonPath(config.Conmon), libpod.WithOCIRuntime(config.Runtime))
+ return libpod.NewRuntime(libpod.WithStorageConfig(options), libpod.WithConmonPath(config.Conmon), libpod.WithOCIRuntime(config.Runtime), libpod.WithCNIDirs(config.NetworkDir, config.PluginDir))
}
func shutdownStores() {
@@ -98,6 +98,9 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) {
if c.GlobalIsSet("runtime") {
config.Runtime = c.GlobalString("runtime")
}
+ if c.GlobalIsSet("cni-config-dir") {
+ config.NetworkDir = c.GlobalString("cni-config-dir")
+ }
return config, nil
}
diff --git a/cmd/kpod/main.go b/cmd/kpod/main.go
index 90a4d1d7f..a2a81c8b6 100644
--- a/cmd/kpod/main.go
+++ b/cmd/kpod/main.go
@@ -109,6 +109,10 @@ func main() {
}
app.Flags = []cli.Flag{
cli.StringFlag{
+ Name: "cni-config-dir",
+ Usage: "path of the configuration directory for CNI networks",
+ },
+ cli.StringFlag{
Name: "config, c",
Usage: "path of a config file detailing container server configuration options",
},
diff --git a/test/helpers.bash b/test/helpers.bash
index 2117716ec..b14802afc 100644
--- a/test/helpers.bash
+++ b/test/helpers.bash
@@ -104,13 +104,12 @@ if [ -e /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
filelabel=$(awk -F'"' '/^file.*=.*/ {print $2}' /etc/selinux/${SELINUXTYPE}/contexts/lxc_contexts)
chcon -R ${filelabel} $TESTDIR
fi
-CRIO_CONFIG="$TESTDIR/crio.conf"
-CRIO_CNI_CONFIG="$TESTDIR/cni/net.d/"
-CRIO_CNI_PLUGIN=${CRIO_CNI_PLUGIN:-/opt/cni/bin/}
+LIBPOD_CNI_CONFIG="$TESTDIR/cni/net.d/"
+LIBPOD_CNI_PLUGIN=${LIBPOD_CNI_PLUGIN:-/opt/cni/bin/}
POD_CIDR="10.88.0.0/16"
POD_CIDR_MASK="10.88.*.*"
-KPOD_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTIONS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY} --conmon ${CONMON_BINARY}"
+KPOD_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTIONS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY} --conmon ${CONMON_BINARY} --cni-config-dir ${LIBPOD_CNI_CONFIG}"
cp "$CONMON_BINARY" "$TESTDIR/conmon"
@@ -195,8 +194,8 @@ function is_apparmor_enabled() {
}
function prepare_network_conf() {
- mkdir -p $CRIO_CNI_CONFIG
- cat >$CRIO_CNI_CONFIG/10-crio.conf <<-EOF
+ mkdir -p $LIBPOD_CNI_CONFIG
+ cat >$LIBPOD_CNI_CONFIG/10-crio.conf <<-EOF
{
"cniVersion": "0.2.0",
"name": "crionet",
@@ -214,7 +213,7 @@ function prepare_network_conf() {
}
EOF
- cat >$CRIO_CNI_CONFIG/99-loopback.conf <<-EOF
+ cat >$LIBPOD_CNI_CONFIG/99-loopback.conf <<-EOF
{
"cniVersion": "0.2.0",
"type": "loopback"
@@ -225,8 +224,8 @@ EOF
}
function prepare_plugin_test_args_network_conf() {
- mkdir -p $CRIO_CNI_CONFIG
- cat >$CRIO_CNI_CONFIG/10-plugin-test-args.conf <<-EOF
+ mkdir -p $LIBPOD_CNI_CONFIG
+ cat >$LIBPOD_CNI_CONFIG/10-plugin-test-args.conf <<-EOF
{
"cniVersion": "0.2.0",
"name": "crionet_test_args",
@@ -295,7 +294,7 @@ function ping_pod_from_pod() {
function cleanup_network_conf() {
- rm -rf $CRIO_CNI_CONFIG
+ rm -rf $LIBPOD_CNI_CONFIG
echo 0
}