Update go-cni to v1.1.2
Fixes panic when exec is nil Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
1
vendor/github.com/containerd/go-cni/README.md
generated
vendored
1
vendor/github.com/containerd/go-cni/README.md
generated
vendored
@@ -11,6 +11,7 @@ A generic CNI library to provide APIs for CNI plugin interactions. The library p
|
||||
- Setup networks for container namespace
|
||||
- Remove networks from container namespace
|
||||
- Query status of CNI network plugin initialization
|
||||
- Check verifies the network is still in desired state
|
||||
|
||||
go-cni aims to support plugins that implement [Container Network Interface](https://github.com/containernetworking/cni)
|
||||
|
||||
|
||||
36
vendor/github.com/containerd/go-cni/cni.go
generated
vendored
36
vendor/github.com/containerd/go-cni/cni.go
generated
vendored
@@ -19,12 +19,15 @@ package cni
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
cnilibrary "github.com/containernetworking/cni/libcni"
|
||||
"github.com/containernetworking/cni/pkg/invoke"
|
||||
"github.com/containernetworking/cni/pkg/types"
|
||||
types100 "github.com/containernetworking/cni/pkg/types/100"
|
||||
"github.com/containernetworking/cni/pkg/version"
|
||||
)
|
||||
|
||||
type CNI interface {
|
||||
@@ -32,6 +35,8 @@ type CNI interface {
|
||||
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
|
||||
// Check checks if the network is still in desired state
|
||||
Check(ctx context.Context, id string, path string, opts ...NamespaceOpts) error
|
||||
// Load loads the cni network config
|
||||
Load(opts ...Opt) error
|
||||
// Status checks the status of the cni initialization
|
||||
@@ -84,9 +89,15 @@ func defaultCNIConfig() *libcni {
|
||||
pluginMaxConfNum: DefaultMaxConfNum,
|
||||
prefix: DefaultPrefix,
|
||||
},
|
||||
cniConfig: &cnilibrary.CNIConfig{
|
||||
Path: []string{DefaultCNIDir},
|
||||
},
|
||||
cniConfig: cnilibrary.NewCNIConfig(
|
||||
[]string{
|
||||
DefaultCNIDir,
|
||||
},
|
||||
&invoke.DefaultExec{
|
||||
RawExec: &invoke.RawExec{Stderr: os.Stderr},
|
||||
PluginDecoder: version.PluginDecoder{},
|
||||
},
|
||||
),
|
||||
networkCount: 1,
|
||||
}
|
||||
}
|
||||
@@ -217,6 +228,25 @@ func (c *libcni) Remove(ctx context.Context, id string, path string, opts ...Nam
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check checks if the network is still in desired state
|
||||
func (c *libcni) Check(ctx context.Context, id string, path string, opts ...NamespaceOpts) error {
|
||||
if err := c.Status(); err != nil {
|
||||
return err
|
||||
}
|
||||
ns, err := newNamespace(id, path, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, network := range c.Networks() {
|
||||
err := network.Check(ctx, ns)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetConfig returns a copy of the CNI plugin configurations as parsed by CNI
|
||||
func (c *libcni) GetConfig() *ConfigResult {
|
||||
c.RLock()
|
||||
|
||||
4
vendor/github.com/containerd/go-cni/namespace.go
generated
vendored
4
vendor/github.com/containerd/go-cni/namespace.go
generated
vendored
@@ -41,6 +41,10 @@ func (n *Network) Remove(ctx context.Context, ns *Namespace) error {
|
||||
return n.cni.DelNetworkList(ctx, n.config, ns.config(n.ifName))
|
||||
}
|
||||
|
||||
func (n *Network) Check(ctx context.Context, ns *Namespace) error {
|
||||
return n.cni.CheckNetworkList(ctx, n.config, ns.config(n.ifName))
|
||||
}
|
||||
|
||||
type Namespace struct {
|
||||
id string
|
||||
path string
|
||||
|
||||
Reference in New Issue
Block a user