mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Merge pull request #9561 from Luap99/update-ocicni
Bump github.com/cri-o/ocicni to latest master
This commit is contained in:
2
go.mod
2
go.mod
@ -18,7 +18,7 @@ require (
|
|||||||
github.com/containers/psgo v1.5.2
|
github.com/containers/psgo v1.5.2
|
||||||
github.com/containers/storage v1.25.0
|
github.com/containers/storage v1.25.0
|
||||||
github.com/coreos/go-systemd/v22 v22.1.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/cyphar/filepath-securejoin v0.2.2
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/docker/distribution v2.7.1+incompatible
|
github.com/docker/distribution v2.7.1+incompatible
|
||||||
|
4
go.sum
4
go.sum
@ -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.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
||||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
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.20210301205850-541cf7c703cf h1:k2wrxBiBseRfOD7h+9fABEuesABBQuUuW5fWwpARbeI=
|
||||||
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/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 h1:jCwT2GTP+PY5nBz3c/YL5PAIbusElVrPujOBSCj8xRg=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
|
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=
|
github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ=
|
||||||
|
33
vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go
generated
vendored
33
vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go
generated
vendored
@ -198,6 +198,11 @@ func InitCNI(defaultNetName string, confDir string, binDirs ...string) (CNIPlugi
|
|||||||
return initCNI(nil, "", defaultNetName, confDir, binDirs...)
|
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
|
// Internal function to allow faking out exec functions for testing
|
||||||
func initCNI(exec cniinvoke.Exec, cacheDir, defaultNetName string, confDir string, binDirs ...string) (CNIPlugin, error) {
|
func initCNI(exec cniinvoke.Exec, cacheDir, defaultNetName string, confDir string, binDirs ...string) (CNIPlugin, error) {
|
||||||
if confDir == "" {
|
if confDir == "" {
|
||||||
@ -208,7 +213,7 @@ func initCNI(exec cniinvoke.Exec, cacheDir, defaultNetName string, confDir strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin := &cniNetworkPlugin{
|
plugin := &cniNetworkPlugin{
|
||||||
cniConfig: libcni.NewCNIConfig(binDirs, exec),
|
cniConfig: libcni.NewCNIConfigWithCacheDir(binDirs, cacheDir, exec),
|
||||||
defaultNetName: netName{
|
defaultNetName: netName{
|
||||||
name: defaultNetName,
|
name: defaultNetName,
|
||||||
// If defaultNetName is not assigned in initialization,
|
// 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") {
|
if strings.HasSuffix(confFile, ".conflist") {
|
||||||
confList, err = libcni.ConfListFromFile(confFile)
|
confList, err = libcni.ConfListFromFile(confFile)
|
||||||
if err != nil {
|
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
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conf, err := libcni.ConfFromFile(confFile)
|
conf, err := libcni.ConfFromFile(confFile)
|
||||||
if err != nil {
|
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
|
continue
|
||||||
}
|
}
|
||||||
if conf.Network.Type == "" {
|
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 {
|
if err != nil {
|
||||||
logrus.Errorf("error building CNI runtime config: %v", err)
|
logrus.Errorf("error building CNI runtime config: %v", err)
|
||||||
return err
|
return err
|
||||||
@ -489,8 +500,15 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache
|
|||||||
if cniNet == nil {
|
if cniNet == nil {
|
||||||
cniNet, err = plugin.getNetwork(network.Name)
|
cniNet, err = plugin.getNetwork(network.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf(err.Error())
|
// try to load the networks again
|
||||||
return err
|
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
|
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)
|
logrus.Infof("Got pod network %+v", podNetwork)
|
||||||
|
|
||||||
rt := &libcni.RuntimeConf{
|
rt := &libcni.RuntimeConf{
|
||||||
ContainerID: podNetwork.ID,
|
ContainerID: podNetwork.ID,
|
||||||
NetNS: podNetwork.NetNS,
|
NetNS: podNetwork.NetNS,
|
||||||
CacheDir: cacheDir,
|
|
||||||
IfName: ifName,
|
IfName: ifName,
|
||||||
Args: [][2]string{
|
Args: [][2]string{
|
||||||
{"IgnoreUnknown", "1"},
|
{"IgnoreUnknown", "1"},
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -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/internal/dlopen
|
||||||
github.com/coreos/go-systemd/v22/journal
|
github.com/coreos/go-systemd/v22/journal
|
||||||
github.com/coreos/go-systemd/v22/sdjournal
|
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/cri-o/ocicni/pkg/ocicni
|
||||||
# github.com/cyphar/filepath-securejoin v0.2.2
|
# github.com/cyphar/filepath-securejoin v0.2.2
|
||||||
github.com/cyphar/filepath-securejoin
|
github.com/cyphar/filepath-securejoin
|
||||||
|
Reference in New Issue
Block a user