Skip to content

Commit

Permalink
upgrade: upgrade CNI
Browse files Browse the repository at this point in the history
Signed-off-by: Starnop <[email protected]>
  • Loading branch information
starnop committed Oct 10, 2018
1 parent 4002e93 commit 191dfca
Show file tree
Hide file tree
Showing 47 changed files with 4,074 additions and 295 deletions.
20 changes: 17 additions & 3 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,7 @@ func NewCniManager(cfg *config.Config) (CniMgr, error) {
}
}

plugin, err := ocicni.InitCNI(networkPluginConfDir, networkPluginBinDir)
plugin, err := ocicni.InitCNI("", networkPluginConfDir, networkPluginBinDir)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -87,12 +88,25 @@ 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)
}

return ip, nil
if len(results) > 0 {
// NOTE: only get the first IP of the first network at present
// TODO: support multiple network
if result, ok := results[0].(*cnicurrent.Result); ok {
if len(result.IPs) > 0 {
ip := result.IPs[0].Address.IP.String()
return ip, nil
}
return "", fmt.Errorf("failed to get pod network status for nil IP")
}
return "", fmt.Errorf("failed to get pod network status for wrong result: %+v", results[0])
}
return "", fmt.Errorf("failed to get pod network status for nil result")
}

// Status returns error if the network plugin is in error state.
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 191dfca

Please sign in to comment.