Skip to content

Commit 3725006

Browse files
mccv1r0haircommander
authored andcommitted
Update vendor code for cni and ocicni and libpod, fix build errors
Signed-off-by: Michael Cambria <[email protected]>
1 parent ef5174f commit 3725006

File tree

21 files changed

+858
-239
lines changed

21 files changed

+858
-239
lines changed

server/sandbox_network.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ func (s *Server) networkStart(sb *sandbox.Sandbox) (podIP string, result cnitype
4141
}
4242

4343
// only one cnitypes.Result is returned since newPodNetwork sets Networks list empty
44-
result = tmp[0]
44+
result = tmp[0].Result
4545
logrus.Debugf("CNI setup result: %v", result)
4646

47-
network, err := cnicurrent.GetResult(result)
47+
network, err := cnicurrent.NewResultFromResult(result)
4848
if err != nil {
4949
err = fmt.Errorf("failed to get network JSON for pod sandbox %s(%s): %v", sb.Name(), sb.ID(), err)
5050
return
@@ -86,7 +86,7 @@ func (s *Server) getSandboxIP(sb *sandbox.Sandbox) (string, error) {
8686
return "", fmt.Errorf("failed to get network status for pod sandbox %s(%s): %v", sb.Name(), sb.ID(), err)
8787
}
8888

89-
res, err := cnicurrent.GetResult(result[0])
89+
res, err := cnicurrent.NewResultFromResult(result[0].Result)
9090
if err != nil {
9191
return "", fmt.Errorf("failed to get network JSON for pod sandbox %s(%s): %v", sb.Name(), sb.ID(), err)
9292
}

server/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func newPodNetwork(sb *sandbox.Sandbox) ocicni.PodNetwork {
102102
return ocicni.PodNetwork{
103103
Name: sb.KubeName(),
104104
Namespace: sb.Namespace(),
105-
Networks: make([]string, 0),
105+
Networks: make([]ocicni.NetAttachment, 0),
106106
ID: sb.ID(),
107107
NetNS: sb.NetNsPath(),
108108
}

test/cni_plugin_helper.bash

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# This script wraps the CNI 'bridge' plugin to provide additional testing
44
# capabilities
55

6-
if [[ -z "${CNI_ARGS}" ]]; then
7-
exit 1
6+
# The VERSION command doesn't receive the same arguments as other CNI plugin commands.
7+
# It has to be handled separately
8+
if [[ "${CNI_COMMAND-}" = "VERSION" ]]; then
9+
result=$(/opt/cni/bin/bridge $@) || exit $?
10+
echo $result
11+
exit 0
812
fi
913

1014
IFS=';' read -ra array <<< "${CNI_ARGS}"
@@ -19,12 +23,16 @@ done
1923

2024
if [[ -z "${CNI_CONTAINERID}" ]]; then
2125
exit 1
22-
elif [[ -z "${K8S_POD_NAMESPACE}" ]]; then
26+
fi
27+
K8S_POD_NAMESPACE=${K8S_POD_NAMESPACE:-}
28+
K8S_POD_NAME=${K8S_POD_NAME:-}
29+
if [[ "${CNI_COMMAND}" != "VERSION" ]]; then
30+
if [[ -z "${K8S_POD_NAMESPACE}" ]]; then
2331
exit 1
24-
elif [[ -z "${K8S_POD_NAME}" ]]; then
32+
elif [[ -z "${K8S_POD_NAME}" ]]; then
2533
exit 1
34+
fi
2635
fi
27-
2836
echo "FOUND_CNI_CONTAINERID=${CNI_CONTAINERID}" >> /tmp/plugin_test_args.out
2937
echo "FOUND_K8S_POD_NAMESPACE=${K8S_POD_NAMESPACE}" >> /tmp/plugin_test_args.out
3038
echo "FOUND_K8S_POD_NAME=${K8S_POD_NAME}" >> /tmp/plugin_test_args.out
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"tty": false, "labels": {"group": "test", "version": "v1.1.0", "type": "small", "batch": "no", "name": "ctr3"}, "stdin_once": false, "envs": [{"value": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "key": "PATH"}, {"value": "xterm", "key": "TERM"}, {"value": "test/dir1", "key": "TESTDIR"}, {"value": "test/file1", "key": "TESTFILE"}], "image": {"image": "quay.io/crio/redis:alpine"}, "args": [], "privileged": true, "log_path": "", "working_dir": "/", "command": ["/bin/ls"], "linux": {"security_context": {"namespace_options": {"pid": 1}, "capabilities": {"drop_capabilities": [], "add_capabilities": ["setuid", "setgid"]}, "selinux_options": {"type": "svirt_lxc_net_t", "role": "system_r", "user": "system_u", "level": "s0:c4,c5"}, "readonly_rootfs": false}, "resources": {"cpu_period": 10000, "oom_score_adj": 30, "memory_limit_in_bytes": 268435456, "cpu_quota": 20000, "cpu_shares": 512}}, "annotations": {"owner": "dragon", "daemon": "crio"}, "stdin": false, "metadata": {"attempt": 1, "name": "ctr3"}}

vendor.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ github.com/mattn/go-isatty v0.0.4
2121
github.com/vbauerster/mpb v3.4.0
2222
github.com/ostreedev/ostree-go d0388bd827cfac6fa8eec760246eb8375674b2a0
2323
github.com/containers/storage cri-o-release-1.14
24-
github.com/containernetworking/cni v0.7.0-rc2
24+
github.com/containernetworking/cni 83439463f7840005184ec4c488c9edd6ed6978fc
2525
github.com/containernetworking/plugins v0.7.5
2626
google.golang.org/grpc v1.23.0 https://github.com/grpc/grpc-go
2727
google.golang.org/genproto 09f6ed296fc66555a25fe4ce95173148778dfa85
@@ -108,12 +108,12 @@ github.com/xeipuuv/gojsonpointer 4e3ac2762d5f479393488629ee9370b50873b3a6
108108
github.com/containerd/console 84eeaae905fa414d03e07bcd6c8d3f19e7cf180e
109109
github.com/cyphar/filepath-securejoin v0.2.1
110110
golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
111-
github.com/cri-o/ocicni 0c180f981b27ef6036fa5be29bcb4dd666e406eb
111+
github.com/cri-o/ocicni 7bd73e9a7f59107c76605aecd2c8ec3d69ef3ff8
112112
github.com/containers/buildah v1.8.4
113113
github.com/seccomp/containers-golang v0.1
114114
github.com/openshift/imagebuilder 705fe9255c57f8505efb9723a9ac4082b67973bc
115115
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
116-
github.com/containers/libpod v1.4.1
116+
github.com/containers/libpod b0b16bbea62f2560b741f50a1b1a165e78790779
117117
github.com/spf13/cobra v0.0.3
118118
github.com/pmezard/go-difflib v1.0.0
119119
github.com/opentracing/opentracing-go 25a84ff92183e2f8ac018ba1db54f8a07b3c0e04

vendor/github.com/containernetworking/cni/README.md

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)