Skip to content

Commit

Permalink
Merge pull request #2282 from Starnop/cni-upgrade
Browse files Browse the repository at this point in the history
upgrade: upgrade the vendor of cri-o/ocicni
  • Loading branch information
allencloud authored Oct 15, 2018
2 parents 5d904f1 + 36f37ac commit 6cbbd01
Show file tree
Hide file tree
Showing 47 changed files with 4,076 additions and 294 deletions.
21 changes: 19 additions & 2 deletions cri/ocicni/cni_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/alibaba/pouch/cri/config"

cnicurrent "github.com/containernetworking/cni/pkg/types/current"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/sirupsen/logrus"
)
Expand All @@ -32,7 +33,8 @@ func NewCniManager(cfg *config.Config) (CniMgr, error) {
}
}

plugin, err := ocicni.InitCNI(networkPluginConfDir, networkPluginBinDir)
// If defaultNetName is empty, a network name will be automatically selected be used as the default CNI network.
plugin, err := ocicni.InitCNI("", networkPluginConfDir, networkPluginBinDir)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -87,11 +89,26 @@ func (c *CniManager) GetPodNetworkStatus(netnsPath string) (string, error) {
NetNS: netnsPath,
}

ip, err := c.plugin.GetPodNetworkStatus(podNetwork)
var err error
results, err := c.plugin.GetPodNetworkStatus(podNetwork)
if err != nil {
return "", fmt.Errorf("failed to get pod network status: %v", err)
}

if len(results) == 0 {
return "", fmt.Errorf("failed to get pod network status for nil result")
}

result, ok := results[0].(*cnicurrent.Result)
if !ok {
return "", fmt.Errorf("failed to get pod network status for wrong result: %+v", results[0])
}

if len(result.IPs) == 0 {
return "", fmt.Errorf("failed to get pod network status for nil IP")
}

ip := result.IPs[0].Address.IP.String()
return ip, nil
}

Expand Down
4 changes: 4 additions & 0 deletions vendor/github.com/containernetworking/cni/CODE-OF-CONDUCT.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions vendor/github.com/containernetworking/cni/CONTRIBUTING.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions vendor/github.com/containernetworking/cni/CONVENTIONS.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions vendor/github.com/containernetworking/cni/DCO

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions vendor/github.com/containernetworking/cni/Documentation/cnitool.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6cbbd01

Please sign in to comment.