Merge pull request #329 from rajatchopra/master

move ocicni from vendors to pkg
This commit is contained in:
Mrunal Patel 2017-01-19 15:26:06 -08:00 committed by GitHub
commit f085c1cb6d
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/urfave/cli v1.19.1
clone git github.com/opencontainers/runtime-tools master clone git github.com/opencontainers/runtime-tools master
clone git github.com/tchap/go-patricia v2.2.6 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 github.com/containernetworking/cni master
clone git k8s.io/kubernetes 550f8be73aac92c7c23b1783d3db17f8660019f6 https://github.com/kubernetes/kubernetes clone git k8s.io/kubernetes 550f8be73aac92c7c23b1783d3db17f8660019f6 https://github.com/kubernetes/kubernetes
clone git k8s.io/apimachinery master https://github.com/kubernetes/apimachinery clone git k8s.io/apimachinery master https://github.com/kubernetes/apimachinery

View file

@ -31,6 +31,8 @@ type cniNetwork struct {
CNIConfig libcni.CNI 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) { func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
plugin := probeNetworkPluginsWithVendorCNIDirPrefix(pluginDir, cniDirs, "") plugin := probeNetworkPluginsWithVendorCNIDirPrefix(pluginDir, cniDirs, "")
var err error var err error
@ -52,9 +54,7 @@ func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
t := time.NewTimer(10 * time.Second) t := time.NewTimer(10 * time.Second)
for { for {
plugin.syncNetworkConfig() plugin.syncNetworkConfig()
select { <-t.C
case <-t.C:
}
} }
}() }()
return plugin, nil return plugin, nil

View file

@ -1,13 +1,19 @@
package ocicni package ocicni
const ( const (
// DefaultInterfaceName is the string to be used for the interface name inside the net namespace
DefaultInterfaceName = "eth0" DefaultInterfaceName = "eth0"
CNIPluginName = "cni" // CNIPluginName is the default name of the plugin
DefaultNetDir = "/etc/cni/net.d" CNIPluginName = "cni"
DefaultCNIDir = "/opt/cni/bin" // 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" VendorCNIDirTemplate = "%s/opt/%s/bin"
) )
// CNIPlugin is the interface that needs to be implemented by a plugin
type CNIPlugin interface { type CNIPlugin interface {
// Name returns the plugin's name. This will be used when searching // Name returns the plugin's name. This will be used when searching
// for a plugin by name, e.g. // 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/registrar"
"github.com/docker/docker/pkg/truncindex" "github.com/docker/docker/pkg/truncindex"
"github.com/kubernetes-incubator/cri-o/oci" "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/pkg/storage"
"github.com/kubernetes-incubator/cri-o/server/apparmor" "github.com/kubernetes-incubator/cri-o/server/apparmor"
"github.com/kubernetes-incubator/cri-o/server/seccomp" "github.com/kubernetes-incubator/cri-o/server/seccomp"
"github.com/opencontainers/runc/libcontainer/label" "github.com/opencontainers/runc/libcontainer/label"
rspec "github.com/opencontainers/runtime-spec/specs-go" rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/rajatchopra/ocicni"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
) )