pkg/config: turn CNIPluginDirs into attributedstring.Slice
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
parent
318bae8a6a
commit
67a73c7cc6
|
|
@ -181,7 +181,7 @@ func getCniInterface(conf *config.Config) (types.ContainerNetwork, error) {
|
|||
}
|
||||
return cni.NewCNINetworkInterface(&cni.InitConfig{
|
||||
CNIConfigDir: confDir,
|
||||
CNIPluginDirs: conf.Network.CNIPluginDirs,
|
||||
CNIPluginDirs: conf.Network.CNIPluginDirs.Get(),
|
||||
RunDir: conf.Engine.TmpDir,
|
||||
DefaultNetwork: conf.Network.DefaultNetwork,
|
||||
DefaultSubnet: conf.Network.DefaultSubnet,
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ type NetworkConfig struct {
|
|||
NetworkBackend string `toml:"network_backend,omitempty"`
|
||||
|
||||
// CNIPluginDirs is where CNI plugin binaries are stored.
|
||||
CNIPluginDirs []string `toml:"cni_plugin_dirs,omitempty"`
|
||||
CNIPluginDirs attributedstring.Slice `toml:"cni_plugin_dirs,omitempty"`
|
||||
|
||||
// NetavarkPluginDirs is a list of directories which contain netavark plugins.
|
||||
NetavarkPluginDirs []string `toml:"netavark_plugin_dirs,omitempty"`
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var _ = Describe("Config Local", func() {
|
|||
file.Close()
|
||||
defer os.Remove(tmpfile)
|
||||
defConf.Network.NetworkConfigDir = tmpfile
|
||||
defConf.Network.CNIPluginDirs = []string{}
|
||||
defConf.Network.CNIPluginDirs.Values = []string{}
|
||||
|
||||
// When
|
||||
err = defConf.Network.Validate()
|
||||
|
|
@ -51,7 +51,7 @@ var _ = Describe("Config Local", func() {
|
|||
|
||||
// Given
|
||||
defConf.Network.NetworkConfigDir = validDirPath
|
||||
defConf.Network.CNIPluginDirs = []string{invalidPath}
|
||||
defConf.Network.CNIPluginDirs.Values = []string{invalidPath}
|
||||
|
||||
// When
|
||||
err = defConf.Network.Validate()
|
||||
|
|
@ -72,7 +72,7 @@ var _ = Describe("Config Local", func() {
|
|||
defer os.RemoveAll(validDirPath)
|
||||
// Given
|
||||
defConf.Network.NetworkConfigDir = validDirPath
|
||||
defConf.Network.CNIPluginDirs = []string{validDirPath}
|
||||
defConf.Network.CNIPluginDirs.Values = []string{validDirPath}
|
||||
|
||||
net, _ := types.ParseCIDR("10.0.0.0/24")
|
||||
defConf.Network.DefaultSubnetPools = []SubnetPool{
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ image_copy_tmp_dir="storage"`
|
|||
gomega.Expect(defaultConfig.Containers.Env.Values).To(gomega.BeEquivalentTo(envs))
|
||||
gomega.Expect(defaultConfig.Containers.Mounts.Values).To(gomega.BeEquivalentTo(mounts))
|
||||
gomega.Expect(defaultConfig.Containers.PidsLimit).To(gomega.BeEquivalentTo(2048))
|
||||
gomega.Expect(defaultConfig.Network.CNIPluginDirs).To(gomega.Equal(pluginDirs))
|
||||
gomega.Expect(defaultConfig.Network.CNIPluginDirs.Get()).To(gomega.Equal(pluginDirs))
|
||||
gomega.Expect(defaultConfig.Network.NetavarkPluginDirs).To(gomega.Equal([]string{"/usr/netavark"}))
|
||||
gomega.Expect(defaultConfig.Engine.NumLocks).To(gomega.BeEquivalentTo(2048))
|
||||
gomega.Expect(defaultConfig.Engine.OCIRuntimes).To(gomega.Equal(OCIRuntimeMap))
|
||||
|
|
@ -430,7 +430,7 @@ image_copy_tmp_dir="storage"`
|
|||
gomega.Expect(config.Containers.PidsLimit).To(gomega.BeEquivalentTo(2048))
|
||||
gomega.Expect(config.Containers.Env.Values).To(gomega.BeEquivalentTo(envs))
|
||||
gomega.Expect(config.Containers.UserNS).To(gomega.BeEquivalentTo(""))
|
||||
gomega.Expect(config.Network.CNIPluginDirs).To(gomega.Equal(DefaultCNIPluginDirs))
|
||||
gomega.Expect(config.Network.CNIPluginDirs.Get()).To(gomega.Equal(DefaultCNIPluginDirs))
|
||||
gomega.Expect(config.Network.NetavarkPluginDirs).To(gomega.Equal(DefaultNetavarkPluginDirs))
|
||||
gomega.Expect(config.Engine.NumLocks).To(gomega.BeEquivalentTo(2048))
|
||||
gomega.Expect(config.Engine.OCIRuntimes["runc"]).To(gomega.Equal(OCIRuntimeMap["runc"]))
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ func defaultConfig() (*Config, error) {
|
|||
DefaultSubnetPools: DefaultSubnetPools,
|
||||
DefaultRootlessNetworkCmd: "slirp4netns",
|
||||
DNSBindPort: 0,
|
||||
CNIPluginDirs: DefaultCNIPluginDirs,
|
||||
CNIPluginDirs: attributedstring.Slice{Values: DefaultCNIPluginDirs},
|
||||
NetavarkPluginDirs: DefaultNetavarkPluginDirs,
|
||||
},
|
||||
Engine: *defaultEngineConfig,
|
||||
|
|
|
|||
Loading…
Reference in New Issue