From da51f4a1f887bb2526246147075514fca73733c9 Mon Sep 17 00:00:00 2001 From: "cilium-renovate[bot]" <134692979+cilium-renovate[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:34:51 +0000 Subject: [PATCH] fix(deps): update module github.com/containerd/containerd to v2 Signed-off-by: cilium-renovate[bot] <134692979+cilium-renovate[bot]@users.noreply.github.com> --- contrib/tetragon-rthooks/go.mod | 2 +- contrib/tetragon-rthooks/go.sum | 4 +-- .../github.com/containerd/typeurl/v2/types.go | 32 ++++++++++--------- .../containerd/typeurl/v2/types_gogo.go | 6 ++-- contrib/tetragon-rthooks/vendor/modules.txt | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/contrib/tetragon-rthooks/go.mod b/contrib/tetragon-rthooks/go.mod index 014f14a3791..23ac93868da 100644 --- a/contrib/tetragon-rthooks/go.mod +++ b/contrib/tetragon-rthooks/go.mod @@ -29,7 +29,7 @@ require ( github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/log v0.1.0 // indirect github.com/containerd/ttrpc v1.2.6 // indirect - github.com/containerd/typeurl/v2 v2.2.2 // indirect + github.com/containerd/typeurl/v2 v2.2.3 // indirect github.com/containers/storage v1.56.0 // indirect github.com/coreos/go-systemd/v22 v22.5.1-0.20231103132048-7d375ecc2b09 // indirect github.com/cyphar/filepath-securejoin v0.3.5 // indirect diff --git a/contrib/tetragon-rthooks/go.sum b/contrib/tetragon-rthooks/go.sum index 9db800e2d04..9e094eab8ee 100644 --- a/contrib/tetragon-rthooks/go.sum +++ b/contrib/tetragon-rthooks/go.sum @@ -27,8 +27,8 @@ github.com/containerd/nri v0.9.0 h1:jribDJs/oQ95vLO4Yn19HKFYriZGWKiG6nKWjl9Y/x4= github.com/containerd/nri v0.9.0/go.mod h1:sDRoMy5U4YolsWthg7TjTffAwPb6LEr//83O+D3xVU4= github.com/containerd/ttrpc v1.2.6 h1:zG+Kn5EZ6MUYCS1t2Hmt2J4tMVaLSFEJVOraDQwNPC4= github.com/containerd/ttrpc v1.2.6/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o= -github.com/containerd/typeurl/v2 v2.2.2 h1:3jN/k2ysKuPCsln5Qv8bzR9cxal8XjkxPogJfSNO31k= -github.com/containerd/typeurl/v2 v2.2.2/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= +github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40= +github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= github.com/containers/common v0.61.0 h1:j/84PTqZIKKYy42OEJsZmjZ4g4Kq2ERuC3tqp2yWdh4= github.com/containers/common v0.61.0/go.mod h1:NGRISq2vTFPSbhNqj6MLwyes4tWSlCnqbJg7R77B8xc= github.com/containers/storage v1.56.0 h1:DZ9KSkj6M2tvj/4bBoaJu3QDHRl35BwsZ4kmLJS97ZI= diff --git a/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types.go b/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types.go index efc405ddd48..9bf78104165 100644 --- a/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types.go +++ b/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types.go @@ -39,7 +39,7 @@ type handler interface { Marshaller(interface{}) func() ([]byte, error) Unmarshaller(interface{}) func([]byte) error TypeURL(interface{}) string - GetType(url string) reflect.Type + GetType(url string) (reflect.Type, bool) } // Definitions of common error types used throughout typeurl. @@ -240,7 +240,7 @@ func MarshalAnyToProto(from interface{}) (*anypb.Any, error) { } func unmarshal(typeURL string, value []byte, v interface{}) (interface{}, error) { - t, err := getTypeByUrl(typeURL) + t, isProto, err := getTypeByUrl(typeURL) if err != nil { return nil, err } @@ -258,14 +258,16 @@ func unmarshal(typeURL string, value []byte, v interface{}) (interface{}, error) } } - pm, ok := v.(proto.Message) - if ok { - return v, proto.Unmarshal(value, pm) - } + if isProto { + pm, ok := v.(proto.Message) + if ok { + return v, proto.Unmarshal(value, pm) + } - for _, h := range handlers { - if unmarshal := h.Unmarshaller(v); unmarshal != nil { - return v, unmarshal(value) + for _, h := range handlers { + if unmarshal := h.Unmarshaller(v); unmarshal != nil { + return v, unmarshal(value) + } } } @@ -273,12 +275,12 @@ func unmarshal(typeURL string, value []byte, v interface{}) (interface{}, error) return v, json.Unmarshal(value, v) } -func getTypeByUrl(url string) (reflect.Type, error) { +func getTypeByUrl(url string) (_ reflect.Type, isProto bool, _ error) { mu.RLock() for t, u := range registry { if u == url { mu.RUnlock() - return t, nil + return t, false, nil } } mu.RUnlock() @@ -286,15 +288,15 @@ func getTypeByUrl(url string) (reflect.Type, error) { if err != nil { if errors.Is(err, protoregistry.NotFound) { for _, h := range handlers { - if t := h.GetType(url); t != nil { - return t, nil + if t, isProto := h.GetType(url); t != nil { + return t, isProto, nil } } } - return nil, fmt.Errorf("type with url %s: %w", url, ErrNotFound) + return nil, false, fmt.Errorf("type with url %s: %w", url, ErrNotFound) } empty := mt.New().Interface() - return reflect.TypeOf(empty).Elem(), nil + return reflect.TypeOf(empty).Elem(), true, nil } func tryDereference(v interface{}) reflect.Type { diff --git a/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types_gogo.go b/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types_gogo.go index fa293323bef..adb892ec60c 100644 --- a/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types_gogo.go +++ b/contrib/tetragon-rthooks/vendor/github.com/containerd/typeurl/v2/types_gogo.go @@ -59,10 +59,10 @@ func (gogoHandler) TypeURL(v interface{}) string { return gogoproto.MessageName(pm) } -func (gogoHandler) GetType(url string) reflect.Type { +func (gogoHandler) GetType(url string) (reflect.Type, bool) { t := gogoproto.MessageType(url) if t == nil { - return nil + return nil, false } - return t.Elem() + return t.Elem(), true } diff --git a/contrib/tetragon-rthooks/vendor/modules.txt b/contrib/tetragon-rthooks/vendor/modules.txt index 41a6267cc3b..fab2e84b7f2 100644 --- a/contrib/tetragon-rthooks/vendor/modules.txt +++ b/contrib/tetragon-rthooks/vendor/modules.txt @@ -44,7 +44,7 @@ github.com/containerd/nri/pkg/stub # github.com/containerd/ttrpc v1.2.6 ## explicit; go 1.19 github.com/containerd/ttrpc -# github.com/containerd/typeurl/v2 v2.2.2 +# github.com/containerd/typeurl/v2 v2.2.3 ## explicit; go 1.21 github.com/containerd/typeurl/v2 # github.com/containers/common v0.61.0