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]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=yes
|
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/mkdir -p /home/cri-containerd
|
||||||
ExecStartPre=/bin/mount --bind /home/cri-containerd /home/cri-containerd
|
ExecStartPre=/bin/mount --bind /home/cri-containerd /home/cri-containerd
|
||||||
ExecStartPre=/bin/mount -o remount,exec /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
|
## Step 2: Install CRI-Containerd
|
||||||
If you are using systemd, just simply unpack the tarball to the root directory:
|
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
|
```bash
|
||||||
sudo tar -C / -xzf cri-containerd-${VERSION}.linux-amd64.tar.gz
|
sudo tar -C / -xzf cri-containerd-${VERSION}.linux-amd64.tar.gz
|
||||||
sudo mkdir -p /opt/cni/bin/
|
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/cni v0.6.0
|
||||||
github.com/containernetworking/plugins v0.6.0
|
github.com/containernetworking/plugins v0.6.0
|
||||||
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
|
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/davecgh/go-spew v1.1.0
|
||||||
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
|
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
|
||||||
github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
|
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"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/containernetworking/cni/libcni"
|
"github.com/containernetworking/cni/libcni"
|
||||||
cnitypes "github.com/containernetworking/cni/pkg/types"
|
cnitypes "github.com/containernetworking/cni/pkg/types"
|
||||||
@ -16,8 +15,6 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const monitorNetDirPeriod = 1 * time.Second
|
|
||||||
|
|
||||||
type cniNetworkPlugin struct {
|
type cniNetworkPlugin struct {
|
||||||
loNetwork *cniNetwork
|
loNetwork *cniNetwork
|
||||||
|
|
||||||
@ -103,13 +100,6 @@ func (plugin *cniNetworkPlugin) podUnlock(podNetwork PodNetwork) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *cniNetworkPlugin) monitorNetDir() {
|
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()
|
watcher, err := fsnotify.NewWatcher()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("could not create new watcher %v", err)
|
logrus.Errorf("could not create new watcher %v", err)
|
||||||
@ -183,10 +173,13 @@ func InitCNI(pluginDir string, cniDirs ...string) (CNIPlugin, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
// Ensure plugin directory exists, because the following monitoring logic
|
||||||
plugin.monitorNetDir()
|
// relies on that.
|
||||||
time.Sleep(monitorNetDirPeriod)
|
if err := os.MkdirAll(pluginDir, 0755); err != nil {
|
||||||
}()
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
go plugin.monitorNetDir()
|
||||||
|
|
||||||
return plugin, nil
|
return plugin, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user