Merge pull request #6706 from kzys/typeurl-upgrade

Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
This commit is contained in:
Phil Estes
2022-03-25 10:38:46 -04:00
committed by GitHub
42 changed files with 336 additions and 152 deletions

View File

@@ -38,13 +38,13 @@ import (
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/process"
"github.com/containerd/containerd/protobuf"
shimlog "github.com/containerd/containerd/runtime/v1"
"github.com/containerd/containerd/runtime/v1/shim"
shimapi "github.com/containerd/containerd/runtime/v1/shim/v1"
"github.com/containerd/containerd/sys/reaper"
"github.com/containerd/containerd/version"
"github.com/containerd/ttrpc"
"github.com/containerd/typeurl"
ptypes "github.com/gogo/protobuf/types"
"github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
@@ -301,7 +301,7 @@ type remoteEventsPublisher struct {
func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {
ns, _ := namespaces.Namespace(ctx)
encoded, err := typeurl.MarshalAny(event)
encoded, err := protobuf.MarshalAnyToProto(event)
if err != nil {
return err
}

View File

@@ -280,7 +280,7 @@ var infoCommand = cli.Command{
return nil
}
if info.Spec != nil && info.Spec.Value != nil {
if info.Spec != nil && info.Spec.GetValue() != nil {
v, err := typeurl.UnmarshalAny(info.Spec)
if err != nil {
return err

View File

@@ -42,7 +42,7 @@ func RemoveCniNetworkIfExist(ctx context.Context, container containerd.Container
return nil
}
data, err := typeurl.UnmarshalAny(&networkMeta)
data, err := typeurl.UnmarshalAny(networkMeta)
if err != nil {
return fmt.Errorf("failed to unmarshal cni metadata extension %s", commands.CtrCniMetadataExtension)
}