Skip to content

Commit

Permalink
vendor: Update the agent vendoring based on pkg/types
Browse files Browse the repository at this point in the history
Some agent types definition that were generic enough to be reused
everywhere, have been split from the initial grpc package.

This prevents from importing the entire protobuf package through
the grpc one, and prevents binaries such as kata-netmon to stay
in sync with the types definitions.

Fixes kata-containers#856

Signed-off-by: Sebastien Boeuf <[email protected]>
  • Loading branch information
Sebastien Boeuf authored and zklei committed Nov 22, 2018
1 parent dc7e294 commit 8939f55
Show file tree
Hide file tree
Showing 27 changed files with 2,259 additions and 1,331 deletions.
10 changes: 6 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

[[constraint]]
name = "github.com/opencontainers/runtime-spec"
revision = "4e3b9264a330d094b0386c3703c5f379119711e8"
revision = "5806c35637336642129d03657419829569abc5aa"

[[constraint]]
name = "github.com/stretchr/testify"
Expand Down Expand Up @@ -56,7 +56,7 @@

[[constraint]]
name = "github.com/kata-containers/agent"
revision = "7e8e20b10b71fe3044a24175b8a686421e9d2c24"
revision = "dd8f32c7a2e6e7effed9d12bac97e7d48473e684"

[[constraint]]
name = "github.com/containerd/cri-containerd"
Expand Down
10 changes: 5 additions & 5 deletions cli/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"golang.org/x/sys/unix"

"github.com/containernetworking/plugins/pkg/ns"
"github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
Expand Down Expand Up @@ -158,7 +158,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
}
switch opType {
case interfaceType:
var inf, resultingInf *grpc.Interface
var inf, resultingInf *types.Interface
if err = json.NewDecoder(f).Decode(&inf); err != nil {
return err
}
Expand All @@ -177,7 +177,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
}
json.NewEncoder(output).Encode(resultingInf)
case routeType:
var routes, resultingRoutes []*grpc.Route
var routes, resultingRoutes []*types.Route
if err = json.NewDecoder(f).Decode(&routes); err != nil {
return err
}
Expand Down Expand Up @@ -215,15 +215,15 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT

switch opType {
case interfaceType:
var interfaces []*grpc.Interface
var interfaces []*types.Interface
interfaces, err = vci.ListInterfaces(ctx, sandboxID)
if err != nil {
kataLog.WithField("existing-interfaces", fmt.Sprintf("%+v", interfaces)).
WithError(err).Error("list interfaces failed")
}
json.NewEncoder(file).Encode(interfaces)
case routeType:
var routes []*grpc.Route
var routes []*types.Route
routes, err = vci.ListRoutes(ctx, sandboxID)
if err != nil {
kataLog.WithField("resulting-routes", fmt.Sprintf("%+v", routes)).
Expand Down
12 changes: 6 additions & 6 deletions cli/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ import (
"golang.org/x/sys/unix"

"github.com/containernetworking/plugins/pkg/ns"
"github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/stretchr/testify/assert"
)

var (
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) {
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
return nil, nil
}
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) {
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
return nil, nil
}
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) {
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
return nil, nil
}
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) {
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
return nil, nil
}
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*grpc.Route, error) {
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Route, error) {
return nil, nil
}
)
Expand Down
Loading

0 comments on commit 8939f55

Please sign in to comment.