Update go-cni to v1.1.5

Signed-off-by: Michael Zappa <Michael.Zappa@stateless.net>
This commit is contained in:
Michael Zappa
2022-04-27 15:54:03 -06:00
parent cb84b5a1d2
commit 5d0730370d
9 changed files with 29 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ linters:
- unconvert
- gofmt
- goimports
- golint
- revive
- ineffassign
- vet
- unused

View File

@@ -19,10 +19,10 @@ package cni
import types100 "github.com/containernetworking/cni/pkg/types/100"
// Deprecated: use cni.Opt instead
type CNIOpt = Opt //nolint: golint // type name will be used as cni.CNIOpt by other packages, and that stutters
type CNIOpt = Opt //revive:disable // 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
type CNIResult = Result //revive:disable // type name will be used as cni.CNIResult by other packages, and that stutters
// GetCNIResultFromResults creates a Result from the given slice of types100.Result,
// adding structured data containing the interface configuration for each of the

View File

@@ -87,7 +87,7 @@ func WithMinNetworkCount(count int) Opt {
// network config.
func WithLoNetwork(c *libcni) error {
loConfig, _ := cnilibrary.ConfListFromBytes([]byte(`{
"cniVersion": "1.0.0",
"cniVersion": "0.3.1",
"name": "cni-loopback",
"plugins": [{
"type": "loopback"

View File

@@ -21,6 +21,8 @@ import (
"os"
"path/filepath"
"sort"
"github.com/containernetworking/cni/pkg/types"
)
type NotFoundError struct {
@@ -41,8 +43,8 @@ func (e NoConfigsFoundError) Error() string {
}
func ConfFromBytes(bytes []byte) (*NetworkConfig, error) {
conf := &NetworkConfig{Bytes: bytes}
if err := json.Unmarshal(bytes, &conf.Network); err != nil {
conf := &NetworkConfig{Bytes: bytes, Network: &types.NetConf{}}
if err := json.Unmarshal(bytes, conf.Network); err != nil {
return nil, fmt.Errorf("error parsing configuration: %w", err)
}
if conf.Network.Type == "" {

View File

@@ -86,8 +86,8 @@ func (*PluginDecoder) Decode(jsonBytes []byte) (PluginInfo, error) {
// minor, and micro numbers or returns an error
func ParseVersion(version string) (int, int, int, error) {
var major, minor, micro int
if version == "" {
return -1, -1, -1, fmt.Errorf("invalid version %q: the version is empty", version)
if version == "" { // special case: no version declared == v0.1.0
return 0, 1, 0, nil
}
parts := strings.Split(version, ".")