diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-02 07:23:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 07:23:23 -0800 |
commit | 426178a49991106ffe222f12cc42409ae78dd257 (patch) | |
tree | 6e7fd302124480888ed4a53b51b02bed6525117a | |
parent | c7267329bffa12df14c37e2d083c0c91ad7bb102 (diff) | |
parent | 14d5bd16457142884797af01bbffd8525f0021bd (diff) | |
download | podman-426178a49991106ffe222f12cc42409ae78dd257.tar.gz podman-426178a49991106ffe222f12cc42409ae78dd257.tar.bz2 podman-426178a49991106ffe222f12cc42409ae78dd257.zip |
Merge pull request #9561 from Luap99/update-ocicni
Bump github.com/cri-o/ocicni to latest master
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go | 33 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
4 files changed, 29 insertions, 12 deletions
@@ -18,7 +18,7 @@ require ( github.com/containers/psgo v1.5.2 github.com/containers/storage v1.25.0 github.com/coreos/go-systemd/v22 v22.1.0 - github.com/cri-o/ocicni v0.2.1-0.20201204103948-b6cbe99b9756 + github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf github.com/cyphar/filepath-securejoin v0.2.2 github.com/davecgh/go-spew v1.1.1 github.com/docker/distribution v2.7.1+incompatible @@ -133,8 +133,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cri-o/ocicni v0.2.1-0.20201204103948-b6cbe99b9756 h1:4T3rzrCSvMgVTR+fm526d+Ed0BurAHGjOaaNFOVoK6E= -github.com/cri-o/ocicni v0.2.1-0.20201204103948-b6cbe99b9756/go.mod h1:vingr1ztOAzP2WyTgGbpMov9dFhbjNxdLtDv0+PhAvY= +github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf h1:k2wrxBiBseRfOD7h+9fABEuesABBQuUuW5fWwpARbeI= +github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf/go.mod h1:vingr1ztOAzP2WyTgGbpMov9dFhbjNxdLtDv0+PhAvY= github.com/cyphar/filepath-securejoin v0.2.2 h1:jCwT2GTP+PY5nBz3c/YL5PAIbusElVrPujOBSCj8xRg= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= diff --git a/vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go b/vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go index d9c1d37db..b38340126 100644 --- a/vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go +++ b/vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go @@ -198,6 +198,11 @@ func InitCNI(defaultNetName string, confDir string, binDirs ...string) (CNIPlugi return initCNI(nil, "", defaultNetName, confDir, binDirs...) } +// InitCNIWithCache works like InitCNI except that it takes the cni cache directory as third param. +func InitCNIWithCache(defaultNetName, confDir, cacheDir string, binDirs ...string) (CNIPlugin, error) { + return initCNI(nil, cacheDir, defaultNetName, confDir, binDirs...) +} + // Internal function to allow faking out exec functions for testing func initCNI(exec cniinvoke.Exec, cacheDir, defaultNetName string, confDir string, binDirs ...string) (CNIPlugin, error) { if confDir == "" { @@ -208,7 +213,7 @@ func initCNI(exec cniinvoke.Exec, cacheDir, defaultNetName string, confDir strin } plugin := &cniNetworkPlugin{ - cniConfig: libcni.NewCNIConfig(binDirs, exec), + cniConfig: libcni.NewCNIConfigWithCacheDir(binDirs, cacheDir, exec), defaultNetName: netName{ name: defaultNetName, // If defaultNetName is not assigned in initialization, @@ -275,13 +280,19 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork if strings.HasSuffix(confFile, ".conflist") { confList, err = libcni.ConfListFromFile(confFile) if err != nil { - logrus.Errorf("Error loading CNI config list file %s: %v", confFile, err) + // do not log ENOENT errors + if !os.IsNotExist(err) { + logrus.Errorf("Error loading CNI config list file %s: %v", confFile, err) + } continue } } else { conf, err := libcni.ConfFromFile(confFile) if err != nil { - logrus.Errorf("Error loading CNI config file %s: %v", confFile, err) + // do not log ENOENT errors + if !os.IsNotExist(err) { + logrus.Errorf("Error loading CNI config file %s: %v", confFile, err) + } continue } if conf.Network.Type == "" { @@ -468,7 +479,7 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache } } - rt, err := buildCNIRuntimeConf(plugin.cacheDir, podNetwork, ifName, podNetwork.RuntimeConfig[network.Name]) + rt, err := buildCNIRuntimeConf(podNetwork, ifName, podNetwork.RuntimeConfig[network.Name]) if err != nil { logrus.Errorf("error building CNI runtime config: %v", err) return err @@ -489,8 +500,15 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache if cniNet == nil { cniNet, err = plugin.getNetwork(network.Name) if err != nil { - logrus.Errorf(err.Error()) - return err + // try to load the networks again + if err2 := plugin.syncNetworkConfig(); err2 != nil { + logrus.Error(err2) + return err + } + cniNet, err = plugin.getNetwork(network.Name) + if err != nil { + return err + } } } @@ -775,13 +793,12 @@ func (network *cniNetwork) deleteFromNetwork(ctx context.Context, rt *libcni.Run return nil } -func buildCNIRuntimeConf(cacheDir string, podNetwork *PodNetwork, ifName string, runtimeConfig RuntimeConfig) (*libcni.RuntimeConf, error) { +func buildCNIRuntimeConf(podNetwork *PodNetwork, ifName string, runtimeConfig RuntimeConfig) (*libcni.RuntimeConf, error) { logrus.Infof("Got pod network %+v", podNetwork) rt := &libcni.RuntimeConf{ ContainerID: podNetwork.ID, NetNS: podNetwork.NetNS, - CacheDir: cacheDir, IfName: ifName, Args: [][2]string{ {"IgnoreUnknown", "1"}, diff --git a/vendor/modules.txt b/vendor/modules.txt index f99e3045e..5e2139c9f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -235,7 +235,7 @@ github.com/coreos/go-systemd/v22/dbus github.com/coreos/go-systemd/v22/internal/dlopen github.com/coreos/go-systemd/v22/journal github.com/coreos/go-systemd/v22/sdjournal -# github.com/cri-o/ocicni v0.2.1-0.20201204103948-b6cbe99b9756 +# github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf github.com/cri-o/ocicni/pkg/ocicni # github.com/cyphar/filepath-securejoin v0.2.2 github.com/cyphar/filepath-securejoin |