move ocicni from vendors to pkg/

Signed-off-by: Rajat Chopra <rchopra@redhat.com>
This commit is contained in:
Rajat Chopra 2017-01-19 16:36:21 -05:00
parent 89369c1eae
commit c04040fa95
8 changed files with 13 additions and 8 deletions

View File

@ -66,7 +66,6 @@ clone git github.com/docker/docker master
clone git github.com/urfave/cli v1.19.1
clone git github.com/opencontainers/runtime-tools master
clone git github.com/tchap/go-patricia v2.2.6
clone git github.com/rajatchopra/ocicni master
clone git github.com/containernetworking/cni master
clone git k8s.io/kubernetes 550f8be73aac92c7c23b1783d3db17f8660019f6 https://github.com/kubernetes/kubernetes
clone git k8s.io/apimachinery master https://github.com/kubernetes/apimachinery

View File

@ -31,6 +31,8 @@ type cniNetwork struct {
CNIConfig libcni.CNI
}
// InitCNI takes the plugin directory and cni directories where the cni files should be searched for
// Returns a valid plugin object and any error
func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
plugin := probeNetworkPluginsWithVendorCNIDirPrefix(pluginDir, cniDirs, "")
var err error
@ -52,9 +54,7 @@ func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
t := time.NewTimer(10 * time.Second)
for {
plugin.syncNetworkConfig()
select {
case <-t.C:
}
<-t.C
}
}()
return plugin, nil

View File

@ -1,13 +1,19 @@
package ocicni
const (
// DefaultInterfaceName is the string to be used for the interface name inside the net namespace
DefaultInterfaceName = "eth0"
CNIPluginName = "cni"
DefaultNetDir = "/etc/cni/net.d"
DefaultCNIDir = "/opt/cni/bin"
// CNIPluginName is the default name of the plugin
CNIPluginName = "cni"
// DefaultNetDir is the place to look for CNI Network
DefaultNetDir = "/etc/cni/net.d"
// DefaultCNIDir is the place to look for cni config files
DefaultCNIDir = "/opt/cni/bin"
// VendorCNIDirTemplate is the template for looking up vendor specific cni config/executable files
VendorCNIDirTemplate = "%s/opt/%s/bin"
)
// CNIPlugin is the interface that needs to be implemented by a plugin
type CNIPlugin interface {
// Name returns the plugin's name. This will be used when searching
// for a plugin by name, e.g.

View File

@ -14,12 +14,12 @@ import (
"github.com/docker/docker/pkg/registrar"
"github.com/docker/docker/pkg/truncindex"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/kubernetes-incubator/cri-o/pkg/ocicni"
"github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/kubernetes-incubator/cri-o/server/apparmor"
"github.com/kubernetes-incubator/cri-o/server/seccomp"
"github.com/opencontainers/runc/libcontainer/label"
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/rajatchopra/ocicni"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)