Merge pull request #5355 from thaJeztah/bump_cni
go.mod: github.com/containerd/go-cni v1.0.2
This commit is contained in:
commit
0867c99b1a
2
go.mod
2
go.mod
@ -11,7 +11,7 @@ require (
|
||||
github.com/containerd/console v1.0.2
|
||||
github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e
|
||||
github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d
|
||||
github.com/containerd/go-cni v1.0.1
|
||||
github.com/containerd/go-cni v1.0.2
|
||||
github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0
|
||||
github.com/containerd/imgcrypt v1.1.1
|
||||
github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14
|
||||
|
3
go.sum
3
go.sum
@ -137,8 +137,9 @@ github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZ
|
||||
github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0=
|
||||
github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d h1:u6sWqdNGAy7+O8qG/r1dqdnZE7IdEjteK3WGuvbfreo=
|
||||
github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4=
|
||||
github.com/containerd/go-cni v1.0.1 h1:VXr2EkOPD0v1gu7CKfof6XzEIDzsE/dI9yj/W7PSWLs=
|
||||
github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU=
|
||||
github.com/containerd/go-cni v1.0.2 h1:YbJAhpTevL2v6u8JC1NhCYRwf+3Vzxcc5vGnYoJ7VeE=
|
||||
github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk=
|
||||
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
|
||||
github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
|
||||
github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g=
|
||||
|
@ -82,7 +82,7 @@ github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e h1:6JKvHHt39
|
||||
github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
|
||||
github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d h1:u6sWqdNGAy7+O8qG/r1dqdnZE7IdEjteK3WGuvbfreo=
|
||||
github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4=
|
||||
github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU=
|
||||
github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk=
|
||||
github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g=
|
||||
github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0 h1:e+50zk22gvHLJKe8+d+xSMyA88PPQk/XfWuUw1BdnPA=
|
||||
github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok=
|
||||
@ -352,11 +352,9 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
|
||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
|
@ -36,11 +36,11 @@ type cniNetConfSyncer struct {
|
||||
watcher *fsnotify.Watcher
|
||||
confDir string
|
||||
netPlugin cni.CNI
|
||||
loadOpts []cni.CNIOpt
|
||||
loadOpts []cni.Opt
|
||||
}
|
||||
|
||||
// newCNINetConfSyncer creates cni network conf syncer.
|
||||
func newCNINetConfSyncer(confDir string, netPlugin cni.CNI, loadOpts []cni.CNIOpt) (*cniNetConfSyncer, error) {
|
||||
func newCNINetConfSyncer(confDir string, netPlugin cni.CNI, loadOpts []cni.Opt) (*cniNetConfSyncer, error) {
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create fsnotify watcher")
|
||||
|
@ -544,7 +544,7 @@ func (c *criService) getSandboxRuntime(config *runtime.PodSandboxConfig, runtime
|
||||
return handler, nil
|
||||
}
|
||||
|
||||
func logDebugCNIResult(ctx context.Context, sandboxID string, result *cni.CNIResult) {
|
||||
func logDebugCNIResult(ctx context.Context, sandboxID string, result *cni.Result) {
|
||||
if logrus.GetLevel() < logrus.DebugLevel {
|
||||
return
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ type SandboxInfo struct {
|
||||
RuntimeOptions interface{} `json:"runtimeOptions"`
|
||||
Config *runtime.PodSandboxConfig `json:"config"`
|
||||
RuntimeSpec *runtimespec.Spec `json:"runtimeSpec"`
|
||||
CNIResult *cni.CNIResult `json:"cniResult"`
|
||||
CNIResult *cni.Result `json:"cniResult"`
|
||||
}
|
||||
|
||||
// toCRISandboxInfo converts internal container object information to CRI sandbox status response info map.
|
||||
|
@ -73,6 +73,6 @@ func (c *criService) initPlatform() error {
|
||||
}
|
||||
|
||||
// cniLoadOptions returns cni load options for the linux.
|
||||
func (c *criService) cniLoadOptions() []cni.CNIOpt {
|
||||
return []cni.CNIOpt{cni.WithLoNetwork, cni.WithDefaultConf}
|
||||
func (c *criService) cniLoadOptions() []cni.Opt {
|
||||
return []cni.Opt{cni.WithLoNetwork, cni.WithDefaultConf}
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ func (c *criService) initPlatform() error {
|
||||
}
|
||||
|
||||
// cniLoadOptions returns cni load options for the linux.
|
||||
func (c *criService) cniLoadOptions() []cni.CNIOpt {
|
||||
return []cni.CNIOpt{}
|
||||
func (c *criService) cniLoadOptions() []cni.Opt {
|
||||
return []cni.Opt{}
|
||||
}
|
||||
|
@ -47,6 +47,6 @@ func (c *criService) initPlatform() error {
|
||||
}
|
||||
|
||||
// cniLoadOptions returns cni load options for the windows.
|
||||
func (c *criService) cniLoadOptions() []cni.CNIOpt {
|
||||
return []cni.CNIOpt{cni.WithDefaultConf}
|
||||
func (c *criService) cniLoadOptions() []cni.Opt {
|
||||
return []cni.Opt{cni.WithDefaultConf}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func NewFakeCNIPlugin() *FakeCNIPlugin {
|
||||
}
|
||||
|
||||
// Setup setups the network of PodSandbox.
|
||||
func (f *FakeCNIPlugin) Setup(ctx context.Context, id, path string, opts ...cni.NamespaceOpts) (*cni.CNIResult, error) {
|
||||
func (f *FakeCNIPlugin) Setup(ctx context.Context, id, path string, opts ...cni.NamespaceOpts) (*cni.Result, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ func (f *FakeCNIPlugin) Status() error {
|
||||
}
|
||||
|
||||
// Load loads the network config.
|
||||
func (f *FakeCNIPlugin) Load(opts ...cni.CNIOpt) error {
|
||||
func (f *FakeCNIPlugin) Load(opts ...cni.Opt) error {
|
||||
return f.LoadErr
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ type Metadata struct {
|
||||
// RuntimeHandler is the runtime handler name of the pod.
|
||||
RuntimeHandler string
|
||||
// CNIresult resulting configuration for attached network namespace interfaces
|
||||
CNIResult *cni.CNIResult
|
||||
CNIResult *cni.Result
|
||||
// ProcessLabel is the SELinux process label for the container
|
||||
ProcessLabel string
|
||||
}
|
||||
|
23
vendor/github.com/containerd/go-cni/.golangci.yml
generated
vendored
Normal file
23
vendor/github.com/containerd/go-cni/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
linters:
|
||||
enable:
|
||||
- structcheck
|
||||
- varcheck
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- gofmt
|
||||
- goimports
|
||||
- golint
|
||||
- ineffassign
|
||||
- vet
|
||||
- unused
|
||||
- misspell
|
||||
disable:
|
||||
- errcheck
|
||||
|
||||
# FIXME: re-enable after fixing GoDoc in this repository
|
||||
#issues:
|
||||
# include:
|
||||
# - EXC0002
|
||||
|
||||
run:
|
||||
timeout: 2m
|
24
vendor/github.com/containerd/go-cni/.travis.yml
generated
vendored
24
vendor/github.com/containerd/go-cni/.travis.yml
generated
vendored
@ -1,24 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.13.x
|
||||
- 1.14.x
|
||||
- tip
|
||||
|
||||
go_import_path: github.com/containerd/go-cni
|
||||
|
||||
install:
|
||||
- go get -d
|
||||
- env GO111MODULE=off go get -u github.com/vbatts/git-validation
|
||||
- env GO111MODULE=off go get -u github.com/kunalkushwaha/ltag
|
||||
|
||||
before_script:
|
||||
- pushd ..; git clone https://github.com/containerd/project; popd
|
||||
|
||||
script:
|
||||
- DCO_VERBOSITY=-q ../project/script/validate/dco
|
||||
- ../project/script/validate/fileheader ../project/
|
||||
- env GO111MODULE=on ../project/script/validate/vendor
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
7
vendor/github.com/containerd/go-cni/README.md
generated
vendored
7
vendor/github.com/containerd/go-cni/README.md
generated
vendored
@ -1,7 +1,10 @@
|
||||
[](https://travis-ci.org/containerd/go-cni) [](https://godoc.org/github.com/containerd/go-cni)
|
||||
|
||||
# go-cni
|
||||
|
||||
[](https://pkg.go.dev/github.com/containerd/go-cni)
|
||||
[](https://github.com/containerd/go-cni/actions?query=workflow%3ACI)
|
||||
[](https://codecov.io/gh/containerd/go-cni)
|
||||
[](https://goreportcard.com/report/github.com/containerd/go-cni)
|
||||
|
||||
A generic CNI library to provide APIs for CNI plugin interactions. The library provides APIs to:
|
||||
|
||||
- Load CNI network config from different sources
|
||||
|
22
vendor/github.com/containerd/go-cni/cni.go
generated
vendored
22
vendor/github.com/containerd/go-cni/cni.go
generated
vendored
@ -30,11 +30,11 @@ import (
|
||||
|
||||
type CNI interface {
|
||||
// Setup setup the network for the namespace
|
||||
Setup(ctx context.Context, id string, path string, opts ...NamespaceOpts) (*CNIResult, error)
|
||||
Setup(ctx context.Context, id string, path string, opts ...NamespaceOpts) (*Result, error)
|
||||
// Remove tears down the network of the namespace.
|
||||
Remove(ctx context.Context, id string, path string, opts ...NamespaceOpts) error
|
||||
// Load loads the cni network config
|
||||
Load(opts ...CNIOpt) error
|
||||
Load(opts ...Opt) error
|
||||
// Status checks the status of the cni initialization
|
||||
Status() error
|
||||
// GetConfig returns a copy of the CNI plugin configurations as parsed by CNI
|
||||
@ -93,7 +93,7 @@ func defaultCNIConfig() *libcni {
|
||||
}
|
||||
|
||||
// New creates a new libcni instance.
|
||||
func New(config ...CNIOpt) (CNI, error) {
|
||||
func New(config ...Opt) (CNI, error) {
|
||||
cni := defaultCNIConfig()
|
||||
var err error
|
||||
for _, c := range config {
|
||||
@ -105,7 +105,7 @@ func New(config ...CNIOpt) (CNI, error) {
|
||||
}
|
||||
|
||||
// Load loads the latest config from cni config files.
|
||||
func (c *libcni) Load(opts ...CNIOpt) error {
|
||||
func (c *libcni) Load(opts ...Opt) error {
|
||||
var err error
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
@ -139,8 +139,8 @@ func (c *libcni) Networks() []*Network {
|
||||
return append([]*Network{}, c.networks...)
|
||||
}
|
||||
|
||||
// Setup setups the network in the namespace
|
||||
func (c *libcni) Setup(ctx context.Context, id string, path string, opts ...NamespaceOpts) (*CNIResult, error) {
|
||||
// Setup setups the network in the namespace and returns a Result
|
||||
func (c *libcni) Setup(ctx context.Context, id string, path string, opts ...NamespaceOpts) (*Result, error) {
|
||||
if err := c.Status(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -148,6 +148,14 @@ func (c *libcni) Setup(ctx context.Context, id string, path string, opts ...Name
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result, err := c.attachNetworks(ctx, ns)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.createResult(result)
|
||||
}
|
||||
|
||||
func (c *libcni) attachNetworks(ctx context.Context, ns *Namespace) ([]*current.Result, error) {
|
||||
var results []*current.Result
|
||||
for _, network := range c.Networks() {
|
||||
r, err := network.Attach(ctx, ns)
|
||||
@ -156,7 +164,7 @@ func (c *libcni) Setup(ctx context.Context, id string, path string, opts ...Name
|
||||
}
|
||||
results = append(results, r)
|
||||
}
|
||||
return c.GetCNIResultFromResults(results)
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// Remove removes the network config from the namespace
|
||||
|
34
vendor/github.com/containerd/go-cni/deprecated.go
generated
vendored
Normal file
34
vendor/github.com/containerd/go-cni/deprecated.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cni
|
||||
|
||||
import "github.com/containernetworking/cni/pkg/types/current"
|
||||
|
||||
// Deprecated: use cni.Opt instead
|
||||
type CNIOpt = Opt //nolint: golint // type name will be used as cni.CNIOpt by other packages, and that stutters
|
||||
|
||||
// Deprecated: use cni.Result instead
|
||||
type CNIResult = Result //nolint: golint // type name will be used as cni.CNIResult by other packages, and that stutters
|
||||
|
||||
// GetCNIResultFromResults creates a Result from the given slice of current.Result,
|
||||
// adding structured data containing the interface configuration for each of the
|
||||
// interfaces created in the namespace. It returns an error if validation of
|
||||
// results fails, or if a network could not be found.
|
||||
// Deprecated: do not use
|
||||
func (c *libcni) GetCNIResultFromResults(results []*current.Result) (*Result, error) {
|
||||
return c.createResult(results)
|
||||
}
|
4
vendor/github.com/containerd/go-cni/go.mod
generated
vendored
4
vendor/github.com/containerd/go-cni/go.mod
generated
vendored
@ -6,9 +6,7 @@ require (
|
||||
github.com/onsi/ginkgo v1.10.3 // indirect
|
||||
github.com/onsi/gomega v1.7.1 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f // indirect
|
||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d
|
||||
github.com/stretchr/testify v1.6.1
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
11
vendor/github.com/containerd/go-cni/go.sum
generated
vendored
11
vendor/github.com/containerd/go-cni/go.sum
generated
vendored
@ -1,5 +1,6 @@
|
||||
github.com/containernetworking/cni v0.8.0 h1:BT9lpgGoH4jw3lFC7Odz2prU5ruiYKcgAjMCbgybcKI=
|
||||
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
@ -17,10 +18,10 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f h1:SrOsK2rwonEK9IsdNEU61zcTdKW68/PuV9wuHHpqngk=
|
||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d h1:YCdGqZILKLGzbyEYbdau30JBEXbKaKYmkBDU5JUW3D0=
|
||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
@ -37,3 +38,5 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
23
vendor/github.com/containerd/go-cni/opts.go
generated
vendored
23
vendor/github.com/containerd/go-cni/opts.go
generated
vendored
@ -24,11 +24,12 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type CNIOpt func(c *libcni) error
|
||||
// Opt sets options for a CNI instance
|
||||
type Opt func(c *libcni) error
|
||||
|
||||
// WithInterfacePrefix sets the prefix for network interfaces
|
||||
// e.g. eth or wlan
|
||||
func WithInterfacePrefix(prefix string) CNIOpt {
|
||||
func WithInterfacePrefix(prefix string) Opt {
|
||||
return func(c *libcni) error {
|
||||
c.prefix = prefix
|
||||
return nil
|
||||
@ -37,7 +38,7 @@ func WithInterfacePrefix(prefix string) CNIOpt {
|
||||
|
||||
// WithPluginDir can be used to set the locations of
|
||||
// the cni plugin binaries
|
||||
func WithPluginDir(dirs []string) CNIOpt {
|
||||
func WithPluginDir(dirs []string) Opt {
|
||||
return func(c *libcni) error {
|
||||
c.pluginDirs = dirs
|
||||
c.cniConfig = &cnilibrary.CNIConfig{Path: dirs}
|
||||
@ -47,7 +48,7 @@ func WithPluginDir(dirs []string) CNIOpt {
|
||||
|
||||
// WithPluginConfDir can be used to configure the
|
||||
// cni configuration directory.
|
||||
func WithPluginConfDir(dir string) CNIOpt {
|
||||
func WithPluginConfDir(dir string) Opt {
|
||||
return func(c *libcni) error {
|
||||
c.pluginConfDir = dir
|
||||
return nil
|
||||
@ -56,7 +57,7 @@ func WithPluginConfDir(dir string) CNIOpt {
|
||||
|
||||
// WithPluginMaxConfNum can be used to configure the
|
||||
// max cni plugin config file num.
|
||||
func WithPluginMaxConfNum(max int) CNIOpt {
|
||||
func WithPluginMaxConfNum(max int) Opt {
|
||||
return func(c *libcni) error {
|
||||
c.pluginMaxConfNum = max
|
||||
return nil
|
||||
@ -66,7 +67,7 @@ func WithPluginMaxConfNum(max int) CNIOpt {
|
||||
// WithMinNetworkCount can be used to configure the
|
||||
// minimum networks to be configured and initialized
|
||||
// for the status to report success. By default its 1.
|
||||
func WithMinNetworkCount(count int) CNIOpt {
|
||||
func WithMinNetworkCount(count int) Opt {
|
||||
return func(c *libcni) error {
|
||||
c.networkCount = count
|
||||
return nil
|
||||
@ -94,13 +95,13 @@ func WithLoNetwork(c *libcni) error {
|
||||
|
||||
// WithConf can be used to load config directly
|
||||
// from byte.
|
||||
func WithConf(bytes []byte) CNIOpt {
|
||||
func WithConf(bytes []byte) Opt {
|
||||
return WithConfIndex(bytes, 0)
|
||||
}
|
||||
|
||||
// WithConfIndex can be used to load config directly
|
||||
// from byte and set the interface name's index.
|
||||
func WithConfIndex(bytes []byte, index int) CNIOpt {
|
||||
func WithConfIndex(bytes []byte, index int) Opt {
|
||||
return func(c *libcni) error {
|
||||
conf, err := cnilibrary.ConfFromBytes(bytes)
|
||||
if err != nil {
|
||||
@ -122,7 +123,7 @@ func WithConfIndex(bytes []byte, index int) CNIOpt {
|
||||
// WithConfFile can be used to load network config
|
||||
// from an .conf file. Supported with absolute fileName
|
||||
// with path only.
|
||||
func WithConfFile(fileName string) CNIOpt {
|
||||
func WithConfFile(fileName string) Opt {
|
||||
return func(c *libcni) error {
|
||||
conf, err := cnilibrary.ConfFromFile(fileName)
|
||||
if err != nil {
|
||||
@ -144,7 +145,7 @@ func WithConfFile(fileName string) CNIOpt {
|
||||
|
||||
// WithConfListBytes can be used to load network config list directly
|
||||
// from byte
|
||||
func WithConfListBytes(bytes []byte) CNIOpt {
|
||||
func WithConfListBytes(bytes []byte) Opt {
|
||||
return func(c *libcni) error {
|
||||
confList, err := cnilibrary.ConfListFromBytes(bytes)
|
||||
if err != nil {
|
||||
@ -163,7 +164,7 @@ func WithConfListBytes(bytes []byte) CNIOpt {
|
||||
// WithConfListFile can be used to load network config
|
||||
// from an .conflist file. Supported with absolute fileName
|
||||
// with path only.
|
||||
func WithConfListFile(fileName string) CNIOpt {
|
||||
func WithConfListFile(fileName string) Opt {
|
||||
return func(c *libcni) error {
|
||||
confList, err := cnilibrary.ConfListFromFile(fileName)
|
||||
if err != nil {
|
||||
|
33
vendor/github.com/containerd/go-cni/result.go
generated
vendored
33
vendor/github.com/containerd/go-cni/result.go
generated
vendored
@ -29,7 +29,17 @@ type IPConfig struct {
|
||||
Gateway net.IP
|
||||
}
|
||||
|
||||
type CNIResult struct {
|
||||
// Result contains the network information returned by CNI.Setup
|
||||
//
|
||||
// a) Interfaces list. Depending on the plugin, this can include the sandbox
|
||||
// (eg, container or hypervisor) interface name and/or the host interface
|
||||
// name, the hardware addresses of each interface, and details about the
|
||||
// sandbox (if any) the interface is in.
|
||||
// b) IP configuration assigned to each interface. The IPv4 and/or IPv6 addresses,
|
||||
// gateways, and routes assigned to sandbox and/or host interfaces.
|
||||
// c) DNS information. Dictionary that includes DNS information for nameservers,
|
||||
// domain, search domains and options.
|
||||
type Result struct {
|
||||
Interfaces map[string]*Config
|
||||
DNS []types.DNS
|
||||
Routes []*types.Route
|
||||
@ -41,23 +51,14 @@ type Config struct {
|
||||
Sandbox string
|
||||
}
|
||||
|
||||
// GetCNIResultFromResults returns a structured data containing the
|
||||
// interface configuration for each of the interfaces created in the namespace.
|
||||
// Conforms with
|
||||
// Result:
|
||||
// a) Interfaces list. Depending on the plugin, this can include the sandbox
|
||||
// (eg, container or hypervisor) interface name and/or the host interface
|
||||
// name, the hardware addresses of each interface, and details about the
|
||||
// sandbox (if any) the interface is in.
|
||||
// b) IP configuration assigned to each interface. The IPv4 and/or IPv6 addresses,
|
||||
// gateways, and routes assigned to sandbox and/or host interfaces.
|
||||
// c) DNS information. Dictionary that includes DNS information for nameservers,
|
||||
// domain, search domains and options.
|
||||
func (c *libcni) GetCNIResultFromResults(results []*current.Result) (*CNIResult, error) {
|
||||
// createResult creates a Result from the given slice of current.Result, adding
|
||||
// structured data containing the interface configuration for each of the
|
||||
// interfaces created in the namespace. It returns an error if validation of
|
||||
// results fails, or if a network could not be found.
|
||||
func (c *libcni) createResult(results []*current.Result) (*Result, error) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
r := &CNIResult{
|
||||
r := &Result{
|
||||
Interfaces: make(map[string]*Config),
|
||||
}
|
||||
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -82,7 +82,7 @@ github.com/containerd/continuity/testutil/loopback
|
||||
# github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d
|
||||
## explicit
|
||||
github.com/containerd/fifo
|
||||
# github.com/containerd/go-cni v1.0.1
|
||||
# github.com/containerd/go-cni v1.0.2
|
||||
## explicit
|
||||
github.com/containerd/go-cni
|
||||
# github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0
|
||||
|
Loading…
Reference in New Issue
Block a user