diff --git a/hack/vendor.sh b/hack/vendor.sh index 3fbf3f51..8a5815b2 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -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 diff --git a/vendor/github.com/rajatchopra/ocicni/LICENSE b/pkg/ocicni/LICENSE similarity index 100% rename from vendor/github.com/rajatchopra/ocicni/LICENSE rename to pkg/ocicni/LICENSE diff --git a/vendor/github.com/rajatchopra/ocicni/README.md b/pkg/ocicni/README.md similarity index 100% rename from vendor/github.com/rajatchopra/ocicni/README.md rename to pkg/ocicni/README.md diff --git a/vendor/github.com/rajatchopra/ocicni/noop.go b/pkg/ocicni/noop.go similarity index 100% rename from vendor/github.com/rajatchopra/ocicni/noop.go rename to pkg/ocicni/noop.go diff --git a/vendor/github.com/rajatchopra/ocicni/ocicni.go b/pkg/ocicni/ocicni.go similarity index 97% rename from vendor/github.com/rajatchopra/ocicni/ocicni.go rename to pkg/ocicni/ocicni.go index 7086d0f7..3e6244a9 100644 --- a/vendor/github.com/rajatchopra/ocicni/ocicni.go +++ b/pkg/ocicni/ocicni.go @@ -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 diff --git a/vendor/github.com/rajatchopra/ocicni/types.go b/pkg/ocicni/types.go similarity index 64% rename from vendor/github.com/rajatchopra/ocicni/types.go rename to pkg/ocicni/types.go index 120f46f9..4483a203 100644 --- a/vendor/github.com/rajatchopra/ocicni/types.go +++ b/pkg/ocicni/types.go @@ -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. diff --git a/vendor/github.com/rajatchopra/ocicni/util.go b/pkg/ocicni/util.go similarity index 100% rename from vendor/github.com/rajatchopra/ocicni/util.go rename to pkg/ocicni/util.go diff --git a/server/server.go b/server/server.go index 979b3ea3..4df2089b 100644 --- a/server/server.go +++ b/server/server.go @@ -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" )