Merge pull request #599 from Random-Liu/update-ocicni
Update ocicni to main stream.
This commit is contained in:
commit
2acd6c1a5c
@ -14,9 +14,6 @@ write_files:
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
# cri-containerd requires the existence of cni config directory.
|
||||
# TODO(random-liu): Eliminate the requirement in ocicni.
|
||||
ExecStartPre=/bin/mkdir -p /etc/cni/net.d
|
||||
ExecStartPre=/bin/mkdir -p /home/cri-containerd
|
||||
ExecStartPre=/bin/mount --bind /home/cri-containerd /home/cri-containerd
|
||||
ExecStartPre=/bin/mount -o remount,exec /home/cri-containerd
|
||||
|
@ -88,6 +88,7 @@ curl https://storage.googleapis.com/cri-containerd-release/cri-containerd-${VERS
|
||||
```
|
||||
## Step 2: Install CRI-Containerd
|
||||
If you are using systemd, just simply unpack the tarball to the root directory:
|
||||
<!-- TODO(random-liu): Remove cni directory operations after we deprecate v1.0.0-beta.1 -->
|
||||
```bash
|
||||
sudo tar -C / -xzf cri-containerd-${VERSION}.linux-amd64.tar.gz
|
||||
sudo mkdir -p /opt/cni/bin/
|
||||
|
@ -8,7 +8,7 @@ github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
||||
github.com/containernetworking/cni v0.6.0
|
||||
github.com/containernetworking/plugins v0.6.0
|
||||
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
|
||||
github.com/cri-o/ocicni 6164672aa473f2a5ac279adf79eb722e29f11838 https://github.com/Random-Liu/ocicni.git
|
||||
github.com/cri-o/ocicni 9b451e26eb7c694d564991fbf44f77d0afb9b03c
|
||||
github.com/davecgh/go-spew v1.1.0
|
||||
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
|
||||
github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
|
||||
|
21
vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go
generated
vendored
21
vendor/github.com/cri-o/ocicni/pkg/ocicni/ocicni.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
cnitypes "github.com/containernetworking/cni/pkg/types"
|
||||
@ -16,8 +15,6 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const monitorNetDirPeriod = 1 * time.Second
|
||||
|
||||
type cniNetworkPlugin struct {
|
||||
loNetwork *cniNetwork
|
||||
|
||||
@ -103,13 +100,6 @@ func (plugin *cniNetworkPlugin) podUnlock(podNetwork PodNetwork) {
|
||||
}
|
||||
|
||||
func (plugin *cniNetworkPlugin) monitorNetDir() {
|
||||
if _, err := os.Stat(plugin.pluginDir); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
logrus.Errorf("failed to stat %q: %v", plugin.pluginDir, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
logrus.Infof("Found CNI config directory %q", plugin.pluginDir)
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
logrus.Errorf("could not create new watcher %v", err)
|
||||
@ -183,10 +173,13 @@ func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go func() {
|
||||
plugin.monitorNetDir()
|
||||
time.Sleep(monitorNetDirPeriod)
|
||||
}()
|
||||
// Ensure plugin directory exists, because the following monitoring logic
|
||||
// relies on that.
|
||||
if err := os.MkdirAll(pluginDir, 0755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go plugin.monitorNetDir()
|
||||
|
||||
return plugin, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user