| |
@@ -1,4 +1,4 @@
|
| |
- From bdf3fc2b4bfea5ee3f91c5c2758c5154f95d27ad Mon Sep 17 00:00:00 2001
|
| |
+ From 3b98ff4a9f28118973917ed46c3eee59688fcc8f Mon Sep 17 00:00:00 2001
|
| |
From: Kazuyoshi Kato <katokazu@amazon.com>
|
| |
Date: Tue, 22 Mar 2022 00:40:39 +0000
|
| |
Subject: [PATCH] Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
|
| |
@@ -8,46 +8,46 @@
|
| |
|
| |
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
|
| |
---
|
| |
- cmd/containerd-shim/main_unix.go | 4 +-
|
| |
- cmd/ctr/commands/containers/containers.go | 2 +-
|
| |
- cmd/ctr/commands/tasks/kill.go | 29 ++++++
|
| |
- container.go | 10 +-
|
| |
- container_checkpoint_opts.go | 9 +-
|
| |
- container_opts.go | 10 +-
|
| |
- containers/containers.go | 8 +-
|
| |
- containerstore.go | 19 +++-
|
| |
- events.go | 5 +-
|
| |
- events/events.go | 3 +-
|
| |
- events/exchange/exchange.go | 8 +-
|
| |
- go.mod | 2 +-
|
| |
- go.sum | 3 +-
|
| |
- integration/client/container_test.go | 8 +-
|
| |
- integration/client/go.mod | 2 +-
|
| |
- integration/client/go.sum | 3 +-
|
| |
- metadata/boltutil/helpers.go | 20 ++--
|
| |
- metadata/containers.go | 3 +-
|
| |
- metadata/containers_test.go | 83 ++++++++++-------
|
| |
- pkg/cri/server/events.go | 3 +-
|
| |
- pkg/cri/server/helpers.go | 5 +-
|
| |
- pkg/cri/server/helpers_test.go | 13 +++
|
| |
- pkg/cri/server/restart.go | 4 +-
|
| |
- protobuf/any.go | 47 ++++++++++
|
| |
- protobuf/any_test.go | 26 ++++++
|
| |
- runtime/runtime.go | 8 +-
|
| |
- runtime/v1/linux/runtime.go | 9 +-
|
| |
- runtime/v1/linux/task.go | 4 +-
|
| |
- runtime/v1/shim/service.go | 3 +-
|
| |
- runtime/v2/manager.go | 7 +-
|
| |
- runtime/v2/runc/container.go | 6 +-
|
| |
- runtime/v2/runc/task/service.go | 5 +-
|
| |
- runtime/v2/runc/v1/service.go | 5 +-
|
| |
- runtime/v2/shim.go | 5 +-
|
| |
- runtime/v2/shim/publisher.go | 4 +-
|
| |
- services/containers/helpers.go | 20 +++-
|
| |
- services/events/service.go | 3 +-
|
| |
- services/tasks/local.go | 5 +-
|
| |
- task.go | 7 +-
|
| |
- 42 files changed, 365 insertions(+), 150 deletions(-)
|
| |
+ cmd/containerd-shim/main_unix.go | 4 +-
|
| |
+ cmd/ctr/commands/containers/containers.go | 2 +-
|
| |
+ container.go | 10 +--
|
| |
+ container_checkpoint_opts.go | 8 +--
|
| |
+ container_opts.go | 10 +--
|
| |
+ containers/containers.go | 8 +--
|
| |
+ containerstore.go | 19 ++++--
|
| |
+ events.go | 5 +-
|
| |
+ events/events.go | 3 +-
|
| |
+ events/exchange/exchange.go | 8 +--
|
| |
+ go.mod | 2 +-
|
| |
+ go.sum | 3 +-
|
| |
+ integration/client/container_test.go | 8 +--
|
| |
+ integration/client/go.mod | 2 +-
|
| |
+ integration/client/go.sum | 3 +-
|
| |
+ metadata/boltutil/helpers.go | 20 +++---
|
| |
+ metadata/containers.go | 3 +-
|
| |
+ metadata/containers_test.go | 83 ++++++++++++++---------
|
| |
+ metrics/cgroups/metrics_test.go | 6 +-
|
| |
+ pkg/cri/server/events.go | 3 +-
|
| |
+ pkg/cri/server/helpers.go | 5 +-
|
| |
+ pkg/cri/server/helpers_test.go | 13 ++++
|
| |
+ pkg/cri/server/restart.go | 4 +-
|
| |
+ protobuf/any.go | 47 +++++++++++++
|
| |
+ protobuf/any_test.go | 26 +++++++
|
| |
+ runtime/runtime.go | 8 +--
|
| |
+ runtime/v1/linux/runtime.go | 9 +--
|
| |
+ runtime/v1/linux/task.go | 4 +-
|
| |
+ runtime/v1/shim/service.go | 3 +-
|
| |
+ runtime/v2/manager.go | 7 +-
|
| |
+ runtime/v2/runc/container.go | 6 +-
|
| |
+ runtime/v2/runc/task/service.go | 5 +-
|
| |
+ runtime/v2/runc/v1/service.go | 5 +-
|
| |
+ runtime/v2/shim.go | 5 +-
|
| |
+ runtime/v2/shim/publisher.go | 4 +-
|
| |
+ services/containers/helpers.go | 20 ++++--
|
| |
+ services/events/service.go | 3 +-
|
| |
+ services/tasks/local.go | 5 +-
|
| |
+ task.go | 7 +-
|
| |
+ 39 files changed, 270 insertions(+), 126 deletions(-)
|
| |
create mode 100644 protobuf/any.go
|
| |
create mode 100644 protobuf/any_test.go
|
| |
|
| |
@@ -144,7 +144,7 @@
|
| |
t := &task{
|
| |
client: c.client,
|
| |
diff --git a/container_checkpoint_opts.go b/container_checkpoint_opts.go
|
| |
- index a64ef618b..c39628535 100644
|
| |
+ index a64ef618b..ee2fa1b97 100644
|
| |
--- a/container_checkpoint_opts.go
|
| |
+++ b/container_checkpoint_opts.go
|
| |
@@ -28,9 +28,9 @@ import (
|
| |
@@ -158,7 +158,7 @@
|
| |
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
| |
)
|
| |
|
| |
- @@ -56,7 +57,7 @@ func WithCheckpointImage(ctx context.Context, client *Client, c *containers.Cont
|
| |
+ @@ -56,7 +56,7 @@ func WithCheckpointImage(ctx context.Context, client *Client, c *containers.Cont
|
| |
|
| |
// WithCheckpointTask includes the running task
|
| |
func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error {
|
| |
@@ -167,7 +167,7 @@
|
| |
if err != nil {
|
| |
return nil
|
| |
}
|
| |
- @@ -97,8 +98,8 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta
|
| |
+ @@ -97,8 +97,8 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta
|
| |
|
| |
// WithCheckpointRuntime includes the container runtime info
|
| |
func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error {
|
| |
@@ -420,7 +420,7 @@
|
| |
|
| |
if err != nil {
|
| |
diff --git a/go.mod b/go.mod
|
| |
- index e49859e83..61cea501a 100644
|
| |
+ index 77f07d3ae..f42acf904 100644
|
| |
--- a/go.mod
|
| |
+++ b/go.mod
|
| |
@@ -17,7 +17,7 @@ require (
|
| |
@@ -430,13 +430,13 @@
|
| |
- github.com/containerd/typeurl v1.0.2
|
| |
+ github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259
|
| |
github.com/containerd/zfs v1.0.0
|
| |
+ github.com/containernetworking/cni v1.1.1
|
| |
github.com/containernetworking/plugins v1.1.1
|
| |
- github.com/coreos/go-systemd/v22 v22.3.2
|
| |
diff --git a/go.sum b/go.sum
|
| |
- index fa93eb9ff..dc179935a 100644
|
| |
+ index eefcc88f7..e4816994f 100644
|
| |
--- a/go.sum
|
| |
+++ b/go.sum
|
| |
- @@ -257,8 +257,9 @@ github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Ev
|
| |
+ @@ -260,8 +260,9 @@ github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Ev
|
| |
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
| |
github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk=
|
| |
github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
|
| |
@@ -468,7 +468,7 @@
|
| |
}
|
| |
|
| |
diff --git a/integration/client/go.mod b/integration/client/go.mod
|
| |
- index f8aaabd20..542d2ce8f 100644
|
| |
+ index f49dca653..bfd8b24ba 100644
|
| |
--- a/integration/client/go.mod
|
| |
+++ b/integration/client/go.mod
|
| |
@@ -10,7 +10,7 @@ require (
|
| |
@@ -481,10 +481,10 @@
|
| |
github.com/opencontainers/go-digest v1.0.0
|
| |
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
|
| |
diff --git a/integration/client/go.sum b/integration/client/go.sum
|
| |
- index 0d6a9ef9b..f6bd8ea5b 100644
|
| |
+ index 9ca7044a8..5351d9eb6 100644
|
| |
--- a/integration/client/go.sum
|
| |
+++ b/integration/client/go.sum
|
| |
- @@ -145,8 +145,9 @@ github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8h
|
| |
+ @@ -146,8 +146,9 @@ github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8h
|
| |
github.com/containerd/ttrpc v1.1.0 h1:GbtyLRxb0gOLR0TYQWt3O6B0NvT8tMdorEHqIQo/lWI=
|
| |
github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ=
|
| |
github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
|
| |
@@ -801,8 +801,31 @@
|
| |
}
|
| |
|
| |
func testEnv(t *testing.T) (context.Context, *bolt.DB, func()) {
|
| |
+ diff --git a/metrics/cgroups/metrics_test.go b/metrics/cgroups/metrics_test.go
|
| |
+ index c71ea60a5..c362ea3b9 100644
|
| |
+ --- a/metrics/cgroups/metrics_test.go
|
| |
+ +++ b/metrics/cgroups/metrics_test.go
|
| |
+ @@ -32,7 +32,7 @@ import (
|
| |
+ v2 "github.com/containerd/containerd/metrics/cgroups/v2"
|
| |
+ v1types "github.com/containerd/containerd/metrics/types/v1"
|
| |
+ v2types "github.com/containerd/containerd/metrics/types/v2"
|
| |
+ - "github.com/containerd/typeurl"
|
| |
+ + "github.com/containerd/containerd/protobuf"
|
| |
+ "github.com/prometheus/client_golang/prometheus"
|
| |
+
|
| |
+ metrics "github.com/docker/go-metrics"
|
| |
+ @@ -152,7 +152,7 @@ func (t *mockStatT) Namespace() string {
|
| |
+
|
| |
+ func (t *mockStatT) Stats(context.Context) (*types.Any, error) {
|
| |
+ if t.isV1 {
|
| |
+ - return typeurl.MarshalAny(&v1types.Metrics{})
|
| |
+ + return protobuf.MarshalAnyToProto(&v1types.Metrics{})
|
| |
+ }
|
| |
+ - return typeurl.MarshalAny(&v2types.Metrics{})
|
| |
+ + return protobuf.MarshalAnyToProto(&v2types.Metrics{})
|
| |
+ }
|
| |
diff --git a/pkg/cri/server/events.go b/pkg/cri/server/events.go
|
| |
- index b98dd1fd3..ca817d0fb 100644
|
| |
+ index c8ffdadbf..fbecb29a0 100644
|
| |
--- a/pkg/cri/server/events.go
|
| |
+++ b/pkg/cri/server/events.go
|
| |
@@ -32,7 +32,6 @@ import (
|
| |
@@ -823,10 +846,10 @@
|
| |
evt, err := typeurl.UnmarshalAny(e)
|
| |
if err != nil {
|
| |
diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go
|
| |
- index abc66e389..de9bdddc1 100644
|
| |
+ index a8498116d..2b9c115e7 100644
|
| |
--- a/pkg/cri/server/helpers.go
|
| |
+++ b/pkg/cri/server/helpers.go
|
| |
- @@ -374,10 +374,11 @@ func getRuntimeOptionsType(t string) interface{} {
|
| |
+ @@ -375,10 +375,11 @@ func getRuntimeOptionsType(t string) interface{} {
|
| |
|
| |
// getRuntimeOptions get runtime options from container metadata.
|
| |
func getRuntimeOptions(c containers.Container) (interface{}, error) {
|
| |
@@ -1202,7 +1225,7 @@
|
| |
}
|
| |
|
| |
diff --git a/runtime/v2/runc/v1/service.go b/runtime/v2/runc/v1/service.go
|
| |
- index 0c84c1403..b27e59bbe 100644
|
| |
+ index 8c473430e..8fdac3f8a 100644
|
| |
--- a/runtime/v2/runc/v1/service.go
|
| |
+++ b/runtime/v2/runc/v1/service.go
|
| |
@@ -41,6 +41,7 @@ import (
|
| |
@@ -1222,7 +1245,7 @@
|
| |
if err != nil {
|
| |
return nil, fmt.Errorf("failed to marshal process %d info: %w", pid, err)
|
| |
}
|
| |
- @@ -617,7 +618,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.
|
| |
+ @@ -621,7 +622,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.
|
| |
return nil, err
|
| |
}
|
| |
return &taskAPI.StatsResponse{
|
| |
@@ -1436,28 +1459,6 @@
|
| |
}
|
| |
if i.Annotations != nil {
|
| |
request.Annotations = i.Annotations
|
| |
- diff --git a/metrics/cgroups/metrics_test.go b/metrics/cgroups/metrics_test.go
|
| |
- --- a/metrics/cgroups/metrics_test.go
|
| |
- +++ b/metrics/cgroups/metrics_test.go
|
| |
- @@ -32,7 +32,7 @@ import (
|
| |
- v2 "github.com/containerd/containerd/metrics/cgroups/v2"
|
| |
- v1types "github.com/containerd/containerd/metrics/types/v1"
|
| |
- v2types "github.com/containerd/containerd/metrics/types/v2"
|
| |
- - "github.com/containerd/typeurl"
|
| |
- + "github.com/containerd/containerd/protobuf"
|
| |
- "github.com/prometheus/client_golang/prometheus"
|
| |
-
|
| |
- metrics "github.com/docker/go-metrics"
|
| |
- @@ -152,7 +152,7 @@ func (t *mockStatT) Namespace() string {
|
| |
-
|
| |
- func (t *mockStatT) Stats(context.Context) (*types.Any, error) {
|
| |
- if t.isV1 {
|
| |
- - return typeurl.MarshalAny(&v1types.Metrics{})
|
| |
- + return protobuf.MarshalAnyToProto(&v1types.Metrics{})
|
| |
- }
|
| |
- - return typeurl.MarshalAny(&v2types.Metrics{})
|
| |
- + return protobuf.MarshalAnyToProto(&v2types.Metrics{})
|
| |
- }
|
| |
--
|
| |
- 2.37.2
|
| |
+ 2.37.3
|
| |
|
| |
reference
I'm new at this, I believe a maintainer needs to upload the source tarball with fedpkg new-sources.
cc @eclipseo who last prepared the 0002 patch
Depends-On: https://src.fedoraproject.org/rpms/golang-k8s-cri-api/pull-request/1