Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,27 @@ func WithInterfacePrefix(prefix string) Opt {
}
}

// WithPluginDirsAndCacheDir can be used to set the locations of
// the cni plugin binaries and cni cache dir
// cacheDir: to use default provided in libcni set value to empty string
func WithPluginDirsAndCacheDir(pluginDirs []string, cacheDir string) Opt {
return func(c *libcni) error {
c.pluginDirs = pluginDirs
c.cniConfig = cnilibrary.NewCNIConfigWithCacheDir(
pluginDirs,
cacheDir,
&invoke.DefaultExec{
RawExec: &invoke.RawExec{Stderr: os.Stderr},
PluginDecoder: version.PluginDecoder{},
},
)
return nil
}
}

// WithPluginDir can be used to set the locations of
// the cni plugin binaries
// Deprecated: use WithPluginDirsAndCacheDir instead
func WithPluginDir(dirs []string) Opt {
return func(c *libcni) error {
c.pluginDirs = dirs
Expand Down
Loading