Merge pull request #858 from sboeuf/rely_agent_types

vendor: Rely on new agent package types
This commit is contained in:
Sebastien Boeuf 2018-10-26 13:05:34 -07:00 committed by GitHub
commit 110f7a8a29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 2254 additions and 1359 deletions

10
Gopkg.lock generated
View File

@ -130,14 +130,15 @@
revision = "e82e8498c5a214b24ac75e0a05ace556bf91a9ab" revision = "e82e8498c5a214b24ac75e0a05ace556bf91a9ab"
[[projects]] [[projects]]
digest = "1:672470f31bc4e50f9ba09a1af7ab6035bf8b1452db64dfd79b1a22614bb30710" digest = "1:e96806ae1b041a36386249b22ef9eaf5af1788c0f86f686c6296e5a9caf53df8"
name = "github.com/kata-containers/agent" name = "github.com/kata-containers/agent"
packages = [ packages = [
"pkg/types",
"protocols/client", "protocols/client",
"protocols/grpc", "protocols/grpc",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "7e8e20b10b71fe3044a24175b8a686421e9d2c24" revision = "dd8f32c7a2e6e7effed9d12bac97e7d48473e684"
[[projects]] [[projects]]
digest = "1:04054595e5c5a35d1553a7f3464d18577caf597445d643992998643df56d4afd" digest = "1:04054595e5c5a35d1553a7f3464d18577caf597445d643992998643df56d4afd"
@ -173,11 +174,11 @@
revision = "0351df1c5a66838d0c392b4ac4cf9450de844e2d" revision = "0351df1c5a66838d0c392b4ac4cf9450de844e2d"
[[projects]] [[projects]]
digest = "1:57234a321bf1f8f98a8a9a5122a2404cc60d0800516f4ab7a7b2375e4b2d19ea" digest = "1:0d447d4961f4f9270457fbc20d0261bba8d3056f395efd2e2480e2dfa4487a60"
name = "github.com/opencontainers/runtime-spec" name = "github.com/opencontainers/runtime-spec"
packages = ["specs-go"] packages = ["specs-go"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "4e3b9264a330d094b0386c3703c5f379119711e8" revision = "5806c35637336642129d03657419829569abc5aa"
[[projects]] [[projects]]
digest = "1:7da29c22bcc5c2ffb308324377dc00b5084650348c2799e573ed226d8cc9faf0" digest = "1:7da29c22bcc5c2ffb308324377dc00b5084650348c2799e573ed226d8cc9faf0"
@ -406,6 +407,7 @@
"github.com/gogo/protobuf/proto", "github.com/gogo/protobuf/proto",
"github.com/gogo/protobuf/types", "github.com/gogo/protobuf/types",
"github.com/intel/govmm/qemu", "github.com/intel/govmm/qemu",
"github.com/kata-containers/agent/pkg/types",
"github.com/kata-containers/agent/protocols/client", "github.com/kata-containers/agent/protocols/client",
"github.com/kata-containers/agent/protocols/grpc", "github.com/kata-containers/agent/protocols/grpc",
"github.com/kubernetes-incubator/cri-o/pkg/annotations", "github.com/kubernetes-incubator/cri-o/pkg/annotations",

View File

@ -24,7 +24,7 @@
[[constraint]] [[constraint]]
name = "github.com/opencontainers/runtime-spec" name = "github.com/opencontainers/runtime-spec"
revision = "4e3b9264a330d094b0386c3703c5f379119711e8" revision = "5806c35637336642129d03657419829569abc5aa"
[[constraint]] [[constraint]]
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
@ -56,7 +56,7 @@
[[constraint]] [[constraint]]
name = "github.com/kata-containers/agent" name = "github.com/kata-containers/agent"
revision = "7e8e20b10b71fe3044a24175b8a686421e9d2c24" revision = "dd8f32c7a2e6e7effed9d12bac97e7d48473e684"
[[constraint]] [[constraint]]
name = "github.com/containerd/cri-containerd" name = "github.com/containerd/cri-containerd"

View File

@ -17,7 +17,7 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/containernetworking/plugins/pkg/ns" "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" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
@ -158,7 +158,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
} }
switch opType { switch opType {
case interfaceType: case interfaceType:
var inf, resultingInf *grpc.Interface var inf, resultingInf *types.Interface
if err = json.NewDecoder(f).Decode(&inf); err != nil { if err = json.NewDecoder(f).Decode(&inf); err != nil {
return err return err
} }
@ -177,7 +177,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
} }
json.NewEncoder(output).Encode(resultingInf) json.NewEncoder(output).Encode(resultingInf)
case routeType: case routeType:
var routes, resultingRoutes []*grpc.Route var routes, resultingRoutes []*types.Route
if err = json.NewDecoder(f).Decode(&routes); err != nil { if err = json.NewDecoder(f).Decode(&routes); err != nil {
return err return err
} }
@ -215,7 +215,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
switch opType { switch opType {
case interfaceType: case interfaceType:
var interfaces []*grpc.Interface var interfaces []*types.Interface
interfaces, err = vci.ListInterfaces(ctx, sandboxID) interfaces, err = vci.ListInterfaces(ctx, sandboxID)
if err != nil { if err != nil {
kataLog.WithField("existing-interfaces", fmt.Sprintf("%+v", interfaces)). kataLog.WithField("existing-interfaces", fmt.Sprintf("%+v", interfaces)).
@ -223,7 +223,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
} }
json.NewEncoder(file).Encode(interfaces) json.NewEncoder(file).Encode(interfaces)
case routeType: case routeType:
var routes []*grpc.Route var routes []*types.Route
routes, err = vci.ListRoutes(ctx, sandboxID) routes, err = vci.ListRoutes(ctx, sandboxID)
if err != nil { if err != nil {
kataLog.WithField("resulting-routes", fmt.Sprintf("%+v", routes)). kataLog.WithField("resulting-routes", fmt.Sprintf("%+v", routes)).

View File

@ -18,25 +18,25 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/containernetworking/plugins/pkg/ns" "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" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
var ( 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 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 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 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 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 return nil, nil
} }
) )

View File

@ -21,6 +21,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/runtime/pkg/signals" "github.com/kata-containers/runtime/pkg/signals"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
lSyslog "github.com/sirupsen/logrus/hooks/syslog" lSyslog "github.com/sirupsen/logrus/hooks/syslog"
@ -28,41 +29,6 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
// The following types and structures have to be kept in sync with the
// description of the agent protocol. Those definitions need to be in their
// own separate package so that they can be imported directly from this code.
// The reason for not importing them now, is because importing the whole agent
// protocol adds up too much overhead because of the grpc protocol involved.
// IPFamily define the IP address family type.
type IPFamily int32
// IPAddress describes the IP address format expected by Kata API.
type IPAddress struct {
Family IPFamily `json:"family,omitempty"`
Address string `json:"address,omitempty"`
Mask string `json:"mask,omitempty"`
}
// Interface describes the network interface format expected by Kata API.
type Interface struct {
Device string `json:"device,omitempty"`
Name string `json:"name,omitempty"`
IPAddresses []*IPAddress `json:"IPAddresses,omitempty"`
Mtu uint64 `json:"mtu,omitempty"`
HwAddr string `json:"hwAddr,omitempty"`
PciAddr string `json:"pciAddr,omitempty"`
}
// Route describes the network route format expected by Kata API.
type Route struct {
Dest string `json:"dest,omitempty"`
Gateway string `json:"gateway,omitempty"`
Device string `json:"device,omitempty"`
Source string `json:"source,omitempty"`
Scope uint32 `json:"scope,omitempty"`
}
const ( const (
netmonName = "kata-netmon" netmonName = "kata-netmon"
@ -104,7 +70,7 @@ type netmon struct {
storagePath string storagePath string
sharedFile string sharedFile string
netIfaces map[int]Interface netIfaces map[int]types.Interface
linkUpdateCh chan netlink.LinkUpdate linkUpdateCh chan netlink.LinkUpdate
linkDoneCh chan struct{} linkDoneCh chan struct{}
@ -185,7 +151,7 @@ func newNetmon(params netmonParams) (*netmon, error) {
netmonParams: params, netmonParams: params,
storagePath: filepath.Join(storageParentPath, params.sandboxID), storagePath: filepath.Join(storageParentPath, params.sandboxID),
sharedFile: filepath.Join(storageParentPath, params.sandboxID, sharedFile), sharedFile: filepath.Join(storageParentPath, params.sandboxID, sharedFile),
netIfaces: make(map[int]Interface), netIfaces: make(map[int]types.Interface),
linkUpdateCh: make(chan netlink.LinkUpdate), linkUpdateCh: make(chan netlink.LinkUpdate),
linkDoneCh: make(chan struct{}), linkDoneCh: make(chan struct{}),
rtUpdateCh: make(chan netlink.RouteUpdate), rtUpdateCh: make(chan netlink.RouteUpdate),
@ -293,13 +259,13 @@ func (n *netmon) listenNetlinkEvents() error {
// convertInterface converts a link and its IP addresses as defined by netlink // convertInterface converts a link and its IP addresses as defined by netlink
// package, into the Interface structure format expected by kata-runtime to // package, into the Interface structure format expected by kata-runtime to
// describe an interface and its associated IP addresses. // describe an interface and its associated IP addresses.
func convertInterface(linkAttrs *netlink.LinkAttrs, addrs []netlink.Addr) Interface { func convertInterface(linkAttrs *netlink.LinkAttrs, addrs []netlink.Addr) types.Interface {
if linkAttrs == nil { if linkAttrs == nil {
netmonLog.Warn("Link attributes are nil") netmonLog.Warn("Link attributes are nil")
return Interface{} return types.Interface{}
} }
var ipAddrs []*IPAddress var ipAddrs []*types.IPAddress
for _, addr := range addrs { for _, addr := range addrs {
if addr.IPNet == nil { if addr.IPNet == nil {
@ -308,8 +274,8 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, addrs []netlink.Addr) Interf
netMask, _ := addr.Mask.Size() netMask, _ := addr.Mask.Size()
ipAddr := &IPAddress{ ipAddr := &types.IPAddress{
Family: IPFamily(netlinkFamily), Family: types.IPFamily(netlinkFamily),
Address: addr.IP.String(), Address: addr.IP.String(),
Mask: fmt.Sprintf("%d", netMask), Mask: fmt.Sprintf("%d", netMask),
} }
@ -317,7 +283,7 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, addrs []netlink.Addr) Interf
ipAddrs = append(ipAddrs, ipAddr) ipAddrs = append(ipAddrs, ipAddr)
} }
iface := Interface{ iface := types.Interface{
Device: linkAttrs.Name, Device: linkAttrs.Name,
Name: linkAttrs.Name, Name: linkAttrs.Name,
IPAddresses: ipAddrs, IPAddresses: ipAddrs,
@ -333,8 +299,8 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, addrs []netlink.Addr) Interf
// convertRoutes converts a list of routes as defined by netlink package, // convertRoutes converts a list of routes as defined by netlink package,
// into a list of Route structure format expected by kata-runtime to // into a list of Route structure format expected by kata-runtime to
// describe a set of routes. // describe a set of routes.
func convertRoutes(netRoutes []netlink.Route) []Route { func convertRoutes(netRoutes []netlink.Route) []types.Route {
var routes []Route var routes []types.Route
// Ignore routes with IPv6 addresses as this is not supported // Ignore routes with IPv6 addresses as this is not supported
// by Kata yet. // by Kata yet.
@ -368,7 +334,7 @@ func convertRoutes(netRoutes []netlink.Route) []Route {
dev = iface.Name dev = iface.Name
} }
route := Route{ route := types.Route{
Dest: dst, Dest: dst,
Gateway: gw, Gateway: gw,
Device: dev, Device: dev,
@ -440,7 +406,7 @@ func (n *netmon) execKataCmd(subCmd string) error {
return os.Remove(n.sharedFile) return os.Remove(n.sharedFile)
} }
func (n *netmon) addInterfaceCLI(iface Interface) error { func (n *netmon) addInterfaceCLI(iface types.Interface) error {
if err := n.storeDataToSend(iface); err != nil { if err := n.storeDataToSend(iface); err != nil {
return err return err
} }
@ -448,7 +414,7 @@ func (n *netmon) addInterfaceCLI(iface Interface) error {
return n.execKataCmd(kataCLIAddIfaceCmd) return n.execKataCmd(kataCLIAddIfaceCmd)
} }
func (n *netmon) delInterfaceCLI(iface Interface) error { func (n *netmon) delInterfaceCLI(iface types.Interface) error {
if err := n.storeDataToSend(iface); err != nil { if err := n.storeDataToSend(iface); err != nil {
return err return err
} }
@ -456,7 +422,7 @@ func (n *netmon) delInterfaceCLI(iface Interface) error {
return n.execKataCmd(kataCLIDelIfaceCmd) return n.execKataCmd(kataCLIDelIfaceCmd)
} }
func (n *netmon) updateRoutesCLI(routes []Route) error { func (n *netmon) updateRoutesCLI(routes []types.Route) error {
if err := n.storeDataToSend(routes); err != nil { if err := n.storeDataToSend(routes); err != nil {
return err return err
} }

View File

@ -16,6 +16,7 @@ import (
"runtime" "runtime"
"testing" "testing"
"github.com/kata-containers/agent/pkg/types"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
@ -173,14 +174,14 @@ func TestConvertInterface(t *testing.T) {
HardwareAddr: hwAddr, HardwareAddr: hwAddr,
} }
expected := Interface{ expected := types.Interface{
Device: testIfaceName, Device: testIfaceName,
Name: testIfaceName, Name: testIfaceName,
Mtu: uint64(testMTU), Mtu: uint64(testMTU),
HwAddr: testHwAddr, HwAddr: testHwAddr,
IPAddresses: []*IPAddress{ IPAddresses: []*types.IPAddress{
{ {
Family: IPFamily(netlinkFamily), Family: types.IPFamily(netlinkFamily),
Address: testIPAddress, Address: testIPAddress,
Mask: "0", Mask: "0",
}, },
@ -207,7 +208,7 @@ func TestConvertRoutes(t *testing.T) {
}, },
} }
expected := []Route{ expected := []types.Route{
{ {
Dest: testIPAddress, Dest: testIPAddress,
Gateway: testIPAddress, Gateway: testIPAddress,
@ -241,7 +242,7 @@ func testSetupNetwork(t *testing.T) testTeardownNetwork {
} }
} }
func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, Interface) { func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, types.Interface) {
hwAddr, err := net.ParseMAC(testHwAddr) hwAddr, err := net.ParseMAC(testHwAddr)
assert.Nil(t, err) assert.Nil(t, err)
@ -262,7 +263,7 @@ func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, Interfa
attrs := link.Attrs() attrs := link.Attrs()
assert.NotNil(t, attrs) assert.NotNil(t, attrs)
iface := Interface{ iface := types.Interface{
Device: testIfaceName, Device: testIfaceName,
Name: testIfaceName, Name: testIfaceName,
Mtu: uint64(testMTU), Mtu: uint64(testMTU),
@ -284,7 +285,7 @@ func TestScanNetwork(t *testing.T) {
idx, expected := testCreateDummyNetwork(t, handler) idx, expected := testCreateDummyNetwork(t, handler)
n := &netmon{ n := &netmon{
netIfaces: make(map[int]Interface), netIfaces: make(map[int]types.Interface),
netHandler: handler, netHandler: handler,
} }
@ -295,9 +296,9 @@ func TestScanNetwork(t *testing.T) {
} }
func TestStoreDataToSend(t *testing.T) { func TestStoreDataToSend(t *testing.T) {
var got Interface var got types.Interface
expected := Interface{ expected := types.Interface{
Device: testIfaceName, Device: testIfaceName,
Name: testIfaceName, Name: testIfaceName,
Mtu: uint64(testMTU), Mtu: uint64(testMTU),
@ -394,15 +395,15 @@ func TestActionsCLI(t *testing.T) {
defer os.RemoveAll(testStorageParentPath) defer os.RemoveAll(testStorageParentPath)
// Test addInterfaceCLI // Test addInterfaceCLI
err = n.addInterfaceCLI(Interface{}) err = n.addInterfaceCLI(types.Interface{})
assert.Nil(t, err) assert.Nil(t, err)
// Test delInterfaceCLI // Test delInterfaceCLI
err = n.delInterfaceCLI(Interface{}) err = n.delInterfaceCLI(types.Interface{})
assert.Nil(t, err) assert.Nil(t, err)
// Test updateRoutesCLI // Test updateRoutesCLI
err = n.updateRoutesCLI([]Route{}) err = n.updateRoutesCLI([]types.Route{})
assert.Nil(t, err) assert.Nil(t, err)
tearDownNetworkCb := testSetupNetwork(t) tearDownNetworkCb := testSetupNetwork(t)
@ -460,8 +461,8 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
// Interface already exist in list // Interface already exist in list
n.netIfaces = make(map[int]Interface) n.netIfaces = make(map[int]types.Interface)
n.netIfaces[testIfaceIndex] = Interface{} n.netIfaces[testIfaceIndex] = types.Interface{}
ev = netlink.LinkUpdate{ ev = netlink.LinkUpdate{
Link: &netlink.Dummy{ Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{ LinkAttrs: netlink.LinkAttrs{
@ -474,7 +475,7 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
// Flags are not up and running // Flags are not up and running
n.netIfaces = make(map[int]Interface) n.netIfaces = make(map[int]types.Interface)
ev = netlink.LinkUpdate{ ev = netlink.LinkUpdate{
Link: &netlink.Dummy{ Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{ LinkAttrs: netlink.LinkAttrs{
@ -487,7 +488,7 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
// Invalid link // Invalid link
n.netIfaces = make(map[int]Interface) n.netIfaces = make(map[int]types.Interface)
ev = netlink.LinkUpdate{ ev = netlink.LinkUpdate{
Link: &netlink.Dummy{ Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{ LinkAttrs: netlink.LinkAttrs{
@ -528,7 +529,7 @@ func TestHandleRTMDelLink(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
// Interface does not exist in list // Interface does not exist in list
n.netIfaces = make(map[int]Interface) n.netIfaces = make(map[int]types.Interface)
ev = netlink.LinkUpdate{ ev = netlink.LinkUpdate{
Link: &netlink.Dummy{ Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{ LinkAttrs: netlink.LinkAttrs{
@ -543,7 +544,7 @@ func TestHandleRTMDelLink(t *testing.T) {
func TestHandleRTMNewRouteIfaceNotFound(t *testing.T) { func TestHandleRTMNewRouteIfaceNotFound(t *testing.T) {
n := &netmon{ n := &netmon{
netIfaces: make(map[int]Interface), netIfaces: make(map[int]types.Interface),
} }
err := n.handleRTMNewRoute(netlink.RouteUpdate{}) err := n.handleRTMNewRoute(netlink.RouteUpdate{})

File diff suppressed because it is too large Load Diff

View File

@ -165,6 +165,26 @@ func parse(sock string) (string, *url.URL, error) {
return grpcAddr, addr, nil return grpcAddr, addr, nil
} }
// This function is meant to run in a go routine since it will send ping
// commands every second. It behaves as a heartbeat to maintain a proper
// communication state with the Yamux server in the agent.
func heartBeat(session *yamux.Session) {
if session == nil {
return
}
for {
if session.IsClosed() {
break
}
session.Ping()
// 1 Hz heartbeat
time.Sleep(time.Second)
}
}
func agentDialer(addr *url.URL, enableYamux bool) dialer { func agentDialer(addr *url.URL, enableYamux bool) dialer {
var d dialer var d dialer
switch addr.Scheme { switch addr.Scheme {
@ -196,11 +216,15 @@ func agentDialer(addr *url.URL, enableYamux bool) dialer {
sessionConfig := yamux.DefaultConfig() sessionConfig := yamux.DefaultConfig()
// Disable keepAlive since we don't know how much time a container can be paused // Disable keepAlive since we don't know how much time a container can be paused
sessionConfig.EnableKeepAlive = false sessionConfig.EnableKeepAlive = false
sessionConfig.ConnectionWriteTimeout = time.Second
session, err = yamux.Client(conn, sessionConfig) session, err = yamux.Client(conn, sessionConfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Start the heartbeat in a separate go routine
go heartBeat(session)
var stream net.Conn var stream net.Conn
stream, err = session.Open() stream, err = session.Open()
if err != nil { if err != nil {

File diff suppressed because it is too large Load Diff

View File

@ -108,7 +108,10 @@ func init() {
} }
func (this *CheckRequest) Equal(that interface{}) bool { func (this *CheckRequest) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*CheckRequest) that1, ok := that.(*CheckRequest)
@ -121,7 +124,10 @@ func (this *CheckRequest) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -132,7 +138,10 @@ func (this *CheckRequest) Equal(that interface{}) bool {
} }
func (this *HealthCheckResponse) Equal(that interface{}) bool { func (this *HealthCheckResponse) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*HealthCheckResponse) that1, ok := that.(*HealthCheckResponse)
@ -145,7 +154,10 @@ func (this *HealthCheckResponse) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -156,7 +168,10 @@ func (this *HealthCheckResponse) Equal(that interface{}) bool {
} }
func (this *VersionCheckResponse) Equal(that interface{}) bool { func (this *VersionCheckResponse) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*VersionCheckResponse) that1, ok := that.(*VersionCheckResponse)
@ -169,7 +184,10 @@ func (this *VersionCheckResponse) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }

View File

@ -1499,7 +1499,10 @@ func init() {
} }
func (this *Spec) Equal(that interface{}) bool { func (this *Spec) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Spec) that1, ok := that.(*Spec)
@ -1512,7 +1515,10 @@ func (this *Spec) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1560,7 +1566,10 @@ func (this *Spec) Equal(that interface{}) bool {
} }
func (this *Process) Equal(that interface{}) bool { func (this *Process) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Process) that1, ok := that.(*Process)
@ -1573,7 +1582,10 @@ func (this *Process) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1632,7 +1644,10 @@ func (this *Process) Equal(that interface{}) bool {
} }
func (this *Box) Equal(that interface{}) bool { func (this *Box) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Box) that1, ok := that.(*Box)
@ -1645,7 +1660,10 @@ func (this *Box) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1659,7 +1677,10 @@ func (this *Box) Equal(that interface{}) bool {
} }
func (this *User) Equal(that interface{}) bool { func (this *User) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*User) that1, ok := that.(*User)
@ -1672,7 +1693,10 @@ func (this *User) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1697,7 +1721,10 @@ func (this *User) Equal(that interface{}) bool {
} }
func (this *LinuxCapabilities) Equal(that interface{}) bool { func (this *LinuxCapabilities) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxCapabilities) that1, ok := that.(*LinuxCapabilities)
@ -1710,7 +1737,10 @@ func (this *LinuxCapabilities) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1758,7 +1788,10 @@ func (this *LinuxCapabilities) Equal(that interface{}) bool {
} }
func (this *POSIXRlimit) Equal(that interface{}) bool { func (this *POSIXRlimit) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*POSIXRlimit) that1, ok := that.(*POSIXRlimit)
@ -1771,7 +1804,10 @@ func (this *POSIXRlimit) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1788,7 +1824,10 @@ func (this *POSIXRlimit) Equal(that interface{}) bool {
} }
func (this *Mount) Equal(that interface{}) bool { func (this *Mount) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Mount) that1, ok := that.(*Mount)
@ -1801,7 +1840,10 @@ func (this *Mount) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1826,7 +1868,10 @@ func (this *Mount) Equal(that interface{}) bool {
} }
func (this *Root) Equal(that interface{}) bool { func (this *Root) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Root) that1, ok := that.(*Root)
@ -1839,7 +1884,10 @@ func (this *Root) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1853,7 +1901,10 @@ func (this *Root) Equal(that interface{}) bool {
} }
func (this *Hooks) Equal(that interface{}) bool { func (this *Hooks) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Hooks) that1, ok := that.(*Hooks)
@ -1866,7 +1917,10 @@ func (this *Hooks) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1898,7 +1952,10 @@ func (this *Hooks) Equal(that interface{}) bool {
} }
func (this *Hook) Equal(that interface{}) bool { func (this *Hook) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Hook) that1, ok := that.(*Hook)
@ -1911,7 +1968,10 @@ func (this *Hook) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -1941,7 +2001,10 @@ func (this *Hook) Equal(that interface{}) bool {
} }
func (this *Linux) Equal(that interface{}) bool { func (this *Linux) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Linux) that1, ok := that.(*Linux)
@ -1954,7 +2017,10 @@ func (this *Linux) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2036,7 +2102,10 @@ func (this *Linux) Equal(that interface{}) bool {
} }
func (this *Windows) Equal(that interface{}) bool { func (this *Windows) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Windows) that1, ok := that.(*Windows)
@ -2049,7 +2118,10 @@ func (this *Windows) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2060,7 +2132,10 @@ func (this *Windows) Equal(that interface{}) bool {
} }
func (this *Solaris) Equal(that interface{}) bool { func (this *Solaris) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*Solaris) that1, ok := that.(*Solaris)
@ -2073,7 +2148,10 @@ func (this *Solaris) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2084,7 +2162,10 @@ func (this *Solaris) Equal(that interface{}) bool {
} }
func (this *LinuxIDMapping) Equal(that interface{}) bool { func (this *LinuxIDMapping) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxIDMapping) that1, ok := that.(*LinuxIDMapping)
@ -2097,7 +2178,10 @@ func (this *LinuxIDMapping) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2114,7 +2198,10 @@ func (this *LinuxIDMapping) Equal(that interface{}) bool {
} }
func (this *LinuxNamespace) Equal(that interface{}) bool { func (this *LinuxNamespace) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxNamespace) that1, ok := that.(*LinuxNamespace)
@ -2127,7 +2214,10 @@ func (this *LinuxNamespace) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2141,7 +2231,10 @@ func (this *LinuxNamespace) Equal(that interface{}) bool {
} }
func (this *LinuxDevice) Equal(that interface{}) bool { func (this *LinuxDevice) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxDevice) that1, ok := that.(*LinuxDevice)
@ -2154,7 +2247,10 @@ func (this *LinuxDevice) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2183,7 +2279,10 @@ func (this *LinuxDevice) Equal(that interface{}) bool {
} }
func (this *LinuxResources) Equal(that interface{}) bool { func (this *LinuxResources) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxResources) that1, ok := that.(*LinuxResources)
@ -2196,7 +2295,10 @@ func (this *LinuxResources) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2235,7 +2337,10 @@ func (this *LinuxResources) Equal(that interface{}) bool {
} }
func (this *LinuxMemory) Equal(that interface{}) bool { func (this *LinuxMemory) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxMemory) that1, ok := that.(*LinuxMemory)
@ -2248,7 +2353,10 @@ func (this *LinuxMemory) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2277,7 +2385,10 @@ func (this *LinuxMemory) Equal(that interface{}) bool {
} }
func (this *LinuxCPU) Equal(that interface{}) bool { func (this *LinuxCPU) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxCPU) that1, ok := that.(*LinuxCPU)
@ -2290,7 +2401,10 @@ func (this *LinuxCPU) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2319,7 +2433,10 @@ func (this *LinuxCPU) Equal(that interface{}) bool {
} }
func (this *LinuxWeightDevice) Equal(that interface{}) bool { func (this *LinuxWeightDevice) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxWeightDevice) that1, ok := that.(*LinuxWeightDevice)
@ -2332,7 +2449,10 @@ func (this *LinuxWeightDevice) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2352,7 +2472,10 @@ func (this *LinuxWeightDevice) Equal(that interface{}) bool {
} }
func (this *LinuxThrottleDevice) Equal(that interface{}) bool { func (this *LinuxThrottleDevice) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxThrottleDevice) that1, ok := that.(*LinuxThrottleDevice)
@ -2365,7 +2488,10 @@ func (this *LinuxThrottleDevice) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2382,7 +2508,10 @@ func (this *LinuxThrottleDevice) Equal(that interface{}) bool {
} }
func (this *LinuxBlockIO) Equal(that interface{}) bool { func (this *LinuxBlockIO) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxBlockIO) that1, ok := that.(*LinuxBlockIO)
@ -2395,7 +2524,10 @@ func (this *LinuxBlockIO) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2449,7 +2581,10 @@ func (this *LinuxBlockIO) Equal(that interface{}) bool {
} }
func (this *LinuxPids) Equal(that interface{}) bool { func (this *LinuxPids) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxPids) that1, ok := that.(*LinuxPids)
@ -2462,7 +2597,10 @@ func (this *LinuxPids) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2473,7 +2611,10 @@ func (this *LinuxPids) Equal(that interface{}) bool {
} }
func (this *LinuxDeviceCgroup) Equal(that interface{}) bool { func (this *LinuxDeviceCgroup) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxDeviceCgroup) that1, ok := that.(*LinuxDeviceCgroup)
@ -2486,7 +2627,10 @@ func (this *LinuxDeviceCgroup) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2509,7 +2653,10 @@ func (this *LinuxDeviceCgroup) Equal(that interface{}) bool {
} }
func (this *LinuxNetwork) Equal(that interface{}) bool { func (this *LinuxNetwork) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxNetwork) that1, ok := that.(*LinuxNetwork)
@ -2522,7 +2669,10 @@ func (this *LinuxNetwork) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2541,7 +2691,10 @@ func (this *LinuxNetwork) Equal(that interface{}) bool {
} }
func (this *LinuxHugepageLimit) Equal(that interface{}) bool { func (this *LinuxHugepageLimit) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxHugepageLimit) that1, ok := that.(*LinuxHugepageLimit)
@ -2554,7 +2707,10 @@ func (this *LinuxHugepageLimit) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2568,7 +2724,10 @@ func (this *LinuxHugepageLimit) Equal(that interface{}) bool {
} }
func (this *LinuxInterfacePriority) Equal(that interface{}) bool { func (this *LinuxInterfacePriority) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxInterfacePriority) that1, ok := that.(*LinuxInterfacePriority)
@ -2581,7 +2740,10 @@ func (this *LinuxInterfacePriority) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2595,7 +2757,10 @@ func (this *LinuxInterfacePriority) Equal(that interface{}) bool {
} }
func (this *LinuxSeccomp) Equal(that interface{}) bool { func (this *LinuxSeccomp) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxSeccomp) that1, ok := that.(*LinuxSeccomp)
@ -2608,7 +2773,10 @@ func (this *LinuxSeccomp) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2635,7 +2803,10 @@ func (this *LinuxSeccomp) Equal(that interface{}) bool {
} }
func (this *LinuxSeccompArg) Equal(that interface{}) bool { func (this *LinuxSeccompArg) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxSeccompArg) that1, ok := that.(*LinuxSeccompArg)
@ -2648,7 +2819,10 @@ func (this *LinuxSeccompArg) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2668,7 +2842,10 @@ func (this *LinuxSeccompArg) Equal(that interface{}) bool {
} }
func (this *LinuxSyscall) Equal(that interface{}) bool { func (this *LinuxSyscall) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxSyscall) that1, ok := that.(*LinuxSyscall)
@ -2681,7 +2858,10 @@ func (this *LinuxSyscall) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }
@ -2708,7 +2888,10 @@ func (this *LinuxSyscall) Equal(that interface{}) bool {
} }
func (this *LinuxIntelRdt) Equal(that interface{}) bool { func (this *LinuxIntelRdt) Equal(that interface{}) bool {
if that == nil { if that == nil {
return this == nil if this == nil {
return true
}
return false
} }
that1, ok := that.(*LinuxIntelRdt) that1, ok := that.(*LinuxIntelRdt)
@ -2721,7 +2904,10 @@ func (this *LinuxIntelRdt) Equal(that interface{}) bool {
} }
} }
if that1 == nil { if that1 == nil {
return this == nil if this == nil {
return true
}
return false
} else if this == nil { } else if this == nil {
return false return false
} }

View File

@ -25,6 +25,8 @@ type Spec struct {
Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"` Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
// Windows is platform-specific configuration for Windows based containers. // Windows is platform-specific configuration for Windows based containers.
Windows *Windows `json:"windows,omitempty" platform:"windows"` Windows *Windows `json:"windows,omitempty" platform:"windows"`
// VM specifies configuration for virtual-machine-based containers.
VM *VM `json:"vm,omitempty" platform:"vm"`
} }
// Process contains information to start a specific application inside the container. // Process contains information to start a specific application inside the container.
@ -158,8 +160,8 @@ type Linux struct {
ReadonlyPaths []string `json:"readonlyPaths,omitempty"` ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
// MountLabel specifies the selinux context for the mounts in the container. // MountLabel specifies the selinux context for the mounts in the container.
MountLabel string `json:"mountLabel,omitempty"` MountLabel string `json:"mountLabel,omitempty"`
// IntelRdt contains Intel Resource Director Technology (RDT) information // IntelRdt contains Intel Resource Director Technology (RDT) information for
// for handling resource constraints (e.g., L3 cache) for the container // handling resource constraints (e.g., L3 cache, memory bandwidth) for the container
IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"` IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
} }
@ -194,10 +196,10 @@ const (
// LinuxIDMapping specifies UID/GID mappings // LinuxIDMapping specifies UID/GID mappings
type LinuxIDMapping struct { type LinuxIDMapping struct {
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
HostID uint32 `json:"hostID"`
// ContainerID is the starting UID/GID in the container // ContainerID is the starting UID/GID in the container
ContainerID uint32 `json:"containerID"` ContainerID uint32 `json:"containerID"`
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
HostID uint32 `json:"hostID"`
// Size is the number of IDs to be mapped // Size is the number of IDs to be mapped
Size uint32 `json:"size"` Size uint32 `json:"size"`
} }
@ -320,6 +322,14 @@ type LinuxNetwork struct {
Priorities []LinuxInterfacePriority `json:"priorities,omitempty"` Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
} }
// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
type LinuxRdma struct {
// Maximum number of HCA handles that can be opened. Default is "no limit".
HcaHandles *uint32 `json:"hcaHandles,omitempty"`
// Maximum number of HCA objects that can be created. Default is "no limit".
HcaObjects *uint32 `json:"hcaObjects,omitempty"`
}
// LinuxResources has container runtime resource constraints // LinuxResources has container runtime resource constraints
type LinuxResources struct { type LinuxResources struct {
// Devices configures the device whitelist. // Devices configures the device whitelist.
@ -336,6 +346,10 @@ type LinuxResources struct {
HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"` HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
// Network restriction configuration // Network restriction configuration
Network *LinuxNetwork `json:"network,omitempty"` Network *LinuxNetwork `json:"network,omitempty"`
// Rdma resource restriction configuration.
// Limits are a set of key value pairs that define RDMA resource limits,
// where the key is device name and value is resource limits.
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
} }
// LinuxDevice represents the mknod information for a Linux special device file // LinuxDevice represents the mknod information for a Linux special device file
@ -419,6 +433,8 @@ type SolarisAnet struct {
type Windows struct { type Windows struct {
// LayerFolders contains a list of absolute paths to directories containing image layers. // LayerFolders contains a list of absolute paths to directories containing image layers.
LayerFolders []string `json:"layerFolders"` LayerFolders []string `json:"layerFolders"`
// Devices are the list of devices to be mapped into the container.
Devices []WindowsDevice `json:"devices,omitempty"`
// Resources contains information for handling resource constraints for the container. // Resources contains information for handling resource constraints for the container.
Resources *WindowsResources `json:"resources,omitempty"` Resources *WindowsResources `json:"resources,omitempty"`
// CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification. // CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
@ -433,6 +449,14 @@ type Windows struct {
Network *WindowsNetwork `json:"network,omitempty"` Network *WindowsNetwork `json:"network,omitempty"`
} }
// WindowsDevice represents information about a host device to be mapped into the container.
type WindowsDevice struct {
// Device identifier: interface class GUID, etc.
ID string `json:"id"`
// Device identifier type: "class", etc.
IDType string `json:"idType"`
}
// WindowsResources has container runtime resource constraints for containers running on Windows. // WindowsResources has container runtime resource constraints for containers running on Windows.
type WindowsResources struct { type WindowsResources struct {
// Memory restriction configuration. // Memory restriction configuration.
@ -479,6 +503,8 @@ type WindowsNetwork struct {
DNSSearchList []string `json:"DNSSearchList,omitempty"` DNSSearchList []string `json:"DNSSearchList,omitempty"`
// Name (ID) of the container that we will share with the network stack. // Name (ID) of the container that we will share with the network stack.
NetworkSharedContainerName string `json:"networkSharedContainerName,omitempty"` NetworkSharedContainerName string `json:"networkSharedContainerName,omitempty"`
// name (ID) of the network namespace that will be used for the container.
NetworkNamespace string `json:"networkNamespace,omitempty"`
} }
// WindowsHyperV contains information for configuring a container to run with Hyper-V isolation. // WindowsHyperV contains information for configuring a container to run with Hyper-V isolation.
@ -487,6 +513,42 @@ type WindowsHyperV struct {
UtilityVMPath string `json:"utilityVMPath,omitempty"` UtilityVMPath string `json:"utilityVMPath,omitempty"`
} }
// VM contains information for virtual-machine-based containers.
type VM struct {
// Hypervisor specifies hypervisor-related configuration for virtual-machine-based containers.
Hypervisor VMHypervisor `json:"hypervisor,omitempty"`
// Kernel specifies kernel-related configuration for virtual-machine-based containers.
Kernel VMKernel `json:"kernel"`
// Image specifies guest image related configuration for virtual-machine-based containers.
Image VMImage `json:"image,omitempty"`
}
// VMHypervisor contains information about the hypervisor to use for a virtual machine.
type VMHypervisor struct {
// Path is the host path to the hypervisor used to manage the virtual machine.
Path string `json:"path"`
// Parameters specifies parameters to pass to the hypervisor.
Parameters string `json:"parameters,omitempty"`
}
// VMKernel contains information about the kernel to use for a virtual machine.
type VMKernel struct {
// Path is the host path to the kernel used to boot the virtual machine.
Path string `json:"path"`
// Parameters specifies parameters to pass to the kernel.
Parameters string `json:"parameters,omitempty"`
// InitRD is the host path to an initial ramdisk to be used by the kernel.
InitRD string `json:"initrd,omitempty"`
}
// VMImage contains information about the virtual machine root image.
type VMImage struct {
// Path is the host path to the root image that the VM kernel would boot into.
Path string `json:"path"`
// Format is the root image format type (e.g. "qcow2", "raw", "vhd", etc).
Format string `json:"format"`
}
// LinuxSeccomp represents syscall restrictions // LinuxSeccomp represents syscall restrictions
type LinuxSeccomp struct { type LinuxSeccomp struct {
DefaultAction LinuxSeccompAction `json:"defaultAction"` DefaultAction LinuxSeccompAction `json:"defaultAction"`
@ -561,10 +623,16 @@ type LinuxSyscall struct {
Args []LinuxSeccompArg `json:"args,omitempty"` Args []LinuxSeccompArg `json:"args,omitempty"`
} }
// LinuxIntelRdt has container runtime resource constraints // LinuxIntelRdt has container runtime resource constraints for Intel RDT
// for Intel RDT/CAT which introduced in Linux 4.10 kernel // CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel
type LinuxIntelRdt struct { type LinuxIntelRdt struct {
// The identity for RDT Class of Service
ClosID string `json:"closID,omitempty"`
// The schema for L3 cache id and capacity bitmask (CBM) // The schema for L3 cache id and capacity bitmask (CBM)
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..." // Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
L3CacheSchema string `json:"l3CacheSchema,omitempty"` L3CacheSchema string `json:"l3CacheSchema,omitempty"`
// The schema of memory bandwidth percentage per L3 cache id
// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
MemBwSchema string `json:"memBwSchema,omitempty"`
} }

View File

@ -11,7 +11,7 @@ const (
VersionPatch = 1 VersionPatch = 1
// VersionDev indicates development branch. Releases will be empty string. // VersionDev indicates development branch. Releases will be empty string.
VersionDev = "" VersionDev = "-dev"
) )
// Version is the specification version that the package types support. // Version is the specification version that the package types support.

View File

@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"syscall" "syscall"
"github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/protocols/grpc"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -229,16 +230,16 @@ type agent interface {
reseedRNG(data []byte) error reseedRNG(data []byte) error
// updateInterface will tell the agent to update a nic for an existed Sandbox. // updateInterface will tell the agent to update a nic for an existed Sandbox.
updateInterface(inf *grpc.Interface) (*grpc.Interface, error) updateInterface(inf *types.Interface) (*types.Interface, error)
// listInterfaces will tell the agent to list interfaces of an existed Sandbox // listInterfaces will tell the agent to list interfaces of an existed Sandbox
listInterfaces() ([]*grpc.Interface, error) listInterfaces() ([]*types.Interface, error)
// updateRoutes will tell the agent to update route table for an existed Sandbox. // updateRoutes will tell the agent to update route table for an existed Sandbox.
updateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) updateRoutes(routes []*types.Route) ([]*types.Route, error)
// listRoutes will tell the agent to list routes of an existed Sandbox // listRoutes will tell the agent to list routes of an existed Sandbox
listRoutes() ([]*grpc.Route, error) listRoutes() ([]*types.Route, error)
// getGuestDetails will tell the agent to get some information of guest // getGuestDetails will tell the agent to get some information of guest
getGuestDetails(*grpc.GuestDetailsRequest) (*grpc.GuestDetailsResponse, error) getGuestDetails(*grpc.GuestDetailsRequest) (*grpc.GuestDetailsResponse, error)

View File

@ -11,7 +11,7 @@ import (
"runtime" "runtime"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
deviceApi "github.com/kata-containers/runtime/virtcontainers/device/api" deviceApi "github.com/kata-containers/runtime/virtcontainers/device/api"
deviceConfig "github.com/kata-containers/runtime/virtcontainers/device/config" deviceConfig "github.com/kata-containers/runtime/virtcontainers/device/config"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -867,7 +867,7 @@ func AddDevice(ctx context.Context, sandboxID string, info deviceConfig.DeviceIn
return s.AddDevice(info) return s.AddDevice(info)
} }
func toggleInterface(ctx context.Context, sandboxID string, inf *grpc.Interface, add bool) (*grpc.Interface, error) { func toggleInterface(ctx context.Context, sandboxID string, inf *types.Interface, add bool) (*types.Interface, error) {
if sandboxID == "" { if sandboxID == "" {
return nil, errNeedSandboxID return nil, errNeedSandboxID
} }
@ -892,7 +892,7 @@ func toggleInterface(ctx context.Context, sandboxID string, inf *grpc.Interface,
} }
// AddInterface is the virtcontainers add interface entry point. // AddInterface is the virtcontainers add interface entry point.
func AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
span, ctx := trace(ctx, "AddInterface") span, ctx := trace(ctx, "AddInterface")
defer span.Finish() defer span.Finish()
@ -900,7 +900,7 @@ func AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*
} }
// RemoveInterface is the virtcontainers remove interface entry point. // RemoveInterface is the virtcontainers remove interface entry point.
func RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
span, ctx := trace(ctx, "RemoveInterface") span, ctx := trace(ctx, "RemoveInterface")
defer span.Finish() defer span.Finish()
@ -908,7 +908,7 @@ func RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface)
} }
// ListInterfaces is the virtcontainers list interfaces entry point. // ListInterfaces is the virtcontainers list interfaces entry point.
func ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) { func ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
span, ctx := trace(ctx, "ListInterfaces") span, ctx := trace(ctx, "ListInterfaces")
defer span.Finish() defer span.Finish()
@ -932,7 +932,7 @@ func ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, e
} }
// UpdateRoutes is the virtcontainers update routes entry point. // UpdateRoutes is the virtcontainers update routes entry point.
func UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) { func UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
span, ctx := trace(ctx, "UpdateRoutes") span, ctx := trace(ctx, "UpdateRoutes")
defer span.Finish() defer span.Finish()
@ -956,7 +956,7 @@ func UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) (
} }
// ListRoutes is the virtcontainers list routes entry point. // ListRoutes is the virtcontainers list routes entry point.
func ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) { func ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
span, ctx := trace(ctx, "ListRoutes") span, ctx := trace(ctx, "ListRoutes")
defer span.Finish() defer span.Finish()

View File

@ -18,7 +18,7 @@ import (
"testing" "testing"
"github.com/containernetworking/plugins/pkg/ns" "github.com/containernetworking/plugins/pkg/ns"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/mock" "github.com/kata-containers/runtime/virtcontainers/pkg/mock"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -2422,12 +2422,12 @@ func TestNetworkOperation(t *testing.T) {
cleanUp() cleanUp()
assert := assert.New(t) assert := assert.New(t)
inf := &grpc.Interface{ inf := &types.Interface{
Name: "eno1", Name: "eno1",
Mtu: 1500, Mtu: 1500,
HwAddr: "02:00:ca:fe:00:48", HwAddr: "02:00:ca:fe:00:48",
} }
ip := grpc.IPAddress{ ip := types.IPAddress{
Family: 0, Family: 0,
Address: "192.168.0.101", Address: "192.168.0.101",
Mask: "24", Mask: "24",

View File

@ -18,6 +18,7 @@ import (
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
proxyClient "github.com/clearcontainers/proxy/client" proxyClient "github.com/clearcontainers/proxy/client"
"github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/hyperstart" "github.com/kata-containers/runtime/virtcontainers/pkg/hyperstart"
@ -888,22 +889,22 @@ func (h *hyper) onlineCPUMem(cpus uint32, cpuOnly bool) error {
return nil return nil
} }
func (h *hyper) updateInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (h *hyper) updateInterface(inf *types.Interface) (*types.Interface, error) {
// hyperstart-agent does not support update interface // hyperstart-agent does not support update interface
return nil, nil return nil, nil
} }
func (h *hyper) listInterfaces() ([]*grpc.Interface, error) { func (h *hyper) listInterfaces() ([]*types.Interface, error) {
// hyperstart-agent does not support list interfaces // hyperstart-agent does not support list interfaces
return nil, nil return nil, nil
} }
func (h *hyper) updateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) { func (h *hyper) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
// hyperstart-agent does not support update routes // hyperstart-agent does not support update routes
return nil, nil return nil, nil
} }
func (h *hyper) listRoutes() ([]*grpc.Route, error) { func (h *hyper) listRoutes() ([]*types.Route, error) {
// hyperstart-agent does not support list routes // hyperstart-agent does not support list routes
return nil, nil return nil, nil
} }

View File

@ -13,7 +13,7 @@ import (
"context" "context"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -152,26 +152,26 @@ func (impl *VCImpl) AddDevice(ctx context.Context, sandboxID string, info config
} }
// AddInterface implements the VC function of the same name. // AddInterface implements the VC function of the same name.
func (impl *VCImpl) AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func (impl *VCImpl) AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
return AddInterface(ctx, sandboxID, inf) return AddInterface(ctx, sandboxID, inf)
} }
// RemoveInterface implements the VC function of the same name. // RemoveInterface implements the VC function of the same name.
func (impl *VCImpl) RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func (impl *VCImpl) RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
return RemoveInterface(ctx, sandboxID, inf) return RemoveInterface(ctx, sandboxID, inf)
} }
// ListInterfaces implements the VC function of the same name. // ListInterfaces implements the VC function of the same name.
func (impl *VCImpl) ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) { func (impl *VCImpl) ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
return ListInterfaces(ctx, sandboxID) return ListInterfaces(ctx, sandboxID)
} }
// UpdateRoutes implements the VC function of the same name. // UpdateRoutes implements the VC function of the same name.
func (impl *VCImpl) UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) { func (impl *VCImpl) UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
return UpdateRoutes(ctx, sandboxID, routes) return UpdateRoutes(ctx, sandboxID, routes)
} }
// ListRoutes implements the VC function of the same name. // ListRoutes implements the VC function of the same name.
func (impl *VCImpl) ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) { func (impl *VCImpl) ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
return ListRoutes(ctx, sandboxID) return ListRoutes(ctx, sandboxID)
} }

View File

@ -10,7 +10,7 @@ import (
"io" "io"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -48,11 +48,11 @@ type VC interface {
AddDevice(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error) AddDevice(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error)
AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error)
UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error)
ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error)
} }
// VCSandbox is the Sandbox interface // VCSandbox is the Sandbox interface
@ -86,11 +86,11 @@ type VCSandbox interface {
AddDevice(info config.DeviceInfo) (api.Device, error) AddDevice(info config.DeviceInfo) (api.Device, error)
AddInterface(inf *grpc.Interface) (*grpc.Interface, error) AddInterface(inf *types.Interface) (*types.Interface, error)
RemoveInterface(inf *grpc.Interface) (*grpc.Interface, error) RemoveInterface(inf *types.Interface) (*types.Interface, error)
ListInterfaces() ([]*grpc.Interface, error) ListInterfaces() ([]*types.Interface, error)
UpdateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) UpdateRoutes(routes []*types.Route) ([]*types.Route, error)
ListRoutes() ([]*grpc.Route, error) ListRoutes() ([]*types.Route, error)
} }
// VCContainer is the Container interface // VCContainer is the Container interface

View File

@ -18,6 +18,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/kata-containers/agent/pkg/types"
kataclient "github.com/kata-containers/agent/protocols/client" kataclient "github.com/kata-containers/agent/protocols/client"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -383,7 +384,7 @@ func (k *kataAgent) exec(sandbox *Sandbox, c Container, cmd Cmd) (*Process, erro
k.state.URL, cmd, []ns.NSType{}, enterNSList) k.state.URL, cmd, []ns.NSType{}, enterNSList)
} }
func (k *kataAgent) updateInterface(ifc *grpc.Interface) (*grpc.Interface, error) { func (k *kataAgent) updateInterface(ifc *types.Interface) (*types.Interface, error) {
// send update interface request // send update interface request
ifcReq := &grpc.UpdateInterfaceRequest{ ifcReq := &grpc.UpdateInterfaceRequest{
Interface: ifc, Interface: ifc,
@ -395,13 +396,13 @@ func (k *kataAgent) updateInterface(ifc *grpc.Interface) (*grpc.Interface, error
"resulting-interface": fmt.Sprintf("%+v", resultingInterface), "resulting-interface": fmt.Sprintf("%+v", resultingInterface),
}).WithError(err).Error("update interface request failed") }).WithError(err).Error("update interface request failed")
} }
if resultInterface, ok := resultingInterface.(*grpc.Interface); ok { if resultInterface, ok := resultingInterface.(*types.Interface); ok {
return resultInterface, err return resultInterface, err
} }
return nil, err return nil, err
} }
func (k *kataAgent) updateInterfaces(interfaces []*grpc.Interface) error { func (k *kataAgent) updateInterfaces(interfaces []*types.Interface) error {
for _, ifc := range interfaces { for _, ifc := range interfaces {
if _, err := k.updateInterface(ifc); err != nil { if _, err := k.updateInterface(ifc); err != nil {
return err return err
@ -410,7 +411,7 @@ func (k *kataAgent) updateInterfaces(interfaces []*grpc.Interface) error {
return nil return nil
} }
func (k *kataAgent) updateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) { func (k *kataAgent) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
if routes != nil { if routes != nil {
routesReq := &grpc.UpdateRoutesRequest{ routesReq := &grpc.UpdateRoutesRequest{
Routes: &grpc.Routes{ Routes: &grpc.Routes{
@ -433,7 +434,7 @@ func (k *kataAgent) updateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) {
return nil, nil return nil, nil
} }
func (k *kataAgent) listInterfaces() ([]*grpc.Interface, error) { func (k *kataAgent) listInterfaces() ([]*types.Interface, error) {
req := &grpc.ListInterfacesRequest{} req := &grpc.ListInterfacesRequest{}
resultingInterfaces, err := k.sendReq(req) resultingInterfaces, err := k.sendReq(req)
if err != nil { if err != nil {
@ -446,7 +447,7 @@ func (k *kataAgent) listInterfaces() ([]*grpc.Interface, error) {
return nil, err return nil, err
} }
func (k *kataAgent) listRoutes() ([]*grpc.Route, error) { func (k *kataAgent) listRoutes() ([]*types.Route, error) {
req := &grpc.ListRoutesRequest{} req := &grpc.ListRoutesRequest{}
resultingRoutes, err := k.sendReq(req) resultingRoutes, err := k.sendReq(req)
if err != nil { if err != nil {

View File

@ -23,6 +23,7 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/kata-containers/agent/pkg/types"
pb "github.com/kata-containers/agent/protocols/grpc" pb "github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -184,16 +185,16 @@ func (p *gRPCProxy) DestroySandbox(ctx context.Context, req *pb.DestroySandboxRe
return emptyResp, nil return emptyResp, nil
} }
func (p *gRPCProxy) AddInterface(ctx context.Context, req *pb.AddInterfaceRequest) (*pb.Interface, error) { func (p *gRPCProxy) AddInterface(ctx context.Context, req *pb.AddInterfaceRequest) (*types.Interface, error) {
return nil, nil return nil, nil
} }
func (p *gRPCProxy) RemoveInterface(ctx context.Context, req *pb.RemoveInterfaceRequest) (*pb.Interface, error) { func (p *gRPCProxy) RemoveInterface(ctx context.Context, req *pb.RemoveInterfaceRequest) (*types.Interface, error) {
return nil, nil return nil, nil
} }
func (p *gRPCProxy) UpdateInterface(ctx context.Context, req *pb.UpdateInterfaceRequest) (*pb.Interface, error) { func (p *gRPCProxy) UpdateInterface(ctx context.Context, req *pb.UpdateInterfaceRequest) (*types.Interface, error) {
return &pb.Interface{}, nil return &types.Interface{}, nil
} }
func (p *gRPCProxy) UpdateRoutes(ctx context.Context, req *pb.UpdateRoutesRequest) (*pb.Routes, error) { func (p *gRPCProxy) UpdateRoutes(ctx context.Context, req *pb.UpdateRoutesRequest) (*pb.Routes, error) {
@ -799,7 +800,7 @@ func TestAgentNetworkOperation(t *testing.T) {
_, err = k.listInterfaces() _, err = k.listInterfaces()
assert.Nil(err) assert.Nil(err)
_, err = k.updateRoutes([]*pb.Route{}) _, err = k.updateRoutes([]*types.Route{})
assert.Nil(err) assert.Nil(err)
_, err = k.listRoutes() _, err = k.listRoutes()

View File

@ -22,7 +22,7 @@ import (
"github.com/vishvananda/netns" "github.com/vishvananda/netns"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid" "github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/utils" "github.com/kata-containers/runtime/virtcontainers/utils"
) )
@ -1148,18 +1148,18 @@ func deleteNetNS(netNSPath string) error {
return nil return nil
} }
func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*grpc.Interface, []*grpc.Route, error) { func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*types.Interface, []*types.Route, error) {
if networkNS.NetNsPath == "" { if networkNS.NetNsPath == "" {
return nil, nil, nil return nil, nil, nil
} }
var routes []*grpc.Route var routes []*types.Route
var ifaces []*grpc.Interface var ifaces []*types.Interface
for _, endpoint := range networkNS.Endpoints { for _, endpoint := range networkNS.Endpoints {
var ipAddresses []*grpc.IPAddress var ipAddresses []*types.IPAddress
for _, addr := range endpoint.Properties().Addrs { for _, addr := range endpoint.Properties().Addrs {
// Skip IPv6 because not supported // Skip IPv6 because not supported
if addr.IP.To4() == nil { if addr.IP.To4() == nil {
@ -1175,14 +1175,14 @@ func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*grpc.Interface,
continue continue
} }
netMask, _ := addr.Mask.Size() netMask, _ := addr.Mask.Size()
ipAddress := grpc.IPAddress{ ipAddress := types.IPAddress{
Family: grpc.IPFamily_v4, Family: types.IPFamily_v4,
Address: addr.IP.String(), Address: addr.IP.String(),
Mask: fmt.Sprintf("%d", netMask), Mask: fmt.Sprintf("%d", netMask),
} }
ipAddresses = append(ipAddresses, &ipAddress) ipAddresses = append(ipAddresses, &ipAddress)
} }
ifc := grpc.Interface{ ifc := types.Interface{
IPAddresses: ipAddresses, IPAddresses: ipAddresses,
Device: endpoint.Name(), Device: endpoint.Name(),
Name: endpoint.Name(), Name: endpoint.Name(),
@ -1193,7 +1193,7 @@ func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*grpc.Interface,
ifaces = append(ifaces, &ifc) ifaces = append(ifaces, &ifc)
for _, route := range endpoint.Properties().Routes { for _, route := range endpoint.Properties().Routes {
var r grpc.Route var r types.Route
if route.Dst != nil { if route.Dst != nil {
r.Dest = route.Dst.String() r.Dest = route.Dst.String()

View File

@ -11,7 +11,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
) )
@ -161,16 +161,16 @@ func TestGenerateInterfacesAndRoutes(t *testing.T) {
// //
// Build expected results: // Build expected results:
// //
expectedAddresses := []*grpc.IPAddress{ expectedAddresses := []*types.IPAddress{
{Family: 0, Address: "172.17.0.2", Mask: "16"}, {Family: 0, Address: "172.17.0.2", Mask: "16"},
{Family: 0, Address: "182.17.0.2", Mask: "16"}, {Family: 0, Address: "182.17.0.2", Mask: "16"},
} }
expectedInterfaces := []*grpc.Interface{ expectedInterfaces := []*types.Interface{
{Device: "eth0", Name: "eth0", IPAddresses: expectedAddresses, Mtu: 1500, HwAddr: "02:00:ca:fe:00:04"}, {Device: "eth0", Name: "eth0", IPAddresses: expectedAddresses, Mtu: 1500, HwAddr: "02:00:ca:fe:00:04"},
} }
expectedRoutes := []*grpc.Route{ expectedRoutes := []*types.Route{
{Dest: "", Gateway: "172.17.0.1", Device: "eth0", Source: "", Scope: uint32(254)}, {Dest: "", Gateway: "172.17.0.1", Device: "eth0", Source: "", Scope: uint32(254)},
{Dest: "172.17.0.0/16", Gateway: "172.17.0.1", Device: "eth0", Source: "172.17.0.2"}, {Dest: "172.17.0.0/16", Gateway: "172.17.0.1", Device: "eth0", Source: "172.17.0.2"},
} }

View File

@ -8,6 +8,7 @@ package virtcontainers
import ( import (
"syscall" "syscall"
"github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/protocols/grpc"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -94,22 +95,22 @@ func (n *noopAgent) onlineCPUMem(cpus uint32, cpuOnly bool) error {
} }
// updateInterface is the Noop agent Interface update implementation. It does nothing. // updateInterface is the Noop agent Interface update implementation. It does nothing.
func (n *noopAgent) updateInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (n *noopAgent) updateInterface(inf *types.Interface) (*types.Interface, error) {
return nil, nil return nil, nil
} }
// listInterfaces is the Noop agent Interfaces list implementation. It does nothing. // listInterfaces is the Noop agent Interfaces list implementation. It does nothing.
func (n *noopAgent) listInterfaces() ([]*grpc.Interface, error) { func (n *noopAgent) listInterfaces() ([]*types.Interface, error) {
return nil, nil return nil, nil
} }
// updateRoutes is the Noop agent Routes update implementation. It does nothing. // updateRoutes is the Noop agent Routes update implementation. It does nothing.
func (n *noopAgent) updateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) { func (n *noopAgent) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
return nil, nil return nil, nil
} }
// listRoutes is the Noop agent Routes list implementation. It does nothing. // listRoutes is the Noop agent Routes list implementation. It does nothing.
func (n *noopAgent) listRoutes() ([]*grpc.Route, error) { func (n *noopAgent) listRoutes() ([]*types.Route, error) {
return nil, nil return nil, nil
} }

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -254,7 +254,7 @@ func (m *VCMock) AddDevice(ctx context.Context, sandboxID string, info config.De
} }
// AddInterface implements the VC function of the same name. // AddInterface implements the VC function of the same name.
func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
if m.AddInterfaceFunc != nil { if m.AddInterfaceFunc != nil {
return m.AddInterfaceFunc(ctx, sandboxID, inf) return m.AddInterfaceFunc(ctx, sandboxID, inf)
} }
@ -263,7 +263,7 @@ func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *grpc.I
} }
// RemoveInterface implements the VC function of the same name. // RemoveInterface implements the VC function of the same name.
func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) { func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
if m.RemoveInterfaceFunc != nil { if m.RemoveInterfaceFunc != nil {
return m.RemoveInterfaceFunc(ctx, sandboxID, inf) return m.RemoveInterfaceFunc(ctx, sandboxID, inf)
} }
@ -272,7 +272,7 @@ func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *grp
} }
// ListInterfaces implements the VC function of the same name. // ListInterfaces implements the VC function of the same name.
func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) { func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
if m.ListInterfacesFunc != nil { if m.ListInterfacesFunc != nil {
return m.ListInterfacesFunc(ctx, sandboxID) return m.ListInterfacesFunc(ctx, sandboxID)
} }
@ -281,7 +281,7 @@ func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.
} }
// UpdateRoutes implements the VC function of the same name. // UpdateRoutes implements the VC function of the same name.
func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) { func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
if m.UpdateRoutesFunc != nil { if m.UpdateRoutesFunc != nil {
return m.UpdateRoutesFunc(ctx, sandboxID, routes) return m.UpdateRoutesFunc(ctx, sandboxID, routes)
} }
@ -290,7 +290,7 @@ func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*g
} }
// ListRoutes implements the VC function of the same name. // ListRoutes implements the VC function of the same name.
func (m *VCMock) ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) { func (m *VCMock) ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
if m.ListRoutesFunc != nil { if m.ListRoutesFunc != nil {
return m.ListRoutesFunc(ctx, sandboxID) return m.ListRoutesFunc(ctx, sandboxID)
} }

View File

@ -11,7 +11,7 @@ import (
"syscall" "syscall"
"testing" "testing"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/factory" "github.com/kata-containers/runtime/virtcontainers/factory"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -748,7 +748,7 @@ func TestVCMockAddInterface(t *testing.T) {
assert.Error(err) assert.Error(err)
assert.True(IsMockError(err)) assert.True(IsMockError(err))
m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *grpc.Interface) (*grpc.Interface, error) { m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *types.Interface) (*types.Interface, error) {
return nil, nil return nil, nil
} }
@ -775,7 +775,7 @@ func TestVCMockRemoveInterface(t *testing.T) {
assert.Error(err) assert.Error(err)
assert.True(IsMockError(err)) assert.True(IsMockError(err))
m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *grpc.Interface) (*grpc.Interface, error) { m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *types.Interface) (*types.Interface, error) {
return nil, nil return nil, nil
} }
@ -802,7 +802,7 @@ func TestVCMockListInterfaces(t *testing.T) {
assert.Error(err) assert.Error(err)
assert.True(IsMockError(err)) assert.True(IsMockError(err))
m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*grpc.Interface, error) { m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*types.Interface, error) {
return nil, nil return nil, nil
} }
@ -829,7 +829,7 @@ func TestVCMockUpdateRoutes(t *testing.T) {
assert.Error(err) assert.Error(err)
assert.True(IsMockError(err)) assert.True(IsMockError(err))
m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*grpc.Route) ([]*grpc.Route, error) { m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*types.Route) ([]*types.Route, error) {
return nil, nil return nil, nil
} }
@ -856,7 +856,7 @@ func TestVCMockListRoutes(t *testing.T) {
assert.Error(err) assert.Error(err)
assert.True(IsMockError(err)) assert.True(IsMockError(err))
m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*grpc.Route, error) { m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*types.Route, error) {
return nil, nil return nil, nil
} }

View File

@ -9,7 +9,7 @@ import (
"io" "io"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -153,26 +153,26 @@ func (s *Sandbox) AddDevice(info config.DeviceInfo) (api.Device, error) {
} }
// AddInterface implements the VCSandbox function of the same name. // AddInterface implements the VCSandbox function of the same name.
func (s *Sandbox) AddInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (s *Sandbox) AddInterface(inf *types.Interface) (*types.Interface, error) {
return nil, nil return nil, nil
} }
// RemoveInterface implements the VCSandbox function of the same name. // RemoveInterface implements the VCSandbox function of the same name.
func (s *Sandbox) RemoveInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (s *Sandbox) RemoveInterface(inf *types.Interface) (*types.Interface, error) {
return nil, nil return nil, nil
} }
// ListInterfaces implements the VCSandbox function of the same name. // ListInterfaces implements the VCSandbox function of the same name.
func (s *Sandbox) ListInterfaces() ([]*grpc.Interface, error) { func (s *Sandbox) ListInterfaces() ([]*types.Interface, error) {
return nil, nil return nil, nil
} }
// UpdateRoutes implements the VCSandbox function of the same name. // UpdateRoutes implements the VCSandbox function of the same name.
func (s *Sandbox) UpdateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) { func (s *Sandbox) UpdateRoutes(routes []*types.Route) ([]*types.Route, error) {
return nil, nil return nil, nil
} }
// ListRoutes implements the VCSandbox function of the same name. // ListRoutes implements the VCSandbox function of the same name.
func (s *Sandbox) ListRoutes() ([]*grpc.Route, error) { func (s *Sandbox) ListRoutes() ([]*types.Route, error) {
return nil, nil return nil, nil
} }

View File

@ -9,7 +9,7 @@ import (
"context" "context"
"syscall" "syscall"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/pkg/types"
vc "github.com/kata-containers/runtime/virtcontainers" vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -69,9 +69,9 @@ type VCMock struct {
AddDeviceFunc func(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error) AddDeviceFunc func(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error)
AddInterfaceFunc func(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) AddInterfaceFunc func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
RemoveInterfaceFunc func(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) RemoveInterfaceFunc func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
ListInterfacesFunc func(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) ListInterfacesFunc func(ctx context.Context, sandboxID string) ([]*types.Interface, error)
UpdateRoutesFunc func(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) UpdateRoutesFunc func(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error)
ListRoutesFunc func(ctx context.Context, sandboxID string) ([]*grpc.Route, error) ListRoutesFunc func(ctx context.Context, sandboxID string) ([]*types.Route, error)
} }

View File

@ -21,6 +21,7 @@ import (
opentracing "github.com/opentracing/opentracing-go" opentracing "github.com/opentracing/opentracing-go"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/kata-containers/agent/pkg/types"
"github.com/kata-containers/agent/protocols/grpc" "github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/device/api" "github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/config"
@ -1076,7 +1077,7 @@ func (s *Sandbox) removeNetwork() error {
return s.network.remove(s) return s.network.remove(s)
} }
func (s *Sandbox) generateNetInfo(inf *grpc.Interface) (NetworkInfo, error) { func (s *Sandbox) generateNetInfo(inf *types.Interface) (NetworkInfo, error) {
hw, err := net.ParseMAC(inf.HwAddr) hw, err := net.ParseMAC(inf.HwAddr)
if err != nil { if err != nil {
return NetworkInfo{}, err return NetworkInfo{}, err
@ -1114,7 +1115,7 @@ func (s *Sandbox) generateNetInfo(inf *grpc.Interface) (NetworkInfo, error) {
} }
// AddInterface adds new nic to the sandbox. // AddInterface adds new nic to the sandbox.
func (s *Sandbox) AddInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (s *Sandbox) AddInterface(inf *types.Interface) (*types.Interface, error) {
netInfo, err := s.generateNetInfo(inf) netInfo, err := s.generateNetInfo(inf)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1145,7 +1146,7 @@ func (s *Sandbox) AddInterface(inf *grpc.Interface) (*grpc.Interface, error) {
} }
// RemoveInterface removes a nic of the sandbox. // RemoveInterface removes a nic of the sandbox.
func (s *Sandbox) RemoveInterface(inf *grpc.Interface) (*grpc.Interface, error) { func (s *Sandbox) RemoveInterface(inf *types.Interface) (*types.Interface, error) {
for i, endpoint := range s.networkNS.Endpoints { for i, endpoint := range s.networkNS.Endpoints {
if endpoint.HardwareAddr() == inf.HwAddr { if endpoint.HardwareAddr() == inf.HwAddr {
s.Logger().WithField("endpoint-type", endpoint.Type()).Info("Hot detaching endpoint") s.Logger().WithField("endpoint-type", endpoint.Type()).Info("Hot detaching endpoint")
@ -1163,17 +1164,17 @@ func (s *Sandbox) RemoveInterface(inf *grpc.Interface) (*grpc.Interface, error)
} }
// ListInterfaces lists all nics and their configurations in the sandbox. // ListInterfaces lists all nics and their configurations in the sandbox.
func (s *Sandbox) ListInterfaces() ([]*grpc.Interface, error) { func (s *Sandbox) ListInterfaces() ([]*types.Interface, error) {
return s.agent.listInterfaces() return s.agent.listInterfaces()
} }
// UpdateRoutes updates the sandbox route table (e.g. for portmapping support). // UpdateRoutes updates the sandbox route table (e.g. for portmapping support).
func (s *Sandbox) UpdateRoutes(routes []*grpc.Route) ([]*grpc.Route, error) { func (s *Sandbox) UpdateRoutes(routes []*types.Route) ([]*types.Route, error) {
return s.agent.updateRoutes(routes) return s.agent.updateRoutes(routes)
} }
// ListRoutes lists all routes and their configurations in the sandbox. // ListRoutes lists all routes and their configurations in the sandbox.
func (s *Sandbox) ListRoutes() ([]*grpc.Route, error) { func (s *Sandbox) ListRoutes() ([]*types.Route, error) {
return s.agent.listRoutes() return s.agent.listRoutes()
} }