Merge pull request #4029 from containers/dependabot/go_modules/github.com/containernetworking/cni-1.1.1
build(deps): bump github.com/containernetworking/cni from 1.1.0 to 1.1.1
This commit is contained in:
commit
810658f2e8
2
go.mod
2
go.mod
|
|
@ -4,7 +4,7 @@ go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/containerd/containerd v1.6.4
|
github.com/containerd/containerd v1.6.4
|
||||||
github.com/containernetworking/cni v1.1.0
|
github.com/containernetworking/cni v1.1.1
|
||||||
github.com/containers/common v0.48.1-0.20220519181648-280c6f69fa82
|
github.com/containers/common v0.48.1-0.20220519181648-280c6f69fa82
|
||||||
github.com/containers/image/v5 v5.21.2-0.20220520105616-e594853d6471
|
github.com/containers/image/v5 v5.21.2-0.20220520105616-e594853d6471
|
||||||
github.com/containers/ocicrypt v1.1.4-0.20220428134531-566b808bdf6f
|
github.com/containers/ocicrypt v1.1.4-0.20220428134531-566b808bdf6f
|
||||||
|
|
|
||||||
3
go.sum
3
go.sum
|
|
@ -276,8 +276,9 @@ github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ
|
||||||
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||||
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||||
github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y=
|
github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y=
|
||||||
github.com/containernetworking/cni v1.1.0 h1:T00oIz4hef+/p9gpRZa57SnIN+QnbmAHBjbxaOSFo9U=
|
|
||||||
github.com/containernetworking/cni v1.1.0/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
|
github.com/containernetworking/cni v1.1.0/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
|
||||||
|
github.com/containernetworking/cni v1.1.1 h1:ky20T7c0MvKvbMOwS/FrlbNwjEoqJEUUYfsL4b0mc4k=
|
||||||
|
github.com/containernetworking/cni v1.1.1/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
|
||||||
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
|
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
|
||||||
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
||||||
github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNBDZcxSOplJT5ico8/FLE=
|
github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNBDZcxSOplJT5ico8/FLE=
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ package invoke
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
|
@ -33,6 +34,43 @@ type Exec interface {
|
||||||
Decode(jsonBytes []byte) (version.PluginInfo, error)
|
Decode(jsonBytes []byte) (version.PluginInfo, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plugin must return result in same version as specified in netconf; but
|
||||||
|
// for backwards compatibility reasons if the result version is empty use
|
||||||
|
// config version (rather than technically correct 0.1.0).
|
||||||
|
// https://github.com/containernetworking/cni/issues/895
|
||||||
|
func fixupResultVersion(netconf, result []byte) (string, []byte, error) {
|
||||||
|
versionDecoder := &version.ConfigDecoder{}
|
||||||
|
confVersion, err := versionDecoder.Decode(netconf)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var rawResult map[string]interface{}
|
||||||
|
if err := json.Unmarshal(result, &rawResult); err != nil {
|
||||||
|
return "", nil, fmt.Errorf("failed to unmarshal raw result: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manually decode Result version; we need to know whether its cniVersion
|
||||||
|
// is empty, while built-in decoders (correctly) substitute 0.1.0 for an
|
||||||
|
// empty version per the CNI spec.
|
||||||
|
if resultVerRaw, ok := rawResult["cniVersion"]; ok {
|
||||||
|
resultVer, ok := resultVerRaw.(string)
|
||||||
|
if ok && resultVer != "" {
|
||||||
|
return resultVer, result, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the cniVersion is not present or empty, assume the result is
|
||||||
|
// the same CNI spec version as the config
|
||||||
|
rawResult["cniVersion"] = confVersion
|
||||||
|
newBytes, err := json.Marshal(rawResult)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, fmt.Errorf("failed to remarshal fixed result: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return confVersion, newBytes, nil
|
||||||
|
}
|
||||||
|
|
||||||
// For example, a testcase could pass an instance of the following fakeExec
|
// For example, a testcase could pass an instance of the following fakeExec
|
||||||
// object to ExecPluginWithResult() to verify the incoming stdin and environment
|
// object to ExecPluginWithResult() to verify the incoming stdin and environment
|
||||||
// and provide a tailored response:
|
// and provide a tailored response:
|
||||||
|
|
@ -84,7 +122,12 @@ func ExecPluginWithResult(ctx context.Context, pluginPath string, netconf []byte
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return create.CreateFromBytes(stdoutBytes)
|
resultVersion, fixedBytes, err := fixupResultVersion(netconf, stdoutBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return create.Create(resultVersion, fixedBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExecPluginWithoutResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) error {
|
func ExecPluginWithoutResult(ctx context.Context, pluginPath string, netconf []byte, args CNIArgs, exec Exec) error {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ github.com/containerd/containerd/sys
|
||||||
# github.com/containerd/stargz-snapshotter/estargz v0.11.4
|
# github.com/containerd/stargz-snapshotter/estargz v0.11.4
|
||||||
github.com/containerd/stargz-snapshotter/estargz
|
github.com/containerd/stargz-snapshotter/estargz
|
||||||
github.com/containerd/stargz-snapshotter/estargz/errorutil
|
github.com/containerd/stargz-snapshotter/estargz/errorutil
|
||||||
# github.com/containernetworking/cni v1.1.0
|
# github.com/containernetworking/cni v1.1.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/containernetworking/cni/libcni
|
github.com/containernetworking/cni/libcni
|
||||||
github.com/containernetworking/cni/pkg/invoke
|
github.com/containernetworking/cni/pkg/invoke
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue