diff options
-rw-r--r-- | cmd/kpod/common.go | 2 | ||||
-rw-r--r-- | libkpod/config.go | 2 | ||||
-rw-r--r-- | libpod/options.go | 21 |
3 files changed, 18 insertions, 7 deletions
diff --git a/cmd/kpod/common.go b/cmd/kpod/common.go index 774215479..046ea4509 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), libpod.WithCNIDirs(config.NetworkDir, config.PluginDir)) + return libpod.NewRuntime(libpod.WithStorageConfig(options), libpod.WithConmonPath(config.Conmon), libpod.WithOCIRuntime(config.Runtime), libpod.WithCNIConfigDir(config.NetworkDir)) } func shutdownStores() { diff --git a/libkpod/config.go b/libkpod/config.go index b95ff18ca..7b929b79e 100644 --- a/libkpod/config.go +++ b/libkpod/config.go @@ -19,7 +19,7 @@ const ( seccompProfilePath = "/etc/crio/seccomp.json" apparmorProfileName = "crio-default" cniConfigDir = "/etc/cni/net.d/" - cniBinDir = "/opt/cni/bin/" + cniBinDir = "/usr/libexec/cni/" cgroupManager = "" //oci.CgroupfsCgroupsManager lockPath = "/run/crio.lock" containerExitsDir = "" //oci.ContainerExitsDir diff --git a/libpod/options.go b/libpod/options.go index 3020ef51a..8720c3639 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -251,16 +251,27 @@ func WithNoPivotRoot(noPivot bool) RuntimeOption { } } -// WithCNIDirs sets the CNI configuration and network plugin directories used by -// the CNI network plugins -func WithCNIDirs(cniConfigDir, cniPluginDir string) RuntimeOption { +// WithCNIConfigDir sets the CNI configuration directory +func WithCNIConfigDir(dir string) RuntimeOption { return func(rt *Runtime) error { if rt.valid { return ErrRuntimeFinalized } - rt.config.CNIConfigDir = cniConfigDir - rt.config.CNIPluginDir = cniPluginDir + rt.config.CNIConfigDir = dir + + return nil + } +} + +// WithCNIPluginDir sets the CNI plugins directory +func WithCNIPluginDir(dir string) RuntimeOption { + return func(rt *Runtime) error { + if rt.valid { + return ErrRuntimeFinalized + } + + rt.config.CNIPluginDir = dir return nil } |