From 5b7bea2471e823391a754efc44cd296e655fff1a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 27 Nov 2019 23:39:38 +0300 Subject: [PATCH] feat: use grpc-proxy in apid This replaces codegen version of apid proxying with talos-systems/grpc-proxy based version. Proxying is transparent, it doesn't require exact information about methods and response types. It requires some common layout response to enhance it properly with node metadata or errors. There should be no signifcant changes to the API with the previous version, but it's worth mentioning a few changes: 1. grpc.ClientConn is established just once per upstream (either local service or remote apid instance). 2. When called without `-t` (`targets`), apid proxies immediately down to local service skipping proxying to itself (as before), which results in empty node metadata in response (before it had local node IP). Might revert this later to proxy to itself (?). 3. Streaming APIs are now fully supported with multiple targets, but message definition doesn't contain `ResponseMetadata`, so streaming APIs are broken now with targets (needs a fix). 4. Errors are now returned as responses with `Error` field set in `ResponseMetadata`, this requires client library update and `osctl` to handle it properly. Signed-off-by: Andrey Smirnov --- Dockerfile | 5 - api/api.pb.go | 1584 ----------------- api/api.proto | 12 - api/common/common.pb.go | 227 ++- api/common/common.proto | 22 +- api/machine/machine.pb.go | 447 +++-- api/machine/machine.proto | 51 +- api/network/network.pb.go | 130 +- api/network/network.proto | 4 +- api/os/os.pb.go | 236 +-- api/os/os.proto | 10 +- api/time/time.pb.go | 60 +- api/time/time.proto | 2 +- cmd/osctl/cmd/cluster/pkg/node/node.go | 8 +- cmd/osctl/cmd/dmesg.go | 2 +- cmd/osctl/cmd/root.go | 2 +- cmd/osctl/pkg/client/client.go | 6 +- go.mod | 3 + go.sum | 6 + internal/app/apid/main.go | 63 +- internal/app/apid/pkg/backend/apid.go | 213 +++ internal/app/apid/pkg/backend/apid_factory.go | 55 + .../app/apid/pkg/backend/apid_factory_test.go | 74 + internal/app/apid/pkg/backend/apid_test.go | 162 ++ internal/app/apid/pkg/backend/backend.go | 6 + internal/app/apid/pkg/backend/local.go | 72 + internal/app/apid/pkg/backend/local_test.go | 44 + internal/app/apid/pkg/director/director.go | 122 ++ .../app/apid/pkg/director/director_test.go | 105 ++ internal/app/apid/pkg/director/mocks_test.go | 36 + internal/app/machined/internal/api/reg/reg.go | 12 +- .../app/machined/pkg/system/services/apid.go | 2 +- internal/app/osd/internal/reg/reg.go | 2 +- internal/integration/base/api.go | 2 +- internal/pkg/cri/client.go | 2 +- pkg/constants/constants.go | 4 +- 36 files changed, 1560 insertions(+), 2233 deletions(-) delete mode 100644 api/api.pb.go delete mode 100644 api/api.proto create mode 100644 internal/app/apid/pkg/backend/apid.go create mode 100644 internal/app/apid/pkg/backend/apid_factory.go create mode 100644 internal/app/apid/pkg/backend/apid_factory_test.go create mode 100644 internal/app/apid/pkg/backend/apid_test.go create mode 100644 internal/app/apid/pkg/backend/backend.go create mode 100644 internal/app/apid/pkg/backend/local.go create mode 100644 internal/app/apid/pkg/backend/local_test.go create mode 100644 internal/app/apid/pkg/director/director.go create mode 100644 internal/app/apid/pkg/director/director_test.go create mode 100644 internal/app/apid/pkg/director/mocks_test.go diff --git a/Dockerfile b/Dockerfile index be001c55e..387c00bca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,6 @@ RUN cd $(mktemp -d) \ && go get mvdan.cc/gofumpt/gofumports \ && mv /go/bin/gofumports /toolchain/go/bin/gofumports RUN curl -sfL https://github.com/uber/prototool/releases/download/v1.8.0/prototool-Linux-x86_64.tar.gz | tar -xz --strip-components=2 -C /toolchain/bin prototool/bin/prototool -COPY --from=autonomy/protoc-gen-proxy:4a9e5da /protoc-gen-proxy /toolchain/bin/protoc-gen-proxy COPY ./hack/docgen /go/src/github.com/talos-systems/docgen RUN cd /go/src/github.com/talos-systems/docgen \ && go build . \ @@ -52,15 +51,11 @@ COPY ./api/time/time.proto /api/time/time.proto RUN protoc -I/api --go_out=plugins=grpc:/api/time /api/time/time.proto COPY ./api/network/network.proto /api/network/network.proto RUN protoc -I/api --go_out=plugins=grpc:/api/network /api/network/network.proto -# Genenrate api bits last so we have other proto files in place to satisfy the import -COPY ./api/api.proto /api/api.proto -RUN protoc -I/api --plugin=proxy --proxy_out=plugins=grpc+proxy:/api /api/api.proto # Gofumports generated files to adjust import order RUN gofumports -w -local github.com/talos-systems/talos /api/ FROM scratch AS generate COPY --from=generate-build /api/common/github.com/talos-systems/talos/api/common/common.pb.go /api/common/ -COPY --from=generate-build /api/github.com/talos-systems/talos/api/api.pb.go /api/ COPY --from=generate-build /api/os/github.com/talos-systems/talos/api/os/os.pb.go /api/os/ COPY --from=generate-build /api/security/github.com/talos-systems/talos/api/security/security.pb.go /api/security/ COPY --from=generate-build /api/machine/github.com/talos-systems/talos/api/machine/machine.pb.go /api/machine/ diff --git a/api/api.pb.go b/api/api.pb.go deleted file mode 100644 index dcf090c23..000000000 --- a/api/api.pb.go +++ /dev/null @@ -1,1584 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: api.proto - -package api - -import ( - context "context" - fmt "fmt" - io "io" - math "math" - sync "sync" - - proto "github.com/golang/protobuf/proto" - empty "github.com/golang/protobuf/ptypes/empty" - go_multierror "github.com/hashicorp/go-multierror" - grpc "google.golang.org/grpc" - credentials "google.golang.org/grpc/credentials" - metadata "google.golang.org/grpc/metadata" - - common "github.com/talos-systems/talos/api/common" - machine "github.com/talos-systems/talos/api/machine" - network "github.com/talos-systems/talos/api/network" - os "github.com/talos-systems/talos/api/os" - time "github.com/talos-systems/talos/api/time" - constants "github.com/talos-systems/talos/pkg/constants" - tls "github.com/talos-systems/talos/pkg/grpc/tls" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// ContainersRequest from public import os/os.proto -type ContainersRequest = os.ContainersRequest - -// Container from public import os/os.proto -type Container = os.Container - -// ContainerResponse from public import os/os.proto -type ContainerResponse = os.ContainerResponse - -// ContainersReply from public import os/os.proto -type ContainersReply = os.ContainersReply - -// ProcessesRequest from public import os/os.proto -type ProcessesRequest = os.ProcessesRequest - -// ProcessesReply from public import os/os.proto -type ProcessesReply = os.ProcessesReply - -// ProcessResponse from public import os/os.proto -type ProcessResponse = os.ProcessResponse - -// Process from public import os/os.proto -type Process = os.Process - -// RestartRequest from public import os/os.proto -type RestartRequest = os.RestartRequest - -// RestartResponse from public import os/os.proto -type RestartResponse = os.RestartResponse - -// RestartReply from public import os/os.proto -type RestartReply = os.RestartReply - -// StatsRequest from public import os/os.proto -type StatsRequest = os.StatsRequest - -// StatsResponse from public import os/os.proto -type StatsResponse = os.StatsResponse - -// StatsReply from public import os/os.proto -type StatsReply = os.StatsReply - -// Stat from public import os/os.proto -type Stat = os.Stat - -// MemInfoResponse from public import os/os.proto -type MemInfoResponse = os.MemInfoResponse - -// MemInfoReply from public import os/os.proto -type MemInfoReply = os.MemInfoReply - -// MemInfo from public import os/os.proto -type MemInfo = os.MemInfo - -// RebootResponse from public import machine/machine.proto -type RebootResponse = machine.RebootResponse - -// RebootReply from public import machine/machine.proto -type RebootReply = machine.RebootReply - -// ResetResponse from public import machine/machine.proto -type ResetResponse = machine.ResetResponse - -// ResetReply from public import machine/machine.proto -type ResetReply = machine.ResetReply - -// ShutdownResponse from public import machine/machine.proto -type ShutdownResponse = machine.ShutdownResponse - -// ShutdownReply from public import machine/machine.proto -type ShutdownReply = machine.ShutdownReply - -// UpgradeRequest from public import machine/machine.proto -type UpgradeRequest = machine.UpgradeRequest - -// UpgradeResponse from public import machine/machine.proto -type UpgradeResponse = machine.UpgradeResponse - -// UpgradeReply from public import machine/machine.proto -type UpgradeReply = machine.UpgradeReply - -// ServiceListResponse from public import machine/machine.proto -type ServiceListResponse = machine.ServiceListResponse - -// ServiceListReply from public import machine/machine.proto -type ServiceListReply = machine.ServiceListReply - -// ServiceInfo from public import machine/machine.proto -type ServiceInfo = machine.ServiceInfo - -// ServiceEvents from public import machine/machine.proto -type ServiceEvents = machine.ServiceEvents - -// ServiceEvent from public import machine/machine.proto -type ServiceEvent = machine.ServiceEvent - -// ServiceHealth from public import machine/machine.proto -type ServiceHealth = machine.ServiceHealth - -// ServiceStartRequest from public import machine/machine.proto -type ServiceStartRequest = machine.ServiceStartRequest - -// ServiceStartResponse from public import machine/machine.proto -type ServiceStartResponse = machine.ServiceStartResponse - -// ServiceStartReply from public import machine/machine.proto -type ServiceStartReply = machine.ServiceStartReply - -// ServiceStopRequest from public import machine/machine.proto -type ServiceStopRequest = machine.ServiceStopRequest - -// ServiceStopResponse from public import machine/machine.proto -type ServiceStopResponse = machine.ServiceStopResponse - -// ServiceStopReply from public import machine/machine.proto -type ServiceStopReply = machine.ServiceStopReply - -// ServiceRestartRequest from public import machine/machine.proto -type ServiceRestartRequest = machine.ServiceRestartRequest - -// ServiceRestartResponse from public import machine/machine.proto -type ServiceRestartResponse = machine.ServiceRestartResponse - -// ServiceRestartReply from public import machine/machine.proto -type ServiceRestartReply = machine.ServiceRestartReply - -// StartRequest from public import machine/machine.proto -type StartRequest = machine.StartRequest - -// StartReply from public import machine/machine.proto -type StartReply = machine.StartReply - -// StopRequest from public import machine/machine.proto -type StopRequest = machine.StopRequest - -// StopReply from public import machine/machine.proto -type StopReply = machine.StopReply - -// StreamingData from public import machine/machine.proto -type StreamingData = machine.StreamingData - -// CopyOutRequest from public import machine/machine.proto -type CopyOutRequest = machine.CopyOutRequest - -// LSRequest from public import machine/machine.proto -type LSRequest = machine.LSRequest - -// FileInfo from public import machine/machine.proto -type FileInfo = machine.FileInfo - -// MountsResponse from public import machine/machine.proto -type MountsResponse = machine.MountsResponse - -// MountsReply from public import machine/machine.proto -type MountsReply = machine.MountsReply - -// MountStat from public import machine/machine.proto -type MountStat = machine.MountStat - -// VersionResponse from public import machine/machine.proto -type VersionResponse = machine.VersionResponse - -// VersionReply from public import machine/machine.proto -type VersionReply = machine.VersionReply - -// VersionInfo from public import machine/machine.proto -type VersionInfo = machine.VersionInfo - -// PlatformInfo from public import machine/machine.proto -type PlatformInfo = machine.PlatformInfo - -// LogsRequest from public import machine/machine.proto -type LogsRequest = machine.LogsRequest - -// ReadRequest from public import machine/machine.proto -type ReadRequest = machine.ReadRequest - -// TimeRequest from public import time/time.proto -type TimeRequest = time.TimeRequest - -// TimeReply from public import time/time.proto -type TimeReply = time.TimeReply - -// TimeResponse from public import time/time.proto -type TimeResponse = time.TimeResponse - -// RoutesReply from public import network/network.proto -type RoutesReply = network.RoutesReply - -// RoutesResponse from public import network/network.proto -type RoutesResponse = network.RoutesResponse - -// Route from public import network/network.proto -type Route = network.Route - -// InterfacesReply from public import network/network.proto -type InterfacesReply = network.InterfacesReply - -// InterfacesResponse from public import network/network.proto -type InterfacesResponse = network.InterfacesResponse - -// Interface from public import network/network.proto -type Interface = network.Interface - -// AddressFamily from public import network/network.proto -type AddressFamily = network.AddressFamily - -var ( - AddressFamily_name = network.AddressFamily_name - AddressFamily_value = network.AddressFamily_value -) - -const ( - AddressFamily_AF_UNSPEC = AddressFamily(network.AddressFamily_AF_UNSPEC) - AddressFamily_AF_INET = AddressFamily(network.AddressFamily_AF_INET) - AddressFamily_IPV4 = AddressFamily(network.AddressFamily_IPV4) - AddressFamily_AF_INET6 = AddressFamily(network.AddressFamily_AF_INET6) - AddressFamily_IPV6 = AddressFamily(network.AddressFamily_IPV6) -) - -// RouteProtocol from public import network/network.proto -type RouteProtocol = network.RouteProtocol - -var ( - RouteProtocol_name = network.RouteProtocol_name - RouteProtocol_value = network.RouteProtocol_value -) - -const ( - RouteProtocol_RTPROT_UNSPEC = RouteProtocol(network.RouteProtocol_RTPROT_UNSPEC) - RouteProtocol_RTPROT_REDIRECT = RouteProtocol(network.RouteProtocol_RTPROT_REDIRECT) - RouteProtocol_RTPROT_KERNEL = RouteProtocol(network.RouteProtocol_RTPROT_KERNEL) - RouteProtocol_RTPROT_BOOT = RouteProtocol(network.RouteProtocol_RTPROT_BOOT) - RouteProtocol_RTPROT_STATIC = RouteProtocol(network.RouteProtocol_RTPROT_STATIC) - RouteProtocol_RTPROT_GATED = RouteProtocol(network.RouteProtocol_RTPROT_GATED) - RouteProtocol_RTPROT_RA = RouteProtocol(network.RouteProtocol_RTPROT_RA) - RouteProtocol_RTPROT_MRT = RouteProtocol(network.RouteProtocol_RTPROT_MRT) - RouteProtocol_RTPROT_ZEBRA = RouteProtocol(network.RouteProtocol_RTPROT_ZEBRA) - RouteProtocol_RTPROT_BIRD = RouteProtocol(network.RouteProtocol_RTPROT_BIRD) - RouteProtocol_RTPROT_DNROUTED = RouteProtocol(network.RouteProtocol_RTPROT_DNROUTED) - RouteProtocol_RTPROT_XORP = RouteProtocol(network.RouteProtocol_RTPROT_XORP) - RouteProtocol_RTPROT_NTK = RouteProtocol(network.RouteProtocol_RTPROT_NTK) - RouteProtocol_RTPROT_DHCP = RouteProtocol(network.RouteProtocol_RTPROT_DHCP) - RouteProtocol_RTPROT_MROUTED = RouteProtocol(network.RouteProtocol_RTPROT_MROUTED) - RouteProtocol_RTPROT_BABEL = RouteProtocol(network.RouteProtocol_RTPROT_BABEL) -) - -// InterfaceFlags from public import network/network.proto -type InterfaceFlags = network.InterfaceFlags - -var ( - InterfaceFlags_name = network.InterfaceFlags_name - InterfaceFlags_value = network.InterfaceFlags_value -) - -const ( - InterfaceFlags_FLAG_UNKNOWN = InterfaceFlags(network.InterfaceFlags_FLAG_UNKNOWN) - InterfaceFlags_FLAG_UP = InterfaceFlags(network.InterfaceFlags_FLAG_UP) - InterfaceFlags_FLAG_BROADCAST = InterfaceFlags(network.InterfaceFlags_FLAG_BROADCAST) - InterfaceFlags_FLAG_LOOPBACK = InterfaceFlags(network.InterfaceFlags_FLAG_LOOPBACK) - InterfaceFlags_FLAG_POINT_TO_POINT = InterfaceFlags(network.InterfaceFlags_FLAG_POINT_TO_POINT) - InterfaceFlags_FLAG_MULTICAST = InterfaceFlags(network.InterfaceFlags_FLAG_MULTICAST) -) - -// NodeMetadata from public import common/common.proto -type NodeMetadata = common.NodeMetadata - -// Data from public import common/common.proto -type Data = common.Data - -// DataResponse from public import common/common.proto -type DataResponse = common.DataResponse - -// DataReply from public import common/common.proto -type DataReply = common.DataReply - -// ContainerDriver from public import common/common.proto -type ContainerDriver = common.ContainerDriver - -var ( - ContainerDriver_name = common.ContainerDriver_name - ContainerDriver_value = common.ContainerDriver_value -) - -const ( - ContainerDriver_CONTAINERD = ContainerDriver(common.ContainerDriver_CONTAINERD) - ContainerDriver_CRI = ContainerDriver(common.ContainerDriver_CRI) -) - -// Empty from public import google/protobuf/empty.proto -type Empty = empty.Empty - -func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } - -var fileDescriptor_00212fb1f9d3bf1c = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8b, 0xb1, 0x0e, 0x82, 0x40, - 0x0c, 0x40, 0x55, 0xd4, 0x44, 0x1d, 0x4c, 0x34, 0x2e, 0xb8, 0x19, 0x57, 0xe9, 0xe0, 0x1f, 0xf8, - 0x05, 0x37, 0xbb, 0x1d, 0xa4, 0x42, 0x23, 0xa5, 0x17, 0x5a, 0x62, 0xf8, 0x7b, 0x23, 0x77, 0x2e, - 0x7d, 0x79, 0xaf, 0xed, 0x76, 0xe3, 0x03, 0x15, 0xa1, 0x17, 0x93, 0x43, 0xe6, 0x03, 0xe5, 0x3b, - 0x51, 0x10, 0x8d, 0x25, 0x3f, 0xb1, 0xaf, 0x1a, 0xea, 0x10, 0x12, 0x53, 0xde, 0x1b, 0x31, 0xc2, - 0x6f, 0xfc, 0xef, 0x3a, 0xb4, 0x8f, 0xf4, 0x6f, 0x48, 0x4c, 0xf9, 0x58, 0x09, 0xb3, 0x74, 0x10, - 0x91, 0xe2, 0xb9, 0x16, 0xa9, 0x5b, 0x84, 0xc9, 0xca, 0xe1, 0x05, 0xc8, 0xc1, 0xc6, 0xb8, 0x7c, - 0x5c, 0x9f, 0x97, 0x9a, 0xac, 0x19, 0xca, 0xa2, 0x12, 0x06, 0xf3, 0xad, 0xe8, 0x4d, 0x47, 0x35, - 0x64, 0x8d, 0x06, 0x3e, 0x90, 0x9b, 0xb9, 0xb9, 0x5b, 0xb8, 0xcc, 0x2d, 0xdd, 0xaa, 0x5c, 0x4f, - 0x8f, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x8c, 0xe2, 0xe0, 0xc8, 0x00, 0x00, 0x00, -} - -type ApiProxy struct { - Provider tls.CertificateProvider -} - -func NewApiProxy(provider tls.CertificateProvider) *ApiProxy { - return &ApiProxy{ - Provider: provider, - } -} - -func (p *ApiProxy) UnaryInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - md, _ := metadata.FromIncomingContext(ctx) - if _, ok := md["proxyfrom"]; ok { - return handler(ctx, req) - } - ca, err := p.Provider.GetCA() - if err != nil { - return nil, err - } - certs, err := p.Provider.GetCertificate(nil) - if err != nil { - return nil, err - } - tlsConfig, err := tls.New( - tls.WithClientAuthType(tls.Mutual), - tls.WithCACertPEM(ca), - tls.WithKeypair(*certs), - ) - return p.UnaryProxy(ctx, info.FullMethod, credentials.NewTLS(tlsConfig), req) - } -} - -func (p *ApiProxy) UnaryProxy(ctx context.Context, method string, creds credentials.TransportCredentials, in interface{}, opts ...grpc.CallOption) (proto.Message, error) { - var ( - err error - errors *go_multierror.Error - msgs []proto.Message - ok bool - response proto.Message - targets []string - ) - md, _ := metadata.FromIncomingContext(ctx) - // default to target node specified in config or on cli - if targets, ok = md["targets"]; !ok { - targets = md[":authority"] - } - proxyMd := metadata.New(make(map[string]string)) - proxyMd.Set("proxyfrom", md[":authority"]...) - - switch method { - case "/os.OS/Containers": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &os.ContainersReply{} - msgs, err = proxyOSRunner(clients, in, proxyContainers) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*os.ContainersReply).Response[0]) - } - response = resp - case "/os.OS/Dmesg": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &common.DataReply{} - msgs, err = proxyOSRunner(clients, in, proxyDmesg) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*common.DataReply).Response[0]) - } - response = resp - case "/os.OS/Memory": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &os.MemInfoReply{} - msgs, err = proxyOSRunner(clients, in, proxyMemory) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*os.MemInfoReply).Response[0]) - } - response = resp - case "/os.OS/Processes": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &os.ProcessesReply{} - msgs, err = proxyOSRunner(clients, in, proxyProcesses) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*os.ProcessesReply).Response[0]) - } - response = resp - case "/os.OS/Restart": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &os.RestartReply{} - msgs, err = proxyOSRunner(clients, in, proxyRestart) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*os.RestartReply).Response[0]) - } - response = resp - case "/os.OS/Stats": - // Initialize target clients - clients, err := createOSClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &os.StatsReply{} - msgs, err = proxyOSRunner(clients, in, proxyStats) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*os.StatsReply).Response[0]) - } - response = resp - case "/machine.Machine/Mounts": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.MountsReply{} - msgs, err = proxyMachineRunner(clients, in, proxyMounts) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.MountsReply).Response[0]) - } - response = resp - case "/machine.Machine/Reboot": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.RebootReply{} - msgs, err = proxyMachineRunner(clients, in, proxyReboot) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.RebootReply).Response[0]) - } - response = resp - case "/machine.Machine/Reset": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ResetReply{} - msgs, err = proxyMachineRunner(clients, in, proxyReset) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ResetReply).Response[0]) - } - response = resp - case "/machine.Machine/ServiceList": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ServiceListReply{} - msgs, err = proxyMachineRunner(clients, in, proxyServiceList) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ServiceListReply).Response[0]) - } - response = resp - case "/machine.Machine/ServiceRestart": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ServiceRestartReply{} - msgs, err = proxyMachineRunner(clients, in, proxyServiceRestart) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ServiceRestartReply).Response[0]) - } - response = resp - case "/machine.Machine/ServiceStart": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ServiceStartReply{} - msgs, err = proxyMachineRunner(clients, in, proxyServiceStart) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ServiceStartReply).Response[0]) - } - response = resp - case "/machine.Machine/ServiceStop": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ServiceStopReply{} - msgs, err = proxyMachineRunner(clients, in, proxyServiceStop) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ServiceStopReply).Response[0]) - } - response = resp - case "/machine.Machine/Shutdown": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.ShutdownReply{} - msgs, err = proxyMachineRunner(clients, in, proxyShutdown) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.ShutdownReply).Response[0]) - } - response = resp - case "/machine.Machine/Upgrade": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.UpgradeReply{} - msgs, err = proxyMachineRunner(clients, in, proxyUpgrade) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.UpgradeReply).Response[0]) - } - response = resp - case "/machine.Machine/Version": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &machine.VersionReply{} - msgs, err = proxyMachineRunner(clients, in, proxyVersion) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*machine.VersionReply).Response[0]) - } - response = resp - case "/time.Time/Time": - // Initialize target clients - clients, err := createTimeClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &time.TimeReply{} - msgs, err = proxyTimeRunner(clients, in, proxyTime) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*time.TimeReply).Response[0]) - } - response = resp - case "/time.Time/TimeCheck": - // Initialize target clients - clients, err := createTimeClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &time.TimeReply{} - msgs, err = proxyTimeRunner(clients, in, proxyTimeCheck) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*time.TimeReply).Response[0]) - } - response = resp - case "/network.Network/Routes": - // Initialize target clients - clients, err := createNetworkClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &network.RoutesReply{} - msgs, err = proxyNetworkRunner(clients, in, proxyRoutes) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*network.RoutesReply).Response[0]) - } - response = resp - case "/network.Network/Interfaces": - // Initialize target clients - clients, err := createNetworkClient(targets, creds, proxyMd) - if err != nil { - break - } - resp := &network.InterfacesReply{} - msgs, err = proxyNetworkRunner(clients, in, proxyInterfaces) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*network.InterfacesReply).Response[0]) - } - response = resp - - } - - if err != nil { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -func copyClientServer(msg interface{}, client grpc.ClientStream, srv grpc.ServerStream) error { - for { - err := client.RecvMsg(msg) - if err == io.EOF { - break - } - - if err != nil { - return err - } - - err = srv.SendMsg(msg) - if err != nil { - return err - } - } - - return nil -} - -func (p *ApiProxy) StreamInterceptor() grpc.StreamServerInterceptor { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - md, _ := metadata.FromIncomingContext(ss.Context()) - if _, ok := md["proxyfrom"]; ok { - return handler(srv, ss) - } - ca, err := p.Provider.GetCA() - if err != nil { - return err - } - certs, err := p.Provider.GetCertificate(nil) - if err != nil { - return err - } - tlsConfig, err := tls.New( - tls.WithClientAuthType(tls.Mutual), - tls.WithCACertPEM(ca), - tls.WithKeypair(*certs), - ) - return p.StreamProxy(ss, info.FullMethod, credentials.NewTLS(tlsConfig), srv) - } -} - -func (p *ApiProxy) StreamProxy(ss grpc.ServerStream, method string, creds credentials.TransportCredentials, srv interface{}, opts ...grpc.CallOption) error { - var ( - err error - errors *go_multierror.Error - ok bool - targets []string - ) - - md, _ := metadata.FromIncomingContext(ss.Context()) - // default to target node specified in config or on cli - if targets, ok = md["targets"]; !ok { - targets = md[":authority"] - } - // Can discuss more on how to handle merging multiple streams later - // but for now, ensure we only deal with a single target - if len(targets) > 1 { - targets = targets[:1] - } - - proxyMd := metadata.New(make(map[string]string)) - proxyMd.Set("proxyfrom", md[":authority"]...) - - switch method { - case "/machine.Machine/CopyOut": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - m := new(machine.CopyOutRequest) - if err := ss.RecvMsg(m); err != nil { - return err - } - // artificially limit this to only the first client/target until - // we get multi-stream stuff sorted - clientStream, err := clients[0].Conn.CopyOut(clients[0].Context, m) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, clientStream, ss.(grpc.ServerStream)) - case "/machine.Machine/Kubeconfig": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - m := new(empty.Empty) - if err := ss.RecvMsg(m); err != nil { - return err - } - // artificially limit this to only the first client/target until - // we get multi-stream stuff sorted - clientStream, err := clients[0].Conn.Kubeconfig(clients[0].Context, m) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, clientStream, ss.(grpc.ServerStream)) - case "/machine.Machine/LS": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - m := new(machine.LSRequest) - if err := ss.RecvMsg(m); err != nil { - return err - } - // artificially limit this to only the first client/target until - // we get multi-stream stuff sorted - clientStream, err := clients[0].Conn.LS(clients[0].Context, m) - if err != nil { - return err - } - var msg machine.FileInfo - return copyClientServer(&msg, clientStream, ss.(grpc.ServerStream)) - case "/machine.Machine/Logs": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - m := new(machine.LogsRequest) - if err := ss.RecvMsg(m); err != nil { - return err - } - // artificially limit this to only the first client/target until - // we get multi-stream stuff sorted - clientStream, err := clients[0].Conn.Logs(clients[0].Context, m) - if err != nil { - return err - } - var msg common.Data - return copyClientServer(&msg, clientStream, ss.(grpc.ServerStream)) - case "/machine.Machine/Read": - // Initialize target clients - clients, err := createMachineClient(targets, creds, proxyMd) - if err != nil { - break - } - m := new(machine.ReadRequest) - if err := ss.RecvMsg(m); err != nil { - return err - } - // artificially limit this to only the first client/target until - // we get multi-stream stuff sorted - clientStream, err := clients[0].Conn.Read(clients[0].Context, m) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, clientStream, ss.(grpc.ServerStream)) - - } - - if err != nil { - errors = go_multierror.Append(errors, err) - } - return errors.ErrorOrNil() -} - -type runnerOSFn func(*proxyOSClient, interface{}, *sync.WaitGroup, chan proto.Message, chan error) - -func proxyOSRunner(clients []*proxyOSClient, in interface{}, runner runnerOSFn) ([]proto.Message, error) { - var ( - errors *go_multierror.Error - wg sync.WaitGroup - ) - respCh := make(chan proto.Message, len(clients)) - errCh := make(chan error, len(clients)) - wg.Add(len(clients)) - for _, client := range clients { - go runner(client, in, &wg, respCh, errCh) - } - wg.Wait() - close(respCh) - close(errCh) - - var response []proto.Message - for resp := range respCh { - response = append(response, resp) - } - for err := range errCh { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -type proxyOSClient struct { - Conn os.OSClient - Context context.Context - Target string - DialOpts []grpc.DialOption -} - -func proxyContainers(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Containers(client.Context, in.(*os.ContainersRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyDmesg(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Dmesg(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyMemory(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Memory(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyProcesses(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Processes(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyRestart(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Restart(client.Context, in.(*os.RestartRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyStats(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Stats(client.Context, in.(*os.StatsRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -type runnerMachineFn func(*proxyMachineClient, interface{}, *sync.WaitGroup, chan proto.Message, chan error) - -func proxyMachineRunner(clients []*proxyMachineClient, in interface{}, runner runnerMachineFn) ([]proto.Message, error) { - var ( - errors *go_multierror.Error - wg sync.WaitGroup - ) - respCh := make(chan proto.Message, len(clients)) - errCh := make(chan error, len(clients)) - wg.Add(len(clients)) - for _, client := range clients { - go runner(client, in, &wg, respCh, errCh) - } - wg.Wait() - close(respCh) - close(errCh) - - var response []proto.Message - for resp := range respCh { - response = append(response, resp) - } - for err := range errCh { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -type proxyMachineClient struct { - Conn machine.MachineClient - Context context.Context - Target string - DialOpts []grpc.DialOption -} - -func proxyMounts(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Mounts(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyReboot(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Reboot(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyReset(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Reset(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyServiceList(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.ServiceList(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyServiceRestart(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.ServiceRestart(client.Context, in.(*machine.ServiceRestartRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyServiceStart(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.ServiceStart(client.Context, in.(*machine.ServiceStartRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyServiceStop(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.ServiceStop(client.Context, in.(*machine.ServiceStopRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyShutdown(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Shutdown(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyUpgrade(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Upgrade(client.Context, in.(*machine.UpgradeRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyVersion(client *proxyMachineClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Version(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -type runnerTimeFn func(*proxyTimeClient, interface{}, *sync.WaitGroup, chan proto.Message, chan error) - -func proxyTimeRunner(clients []*proxyTimeClient, in interface{}, runner runnerTimeFn) ([]proto.Message, error) { - var ( - errors *go_multierror.Error - wg sync.WaitGroup - ) - respCh := make(chan proto.Message, len(clients)) - errCh := make(chan error, len(clients)) - wg.Add(len(clients)) - for _, client := range clients { - go runner(client, in, &wg, respCh, errCh) - } - wg.Wait() - close(respCh) - close(errCh) - - var response []proto.Message - for resp := range respCh { - response = append(response, resp) - } - for err := range errCh { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -type proxyTimeClient struct { - Conn time.TimeClient - Context context.Context - Target string - DialOpts []grpc.DialOption -} - -func proxyTime(client *proxyTimeClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Time(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyTimeCheck(client *proxyTimeClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.TimeCheck(client.Context, in.(*time.TimeRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -type runnerNetworkFn func(*proxyNetworkClient, interface{}, *sync.WaitGroup, chan proto.Message, chan error) - -func proxyNetworkRunner(clients []*proxyNetworkClient, in interface{}, runner runnerNetworkFn) ([]proto.Message, error) { - var ( - errors *go_multierror.Error - wg sync.WaitGroup - ) - respCh := make(chan proto.Message, len(clients)) - errCh := make(chan error, len(clients)) - wg.Add(len(clients)) - for _, client := range clients { - go runner(client, in, &wg, respCh, errCh) - } - wg.Wait() - close(respCh) - close(errCh) - - var response []proto.Message - for resp := range respCh { - response = append(response, resp) - } - for err := range errCh { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -type proxyNetworkClient struct { - Conn network.NetworkClient - Context context.Context - Target string - DialOpts []grpc.DialOption -} - -func proxyRoutes(client *proxyNetworkClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Routes(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func proxyInterfaces(client *proxyNetworkClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Interfaces(client.Context, in.(*empty.Empty)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} - -func createOSClient(targets []string, creds credentials.TransportCredentials, proxyMd metadata.MD) ([]*proxyOSClient, error) { - var errors *go_multierror.Error - clients := make([]*proxyOSClient, 0, len(targets)) - for _, target := range targets { - c := &proxyOSClient{ - // TODO change the context to be more useful ( ex cancelable ) - Context: metadata.NewOutgoingContext(context.Background(), proxyMd), - Target: target, - } - // TODO: i think we potentially leak a client here, - // we should close the request // cancel the context if it errors - // Explicitly set OSD port - conn, err := grpc.Dial(fmt.Sprintf("%s:%d", target, 50000), grpc.WithTransportCredentials(creds)) - if err != nil { - // TODO: probably worth wrapping err to add some context about the target - errors = go_multierror.Append(errors, err) - continue - } - c.Conn = os.NewOSClient(conn) - clients = append(clients, c) - } - return clients, errors.ErrorOrNil() -} - -func createMachineClient(targets []string, creds credentials.TransportCredentials, proxyMd metadata.MD) ([]*proxyMachineClient, error) { - var errors *go_multierror.Error - clients := make([]*proxyMachineClient, 0, len(targets)) - for _, target := range targets { - c := &proxyMachineClient{ - // TODO change the context to be more useful ( ex cancelable ) - Context: metadata.NewOutgoingContext(context.Background(), proxyMd), - Target: target, - } - // TODO: i think we potentially leak a client here, - // we should close the request // cancel the context if it errors - // Explicitly set OSD port - conn, err := grpc.Dial(fmt.Sprintf("%s:%d", target, 50000), grpc.WithTransportCredentials(creds)) - if err != nil { - // TODO: probably worth wrapping err to add some context about the target - errors = go_multierror.Append(errors, err) - continue - } - c.Conn = machine.NewMachineClient(conn) - clients = append(clients, c) - } - return clients, errors.ErrorOrNil() -} - -func createTimeClient(targets []string, creds credentials.TransportCredentials, proxyMd metadata.MD) ([]*proxyTimeClient, error) { - var errors *go_multierror.Error - clients := make([]*proxyTimeClient, 0, len(targets)) - for _, target := range targets { - c := &proxyTimeClient{ - // TODO change the context to be more useful ( ex cancelable ) - Context: metadata.NewOutgoingContext(context.Background(), proxyMd), - Target: target, - } - // TODO: i think we potentially leak a client here, - // we should close the request // cancel the context if it errors - // Explicitly set OSD port - conn, err := grpc.Dial(fmt.Sprintf("%s:%d", target, 50000), grpc.WithTransportCredentials(creds)) - if err != nil { - // TODO: probably worth wrapping err to add some context about the target - errors = go_multierror.Append(errors, err) - continue - } - c.Conn = time.NewTimeClient(conn) - clients = append(clients, c) - } - return clients, errors.ErrorOrNil() -} - -func createNetworkClient(targets []string, creds credentials.TransportCredentials, proxyMd metadata.MD) ([]*proxyNetworkClient, error) { - var errors *go_multierror.Error - clients := make([]*proxyNetworkClient, 0, len(targets)) - for _, target := range targets { - c := &proxyNetworkClient{ - // TODO change the context to be more useful ( ex cancelable ) - Context: metadata.NewOutgoingContext(context.Background(), proxyMd), - Target: target, - } - // TODO: i think we potentially leak a client here, - // we should close the request // cancel the context if it errors - // Explicitly set OSD port - conn, err := grpc.Dial(fmt.Sprintf("%s:%d", target, 50000), grpc.WithTransportCredentials(creds)) - if err != nil { - // TODO: probably worth wrapping err to add some context about the target - errors = go_multierror.Append(errors, err) - continue - } - c.Conn = network.NewNetworkClient(conn) - clients = append(clients, c) - } - return clients, errors.ErrorOrNil() -} - -type Registrator struct { - os.OSClient - machine.MachineClient - time.TimeClient - network.NetworkClient -} - -func (r *Registrator) Register(s *grpc.Server) { - os.RegisterOSServer(s, r) - machine.RegisterMachineServer(s, r) - time.RegisterTimeServer(s, r) - network.RegisterNetworkServer(s, r) -} - -func (r *Registrator) Containers(ctx context.Context, in *os.ContainersRequest) (*os.ContainersReply, error) { - return r.OSClient.Containers(ctx, in) -} - -func (r *Registrator) Dmesg(ctx context.Context, in *empty.Empty) (*common.DataReply, error) { - return r.OSClient.Dmesg(ctx, in) -} - -func (r *Registrator) Memory(ctx context.Context, in *empty.Empty) (*os.MemInfoReply, error) { - return r.OSClient.Memory(ctx, in) -} - -func (r *Registrator) Processes(ctx context.Context, in *empty.Empty) (*os.ProcessesReply, error) { - return r.OSClient.Processes(ctx, in) -} - -func (r *Registrator) Restart(ctx context.Context, in *os.RestartRequest) (*os.RestartReply, error) { - return r.OSClient.Restart(ctx, in) -} - -func (r *Registrator) Stats(ctx context.Context, in *os.StatsRequest) (*os.StatsReply, error) { - return r.OSClient.Stats(ctx, in) -} - -func (r *Registrator) CopyOut(in *machine.CopyOutRequest, srv machine.Machine_CopyOutServer) error { - client, err := r.MachineClient.CopyOut(srv.Context(), in) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, client, srv) -} - -func (r *Registrator) Kubeconfig(in *empty.Empty, srv machine.Machine_KubeconfigServer) error { - client, err := r.MachineClient.Kubeconfig(srv.Context(), in) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, client, srv) -} - -func (r *Registrator) LS(in *machine.LSRequest, srv machine.Machine_LSServer) error { - client, err := r.MachineClient.LS(srv.Context(), in) - if err != nil { - return err - } - var msg machine.FileInfo - return copyClientServer(&msg, client, srv) -} - -func (r *Registrator) Logs(in *machine.LogsRequest, srv machine.Machine_LogsServer) error { - client, err := r.MachineClient.Logs(srv.Context(), in) - if err != nil { - return err - } - var msg common.Data - return copyClientServer(&msg, client, srv) -} - -func (r *Registrator) Mounts(ctx context.Context, in *empty.Empty) (*machine.MountsReply, error) { - return r.MachineClient.Mounts(ctx, in) -} - -func (r *Registrator) Read(in *machine.ReadRequest, srv machine.Machine_ReadServer) error { - client, err := r.MachineClient.Read(srv.Context(), in) - if err != nil { - return err - } - var msg machine.StreamingData - return copyClientServer(&msg, client, srv) -} - -func (r *Registrator) Reboot(ctx context.Context, in *empty.Empty) (*machine.RebootReply, error) { - return r.MachineClient.Reboot(ctx, in) -} - -func (r *Registrator) Reset(ctx context.Context, in *empty.Empty) (*machine.ResetReply, error) { - return r.MachineClient.Reset(ctx, in) -} - -func (r *Registrator) ServiceList(ctx context.Context, in *empty.Empty) (*machine.ServiceListReply, error) { - return r.MachineClient.ServiceList(ctx, in) -} - -func (r *Registrator) ServiceRestart(ctx context.Context, in *machine.ServiceRestartRequest) (*machine.ServiceRestartReply, error) { - return r.MachineClient.ServiceRestart(ctx, in) -} - -func (r *Registrator) ServiceStart(ctx context.Context, in *machine.ServiceStartRequest) (*machine.ServiceStartReply, error) { - return r.MachineClient.ServiceStart(ctx, in) -} - -func (r *Registrator) ServiceStop(ctx context.Context, in *machine.ServiceStopRequest) (*machine.ServiceStopReply, error) { - return r.MachineClient.ServiceStop(ctx, in) -} - -func (r *Registrator) Shutdown(ctx context.Context, in *empty.Empty) (*machine.ShutdownReply, error) { - return r.MachineClient.Shutdown(ctx, in) -} - -func (r *Registrator) Upgrade(ctx context.Context, in *machine.UpgradeRequest) (*machine.UpgradeReply, error) { - return r.MachineClient.Upgrade(ctx, in) -} - -func (r *Registrator) Start(ctx context.Context, in *machine.StartRequest) (*machine.StartReply, error) { - return r.MachineClient.Start(ctx, in) -} - -func (r *Registrator) Stop(ctx context.Context, in *machine.StopRequest) (*machine.StopReply, error) { - return r.MachineClient.Stop(ctx, in) -} - -func (r *Registrator) Version(ctx context.Context, in *empty.Empty) (*machine.VersionReply, error) { - return r.MachineClient.Version(ctx, in) -} - -func (r *Registrator) Time(ctx context.Context, in *empty.Empty) (*time.TimeReply, error) { - return r.TimeClient.Time(ctx, in) -} - -func (r *Registrator) TimeCheck(ctx context.Context, in *time.TimeRequest) (*time.TimeReply, error) { - return r.TimeClient.TimeCheck(ctx, in) -} - -func (r *Registrator) Routes(ctx context.Context, in *empty.Empty) (*network.RoutesReply, error) { - return r.NetworkClient.Routes(ctx, in) -} - -func (r *Registrator) Interfaces(ctx context.Context, in *empty.Empty) (*network.InterfacesReply, error) { - return r.NetworkClient.Interfaces(ctx, in) -} - -type LocalOSClient struct { - os.OSClient -} - -func NewLocalOSClient() (os.OSClient, error) { - conn, err := grpc.Dial("unix:"+constants.OSSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - return &LocalOSClient{ - OSClient: os.NewOSClient(conn), - }, nil -} - -func (c *LocalOSClient) Containers(ctx context.Context, in *os.ContainersRequest, opts ...grpc.CallOption) (*os.ContainersReply, error) { - return c.OSClient.Containers(ctx, in, opts...) -} - -func (c *LocalOSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*common.DataReply, error) { - return c.OSClient.Dmesg(ctx, in, opts...) -} - -func (c *LocalOSClient) Memory(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*os.MemInfoReply, error) { - return c.OSClient.Memory(ctx, in, opts...) -} - -func (c *LocalOSClient) Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*os.ProcessesReply, error) { - return c.OSClient.Processes(ctx, in, opts...) -} - -func (c *LocalOSClient) Restart(ctx context.Context, in *os.RestartRequest, opts ...grpc.CallOption) (*os.RestartReply, error) { - return c.OSClient.Restart(ctx, in, opts...) -} - -func (c *LocalOSClient) Stats(ctx context.Context, in *os.StatsRequest, opts ...grpc.CallOption) (*os.StatsReply, error) { - return c.OSClient.Stats(ctx, in, opts...) -} - -type LocalMachineClient struct { - machine.MachineClient -} - -func NewLocalMachineClient() (machine.MachineClient, error) { - conn, err := grpc.Dial("unix:"+constants.MachineSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - return &LocalMachineClient{ - MachineClient: machine.NewMachineClient(conn), - }, nil -} - -func (c *LocalMachineClient) CopyOut(ctx context.Context, in *machine.CopyOutRequest, opts ...grpc.CallOption) (machine.Machine_CopyOutClient, error) { - return c.MachineClient.CopyOut(ctx, in, opts...) -} - -func (c *LocalMachineClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (machine.Machine_KubeconfigClient, error) { - return c.MachineClient.Kubeconfig(ctx, in, opts...) -} - -func (c *LocalMachineClient) LS(ctx context.Context, in *machine.LSRequest, opts ...grpc.CallOption) (machine.Machine_LSClient, error) { - return c.MachineClient.LS(ctx, in, opts...) -} - -func (c *LocalMachineClient) Logs(ctx context.Context, in *machine.LogsRequest, opts ...grpc.CallOption) (machine.Machine_LogsClient, error) { - return c.MachineClient.Logs(ctx, in, opts...) -} - -func (c *LocalMachineClient) Mounts(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.MountsReply, error) { - return c.MachineClient.Mounts(ctx, in, opts...) -} - -func (c *LocalMachineClient) Read(ctx context.Context, in *machine.ReadRequest, opts ...grpc.CallOption) (machine.Machine_ReadClient, error) { - return c.MachineClient.Read(ctx, in, opts...) -} - -func (c *LocalMachineClient) Reboot(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.RebootReply, error) { - return c.MachineClient.Reboot(ctx, in, opts...) -} - -func (c *LocalMachineClient) Reset(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.ResetReply, error) { - return c.MachineClient.Reset(ctx, in, opts...) -} - -func (c *LocalMachineClient) ServiceList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.ServiceListReply, error) { - return c.MachineClient.ServiceList(ctx, in, opts...) -} - -func (c *LocalMachineClient) ServiceRestart(ctx context.Context, in *machine.ServiceRestartRequest, opts ...grpc.CallOption) (*machine.ServiceRestartReply, error) { - return c.MachineClient.ServiceRestart(ctx, in, opts...) -} - -func (c *LocalMachineClient) ServiceStart(ctx context.Context, in *machine.ServiceStartRequest, opts ...grpc.CallOption) (*machine.ServiceStartReply, error) { - return c.MachineClient.ServiceStart(ctx, in, opts...) -} - -func (c *LocalMachineClient) ServiceStop(ctx context.Context, in *machine.ServiceStopRequest, opts ...grpc.CallOption) (*machine.ServiceStopReply, error) { - return c.MachineClient.ServiceStop(ctx, in, opts...) -} - -func (c *LocalMachineClient) Shutdown(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.ShutdownReply, error) { - return c.MachineClient.Shutdown(ctx, in, opts...) -} - -func (c *LocalMachineClient) Upgrade(ctx context.Context, in *machine.UpgradeRequest, opts ...grpc.CallOption) (*machine.UpgradeReply, error) { - return c.MachineClient.Upgrade(ctx, in, opts...) -} - -func (c *LocalMachineClient) Start(ctx context.Context, in *machine.StartRequest, opts ...grpc.CallOption) (*machine.StartReply, error) { - return c.MachineClient.Start(ctx, in, opts...) -} - -func (c *LocalMachineClient) Stop(ctx context.Context, in *machine.StopRequest, opts ...grpc.CallOption) (*machine.StopReply, error) { - return c.MachineClient.Stop(ctx, in, opts...) -} - -func (c *LocalMachineClient) Version(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.VersionReply, error) { - return c.MachineClient.Version(ctx, in, opts...) -} - -type LocalTimeClient struct { - time.TimeClient -} - -func NewLocalTimeClient() (time.TimeClient, error) { - conn, err := grpc.Dial("unix:"+constants.TimeSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - return &LocalTimeClient{ - TimeClient: time.NewTimeClient(conn), - }, nil -} - -func (c *LocalTimeClient) Time(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*time.TimeReply, error) { - return c.TimeClient.Time(ctx, in, opts...) -} - -func (c *LocalTimeClient) TimeCheck(ctx context.Context, in *time.TimeRequest, opts ...grpc.CallOption) (*time.TimeReply, error) { - return c.TimeClient.TimeCheck(ctx, in, opts...) -} - -type LocalNetworkClient struct { - network.NetworkClient -} - -func NewLocalNetworkClient() (network.NetworkClient, error) { - conn, err := grpc.Dial("unix:"+constants.NetworkSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - return &LocalNetworkClient{ - NetworkClient: network.NewNetworkClient(conn), - }, nil -} - -func (c *LocalNetworkClient) Routes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*network.RoutesReply, error) { - return c.NetworkClient.Routes(ctx, in, opts...) -} - -func (c *LocalNetworkClient) Interfaces(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*network.InterfacesReply, error) { - return c.NetworkClient.Interfaces(ctx, in, opts...) -} diff --git a/api/api.proto b/api/api.proto deleted file mode 100644 index ecadba633..000000000 --- a/api/api.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package api; - -option go_package = "github.com/talos-systems/talos/api"; - -import public "os/os.proto"; -import public "machine/machine.proto"; -import public "time/time.proto"; -import public "network/network.proto"; -import public "common/common.proto"; -import public "google/protobuf/empty.proto"; diff --git a/api/common/common.pb.go b/api/common/common.pb.go index 1b2c1f965..60dfb1967 100644 --- a/api/common/common.pb.go +++ b/api/common/common.pb.go @@ -49,106 +49,72 @@ func (ContainerDriver) EnumDescriptor() ([]byte, []int) { } // Common metadata message nested in all reply message types -type NodeMetadata struct { - Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` +type ResponseMetadata struct { + // hostname of the server response comes from (injected by proxy) + Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` + // error is set if request failed to the upstream (rest of response is undefined) + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *NodeMetadata) Reset() { *m = NodeMetadata{} } -func (m *NodeMetadata) String() string { return proto.CompactTextString(m) } -func (*NodeMetadata) ProtoMessage() {} -func (*NodeMetadata) Descriptor() ([]byte, []int) { +func (m *ResponseMetadata) Reset() { *m = ResponseMetadata{} } +func (m *ResponseMetadata) String() string { return proto.CompactTextString(m) } +func (*ResponseMetadata) ProtoMessage() {} +func (*ResponseMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_8f954d82c0b891f6, []int{0} } -func (m *NodeMetadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeMetadata.Unmarshal(m, b) +func (m *ResponseMetadata) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseMetadata.Unmarshal(m, b) } -func (m *NodeMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeMetadata.Marshal(b, m, deterministic) +func (m *ResponseMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseMetadata.Marshal(b, m, deterministic) } -func (m *NodeMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeMetadata.Merge(m, src) +func (m *ResponseMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseMetadata.Merge(m, src) } -func (m *NodeMetadata) XXX_Size() int { - return xxx_messageInfo_NodeMetadata.Size(m) +func (m *ResponseMetadata) XXX_Size() int { + return xxx_messageInfo_ResponseMetadata.Size(m) } -func (m *NodeMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_NodeMetadata.DiscardUnknown(m) +func (m *ResponseMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseMetadata.DiscardUnknown(m) } -var xxx_messageInfo_NodeMetadata proto.InternalMessageInfo +var xxx_messageInfo_ResponseMetadata proto.InternalMessageInfo -func (m *NodeMetadata) GetHostname() string { +func (m *ResponseMetadata) GetHostname() string { if m != nil { return m.Hostname } return "" } -// The response message containing the requested logs. -type Data struct { - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Data) Reset() { *m = Data{} } -func (m *Data) String() string { return proto.CompactTextString(m) } -func (*Data) ProtoMessage() {} -func (*Data) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{1} -} - -func (m *Data) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Data.Unmarshal(m, b) -} - -func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Data.Marshal(b, m, deterministic) -} - -func (m *Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_Data.Merge(m, src) -} - -func (m *Data) XXX_Size() int { - return xxx_messageInfo_Data.Size(m) -} - -func (m *Data) XXX_DiscardUnknown() { - xxx_messageInfo_Data.DiscardUnknown(m) -} - -var xxx_messageInfo_Data proto.InternalMessageInfo - -func (m *Data) GetBytes() []byte { +func (m *ResponseMetadata) GetError() string { if m != nil { - return m.Bytes + return m.Error } - return nil + return "" } type DataResponse struct { - Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Bytes *Data `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DataResponse) Reset() { *m = DataResponse{} } func (m *DataResponse) String() string { return proto.CompactTextString(m) } func (*DataResponse) ProtoMessage() {} func (*DataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{2} + return fileDescriptor_8f954d82c0b891f6, []int{1} } func (m *DataResponse) XXX_Unmarshal(b []byte) error { @@ -173,14 +139,14 @@ func (m *DataResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DataResponse proto.InternalMessageInfo -func (m *DataResponse) GetMetadata() *NodeMetadata { +func (m *DataResponse) GetMetadata() *ResponseMetadata { if m != nil { return m.Metadata } return nil } -func (m *DataResponse) GetBytes() *Data { +func (m *DataResponse) GetBytes() []byte { if m != nil { return m.Bytes } @@ -198,7 +164,7 @@ func (m *DataReply) Reset() { *m = DataReply{} } func (m *DataReply) String() string { return proto.CompactTextString(m) } func (*DataReply) ProtoMessage() {} func (*DataReply) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{3} + return fileDescriptor_8f954d82c0b891f6, []int{2} } func (m *DataReply) XXX_Unmarshal(b []byte) error { @@ -230,32 +196,121 @@ func (m *DataReply) GetResponse() []*DataResponse { return nil } +type EmptyResponse struct { + Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } +func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } +func (*EmptyResponse) ProtoMessage() {} +func (*EmptyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8f954d82c0b891f6, []int{3} +} + +func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EmptyResponse.Unmarshal(m, b) +} + +func (m *EmptyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EmptyResponse.Marshal(b, m, deterministic) +} + +func (m *EmptyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyResponse.Merge(m, src) +} + +func (m *EmptyResponse) XXX_Size() int { + return xxx_messageInfo_EmptyResponse.Size(m) +} + +func (m *EmptyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EmptyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo + +func (m *EmptyResponse) GetMetadata() *ResponseMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +type EmptyReply struct { + Response []*EmptyResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EmptyReply) Reset() { *m = EmptyReply{} } +func (m *EmptyReply) String() string { return proto.CompactTextString(m) } +func (*EmptyReply) ProtoMessage() {} +func (*EmptyReply) Descriptor() ([]byte, []int) { + return fileDescriptor_8f954d82c0b891f6, []int{4} +} + +func (m *EmptyReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EmptyReply.Unmarshal(m, b) +} + +func (m *EmptyReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EmptyReply.Marshal(b, m, deterministic) +} + +func (m *EmptyReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyReply.Merge(m, src) +} + +func (m *EmptyReply) XXX_Size() int { + return xxx_messageInfo_EmptyReply.Size(m) +} + +func (m *EmptyReply) XXX_DiscardUnknown() { + xxx_messageInfo_EmptyReply.DiscardUnknown(m) +} + +var xxx_messageInfo_EmptyReply proto.InternalMessageInfo + +func (m *EmptyReply) GetResponse() []*EmptyResponse { + if m != nil { + return m.Response + } + return nil +} + func init() { proto.RegisterEnum("common.ContainerDriver", ContainerDriver_name, ContainerDriver_value) - proto.RegisterType((*NodeMetadata)(nil), "common.NodeMetadata") - proto.RegisterType((*Data)(nil), "common.Data") + proto.RegisterType((*ResponseMetadata)(nil), "common.ResponseMetadata") proto.RegisterType((*DataResponse)(nil), "common.DataResponse") proto.RegisterType((*DataReply)(nil), "common.DataReply") + proto.RegisterType((*EmptyResponse)(nil), "common.EmptyResponse") + proto.RegisterType((*EmptyReply)(nil), "common.EmptyReply") } func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) } var fileDescriptor_8f954d82c0b891f6 = []byte{ - // 254 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xc1, 0x4b, 0xf3, 0x30, - 0x18, 0xc6, 0xbf, 0x7e, 0xd3, 0xb9, 0xbd, 0x16, 0x1d, 0x71, 0x87, 0x21, 0x1e, 0x46, 0x4f, 0x5a, - 0x71, 0x15, 0x3d, 0x7b, 0xd0, 0xd6, 0xc3, 0x0e, 0x56, 0x08, 0x9e, 0xbc, 0xa5, 0x36, 0xb8, 0xc2, - 0x92, 0xb7, 0x24, 0xaf, 0x42, 0xff, 0x7b, 0x69, 0x92, 0x95, 0x9e, 0xc2, 0x43, 0x7e, 0x3c, 0xbf, - 0x97, 0x07, 0x2e, 0xbe, 0x50, 0x29, 0xd4, 0x99, 0x7f, 0x36, 0xad, 0x41, 0x42, 0x36, 0xf5, 0x29, - 0x49, 0x21, 0x2e, 0xb1, 0x96, 0x6f, 0x92, 0x44, 0x2d, 0x48, 0xb0, 0x4b, 0x98, 0xed, 0xd0, 0x92, - 0x16, 0x4a, 0xae, 0xa2, 0x75, 0x74, 0x3d, 0xe7, 0x43, 0x4e, 0xae, 0xe0, 0xa8, 0xe8, 0x99, 0x25, - 0x1c, 0x57, 0x1d, 0x49, 0xeb, 0x80, 0x98, 0xfb, 0x90, 0xd4, 0x10, 0xf7, 0xbf, 0x5c, 0xda, 0x16, - 0xb5, 0x95, 0xec, 0x1e, 0x66, 0x2a, 0xb4, 0x3a, 0xf0, 0xf4, 0x61, 0xb9, 0x09, 0x27, 0x8c, 0x8d, - 0x7c, 0xa0, 0x58, 0x72, 0xe8, 0xfd, 0xef, 0xf0, 0xf8, 0x80, 0xbb, 0xda, 0x60, 0x79, 0x82, 0xb9, - 0xb7, 0xb4, 0xfb, 0xae, 0x57, 0x98, 0xa0, 0x5b, 0x45, 0xeb, 0xc9, 0x58, 0x31, 0x3e, 0x85, 0x0f, - 0x54, 0x9a, 0xc2, 0x79, 0x8e, 0x9a, 0x44, 0xa3, 0xa5, 0x29, 0x4c, 0xf3, 0x2b, 0x0d, 0x3b, 0x03, - 0xc8, 0xdf, 0xcb, 0x8f, 0xe7, 0x6d, 0xf9, 0xca, 0x8b, 0xc5, 0x3f, 0x76, 0x02, 0x93, 0x9c, 0x6f, - 0x17, 0xd1, 0xcb, 0xed, 0xe7, 0xcd, 0x77, 0x43, 0xbb, 0x9f, 0xaa, 0xef, 0xcc, 0x48, 0xec, 0xd1, - 0xde, 0xd9, 0xce, 0x92, 0x54, 0xd6, 0xa7, 0x4c, 0xb4, 0x4d, 0x58, 0xb5, 0x9a, 0xba, 0x59, 0x1f, - 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x3c, 0xf1, 0xf3, 0x6d, 0x01, 0x00, 0x00, + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0xd1, 0xcf, 0x4b, 0xc3, 0x30, + 0x14, 0x07, 0x70, 0xeb, 0x70, 0x76, 0x6f, 0x53, 0x4b, 0x9c, 0x50, 0x3c, 0x8d, 0x9e, 0xe6, 0xc4, + 0x55, 0xa7, 0x57, 0x11, 0x6d, 0x7b, 0xd8, 0xc1, 0x09, 0xc1, 0xd3, 0x6e, 0xa9, 0x06, 0x57, 0x58, + 0x9a, 0x90, 0x3c, 0x85, 0xfe, 0xf7, 0xd2, 0x26, 0xad, 0xbf, 0x8e, 0x9e, 0xc2, 0x97, 0x3c, 0x3e, + 0xef, 0x0b, 0x0f, 0x8e, 0x5f, 0xa4, 0x10, 0xb2, 0x8c, 0xed, 0x33, 0x57, 0x5a, 0xa2, 0x24, 0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, 0x6f, 0x0e, 0x7a, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0xc9, + 0x87, 0x28, 0x41, 0xe7, 0x01, 0x00, 0x00, } diff --git a/api/common/common.proto b/api/common/common.proto index 6ed82b0b9..a138fc09e 100644 --- a/api/common/common.proto +++ b/api/common/common.proto @@ -5,24 +5,30 @@ package common; option go_package = "github.com/talos-systems/talos/api/common"; // Common metadata message nested in all reply message types -message NodeMetadata { +message ResponseMetadata { + // hostname of the server response comes from (injected by proxy) string hostname = 1; -} - -// The response message containing the requested logs. -message Data { - bytes bytes = 1; + // error is set if request failed to the upstream (rest of response is undefined) + string error = 2; } message DataResponse { - NodeMetadata metadata = 1; - Data bytes = 2; + ResponseMetadata metadata = 1; + bytes bytes = 2; } message DataReply { repeated DataResponse response = 1; } +message EmptyResponse { + ResponseMetadata metadata = 1; +} + +message EmptyReply { + repeated EmptyResponse response = 1; +} + enum ContainerDriver { CONTAINERD = 0; CRI = 1; diff --git a/api/machine/machine.pb.go b/api/machine/machine.pb.go index 439beb4c8..df267a717 100644 --- a/api/machine/machine.pb.go +++ b/api/machine/machine.pb.go @@ -32,10 +32,10 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // rpc reboot // The response message containing the reboot status. type RebootResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RebootResponse) Reset() { *m = RebootResponse{} } @@ -67,7 +67,7 @@ func (m *RebootResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RebootResponse proto.InternalMessageInfo -func (m *RebootResponse) GetMetadata() *common.NodeMetadata { +func (m *RebootResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -120,10 +120,10 @@ func (m *RebootReply) GetResponse() []*RebootResponse { // rpc reset // The response message containing the restart status. type ResetResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ResetResponse) Reset() { *m = ResetResponse{} } @@ -155,7 +155,7 @@ func (m *ResetResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ResetResponse proto.InternalMessageInfo -func (m *ResetResponse) GetMetadata() *common.NodeMetadata { +func (m *ResetResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -208,10 +208,10 @@ func (m *ResetReply) GetResponse() []*ResetResponse { // rpc shutdown // The response message containing the shutdown status. type ShutdownResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ShutdownResponse) Reset() { *m = ShutdownResponse{} } @@ -243,7 +243,7 @@ func (m *ShutdownResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ShutdownResponse proto.InternalMessageInfo -func (m *ShutdownResponse) GetMetadata() *common.NodeMetadata { +func (m *ShutdownResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -338,11 +338,11 @@ func (m *UpgradeRequest) GetImage() string { } type UpgradeResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Ack string `protobuf:"bytes,2,opt,name=ack,proto3" json:"ack,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Ack string `protobuf:"bytes,2,opt,name=ack,proto3" json:"ack,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UpgradeResponse) Reset() { *m = UpgradeResponse{} } @@ -374,7 +374,7 @@ func (m *UpgradeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_UpgradeResponse proto.InternalMessageInfo -func (m *UpgradeResponse) GetMetadata() *common.NodeMetadata { +func (m *UpgradeResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -433,11 +433,11 @@ func (m *UpgradeReply) GetResponse() []*UpgradeResponse { // rpc servicelist type ServiceListResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Services []*ServiceInfo `protobuf:"bytes,2,rep,name=services,proto3" json:"services,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Services []*ServiceInfo `protobuf:"bytes,2,rep,name=services,proto3" json:"services,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ServiceListResponse) Reset() { *m = ServiceListResponse{} } @@ -469,7 +469,7 @@ func (m *ServiceListResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ServiceListResponse proto.InternalMessageInfo -func (m *ServiceListResponse) GetMetadata() *common.NodeMetadata { +func (m *ServiceListResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -807,11 +807,11 @@ func (m *ServiceStartRequest) GetId() string { } type ServiceStartResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ServiceStartResponse) Reset() { *m = ServiceStartResponse{} } @@ -843,7 +843,7 @@ func (m *ServiceStartResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ServiceStartResponse proto.InternalMessageInfo -func (m *ServiceStartResponse) GetMetadata() *common.NodeMetadata { +func (m *ServiceStartResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -944,11 +944,11 @@ func (m *ServiceStopRequest) GetId() string { } type ServiceStopResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ServiceStopResponse) Reset() { *m = ServiceStopResponse{} } @@ -980,7 +980,7 @@ func (m *ServiceStopResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ServiceStopResponse proto.InternalMessageInfo -func (m *ServiceStopResponse) GetMetadata() *common.NodeMetadata { +func (m *ServiceStopResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -1081,11 +1081,11 @@ func (m *ServiceRestartRequest) GetId() string { } type ServiceRestartResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Resp string `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ServiceRestartResponse) Reset() { *m = ServiceRestartResponse{} } @@ -1117,7 +1117,7 @@ func (m *ServiceRestartResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ServiceRestartResponse proto.InternalMessageInfo -func (m *ServiceRestartResponse) GetMetadata() *common.NodeMetadata { +func (m *ServiceRestartResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -1350,58 +1350,6 @@ func (m *StopReply) GetResp() string { return "" } -// StreamingData is used to stream back responses -type StreamingData struct { - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` - Errors string `protobuf:"bytes,2,opt,name=errors,proto3" json:"errors,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamingData) Reset() { *m = StreamingData{} } -func (m *StreamingData) String() string { return proto.CompactTextString(m) } -func (*StreamingData) ProtoMessage() {} -func (*StreamingData) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{28} -} - -func (m *StreamingData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamingData.Unmarshal(m, b) -} - -func (m *StreamingData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamingData.Marshal(b, m, deterministic) -} - -func (m *StreamingData) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingData.Merge(m, src) -} - -func (m *StreamingData) XXX_Size() int { - return xxx_messageInfo_StreamingData.Size(m) -} - -func (m *StreamingData) XXX_DiscardUnknown() { - xxx_messageInfo_StreamingData.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamingData proto.InternalMessageInfo - -func (m *StreamingData) GetBytes() []byte { - if m != nil { - return m.Bytes - } - return nil -} - -func (m *StreamingData) GetErrors() string { - if m != nil { - return m.Errors - } - return "" -} - // CopyOutRequest describes a request to copy data out of Talos node // // CopyOut produces .tar.gz archive which is streamed back to the caller @@ -1417,7 +1365,7 @@ func (m *CopyOutRequest) Reset() { *m = CopyOutRequest{} } func (m *CopyOutRequest) String() string { return proto.CompactTextString(m) } func (*CopyOutRequest) ProtoMessage() {} func (*CopyOutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{29} + return fileDescriptor_84b4f59d98cc997c, []int{28} } func (m *CopyOutRequest) XXX_Unmarshal(b []byte) error { @@ -1468,7 +1416,7 @@ func (m *LSRequest) Reset() { *m = LSRequest{} } func (m *LSRequest) String() string { return proto.CompactTextString(m) } func (*LSRequest) ProtoMessage() {} func (*LSRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{30} + return fileDescriptor_84b4f59d98cc997c, []int{29} } func (m *LSRequest) XXX_Unmarshal(b []byte) error { @@ -1516,23 +1464,24 @@ func (m *LSRequest) GetRecursionDepth() int32 { // FileInfo describes a file or directory's information type FileInfo struct { + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // Name is the name (including prefixed path) of the file or directory - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Size indicates the number of bytes contained within the file - Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` // Mode is the bitmap of UNIX mode/permission flags of the file - Mode uint32 `protobuf:"varint,3,opt,name=mode,proto3" json:"mode,omitempty"` + Mode uint32 `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"` // Modified indicates the UNIX timestamp at which the file was last modified - Modified int64 `protobuf:"varint,4,opt,name=modified,proto3" json:"modified,omitempty"` + Modified int64 `protobuf:"varint,5,opt,name=modified,proto3" json:"modified,omitempty"` // IsDir indicates that the file is a directory - IsDir bool `protobuf:"varint,5,opt,name=is_dir,json=isDir,proto3" json:"is_dir,omitempty"` + IsDir bool `protobuf:"varint,6,opt,name=is_dir,json=isDir,proto3" json:"is_dir,omitempty"` // Error describes any error encountered while trying to read the file // information. - Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` + Error string `protobuf:"bytes,7,opt,name=error,proto3" json:"error,omitempty"` // Link is filled with symlink target - Link string `protobuf:"bytes,7,opt,name=link,proto3" json:"link,omitempty"` + Link string `protobuf:"bytes,8,opt,name=link,proto3" json:"link,omitempty"` // RelativeName is the name of the file or directory relative to the RootPath - RelativeName string `protobuf:"bytes,8,opt,name=relative_name,json=relativeName,proto3" json:"relative_name,omitempty"` + RelativeName string `protobuf:"bytes,9,opt,name=relative_name,json=relativeName,proto3" json:"relative_name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1542,7 +1491,7 @@ func (m *FileInfo) Reset() { *m = FileInfo{} } func (m *FileInfo) String() string { return proto.CompactTextString(m) } func (*FileInfo) ProtoMessage() {} func (*FileInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{31} + return fileDescriptor_84b4f59d98cc997c, []int{30} } func (m *FileInfo) XXX_Unmarshal(b []byte) error { @@ -1567,6 +1516,13 @@ func (m *FileInfo) XXX_DiscardUnknown() { var xxx_messageInfo_FileInfo proto.InternalMessageInfo +func (m *FileInfo) GetMetadata() *common.ResponseMetadata { + if m != nil { + return m.Metadata + } + return nil +} + func (m *FileInfo) GetName() string { if m != nil { return m.Name @@ -1625,18 +1581,18 @@ func (m *FileInfo) GetRelativeName() string { // The response message containing the requested df stats. type MountsResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Stats []*MountStat `protobuf:"bytes,2,rep,name=stats,proto3" json:"stats,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Stats []*MountStat `protobuf:"bytes,2,rep,name=stats,proto3" json:"stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MountsResponse) Reset() { *m = MountsResponse{} } func (m *MountsResponse) String() string { return proto.CompactTextString(m) } func (*MountsResponse) ProtoMessage() {} func (*MountsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{32} + return fileDescriptor_84b4f59d98cc997c, []int{31} } func (m *MountsResponse) XXX_Unmarshal(b []byte) error { @@ -1661,7 +1617,7 @@ func (m *MountsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MountsResponse proto.InternalMessageInfo -func (m *MountsResponse) GetMetadata() *common.NodeMetadata { +func (m *MountsResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -1686,7 +1642,7 @@ func (m *MountsReply) Reset() { *m = MountsReply{} } func (m *MountsReply) String() string { return proto.CompactTextString(m) } func (*MountsReply) ProtoMessage() {} func (*MountsReply) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{33} + return fileDescriptor_84b4f59d98cc997c, []int{32} } func (m *MountsReply) XXX_Unmarshal(b []byte) error { @@ -1733,7 +1689,7 @@ func (m *MountStat) Reset() { *m = MountStat{} } func (m *MountStat) String() string { return proto.CompactTextString(m) } func (*MountStat) ProtoMessage() {} func (*MountStat) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{34} + return fileDescriptor_84b4f59d98cc997c, []int{33} } func (m *MountStat) XXX_Unmarshal(b []byte) error { @@ -1787,19 +1743,19 @@ func (m *MountStat) GetMountedOn() string { } type VersionResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Version *VersionInfo `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Platform *PlatformInfo `protobuf:"bytes,3,opt,name=platform,proto3" json:"platform,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Version *VersionInfo `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Platform *PlatformInfo `protobuf:"bytes,3,opt,name=platform,proto3" json:"platform,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *VersionResponse) Reset() { *m = VersionResponse{} } func (m *VersionResponse) String() string { return proto.CompactTextString(m) } func (*VersionResponse) ProtoMessage() {} func (*VersionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{35} + return fileDescriptor_84b4f59d98cc997c, []int{34} } func (m *VersionResponse) XXX_Unmarshal(b []byte) error { @@ -1824,7 +1780,7 @@ func (m *VersionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_VersionResponse proto.InternalMessageInfo -func (m *VersionResponse) GetMetadata() *common.NodeMetadata { +func (m *VersionResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -1856,7 +1812,7 @@ func (m *VersionReply) Reset() { *m = VersionReply{} } func (m *VersionReply) String() string { return proto.CompactTextString(m) } func (*VersionReply) ProtoMessage() {} func (*VersionReply) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{36} + return fileDescriptor_84b4f59d98cc997c, []int{35} } func (m *VersionReply) XXX_Unmarshal(b []byte) error { @@ -1904,7 +1860,7 @@ func (m *VersionInfo) Reset() { *m = VersionInfo{} } func (m *VersionInfo) String() string { return proto.CompactTextString(m) } func (*VersionInfo) ProtoMessage() {} func (*VersionInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{37} + return fileDescriptor_84b4f59d98cc997c, []int{36} } func (m *VersionInfo) XXX_Unmarshal(b []byte) error { @@ -1983,7 +1939,7 @@ func (m *PlatformInfo) Reset() { *m = PlatformInfo{} } func (m *PlatformInfo) String() string { return proto.CompactTextString(m) } func (*PlatformInfo) ProtoMessage() {} func (*PlatformInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{38} + return fileDescriptor_84b4f59d98cc997c, []int{37} } func (m *PlatformInfo) XXX_Unmarshal(b []byte) error { @@ -2038,7 +1994,7 @@ func (m *LogsRequest) Reset() { *m = LogsRequest{} } func (m *LogsRequest) String() string { return proto.CompactTextString(m) } func (*LogsRequest) ProtoMessage() {} func (*LogsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{39} + return fileDescriptor_84b4f59d98cc997c, []int{38} } func (m *LogsRequest) XXX_Unmarshal(b []byte) error { @@ -2095,7 +2051,7 @@ func (m *ReadRequest) Reset() { *m = ReadRequest{} } func (m *ReadRequest) String() string { return proto.CompactTextString(m) } func (*ReadRequest) ProtoMessage() {} func (*ReadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_84b4f59d98cc997c, []int{40} + return fileDescriptor_84b4f59d98cc997c, []int{39} } func (m *ReadRequest) XXX_Unmarshal(b []byte) error { @@ -2156,7 +2112,6 @@ func init() { proto.RegisterType((*StartReply)(nil), "machine.StartReply") proto.RegisterType((*StopRequest)(nil), "machine.StopRequest") proto.RegisterType((*StopReply)(nil), "machine.StopReply") - proto.RegisterType((*StreamingData)(nil), "machine.StreamingData") proto.RegisterType((*CopyOutRequest)(nil), "machine.CopyOutRequest") proto.RegisterType((*LSRequest)(nil), "machine.LSRequest") proto.RegisterType((*FileInfo)(nil), "machine.FileInfo") @@ -2174,102 +2129,100 @@ func init() { func init() { proto.RegisterFile("machine/machine.proto", fileDescriptor_84b4f59d98cc997c) } var fileDescriptor_84b4f59d98cc997c = []byte{ - // 1515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xeb, 0x6f, 0x13, 0x47, - 0x10, 0x97, 0x1d, 0xc7, 0x8f, 0xb1, 0xe3, 0xc0, 0xe6, 0x81, 0x31, 0xe1, 0x75, 0xd0, 0x82, 0x50, - 0xe3, 0xd0, 0x00, 0x11, 0x8f, 0x16, 0x41, 0x08, 0x88, 0x8a, 0x24, 0xa0, 0x4b, 0xe9, 0x87, 0xb6, - 0xaa, 0xb5, 0xb6, 0x37, 0xf6, 0x8a, 0xbb, 0xdb, 0xeb, 0xed, 0x3a, 0xc8, 0x55, 0xbf, 0xb7, 0xea, - 0xd7, 0xfe, 0x09, 0x95, 0xfa, 0xb7,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0x91, 0xa7, 0xd0, 0x45, 0xe2, 0x10, - 0xba, 0x01, 0x2b, 0x46, 0xc1, 0x97, 0x7b, 0x38, 0x7b, 0x9f, 0x7e, 0x81, 0xd5, 0xac, 0xe2, 0x67, - 0xa5, 0xe5, 0xdb, 0x98, 0x59, 0xfb, 0x92, 0xd9, 0xa3, 0x29, 0x66, 0x97, 0xb3, 0xcc, 0x32, 0x78, - 0x1c, 0x72, 0x1e, 0xd4, 0x4e, 0xca, 0xbd, 0x87, 0xf9, 0x46, 0xce, 0xbb, 0x0e, 0xe0, 0xa4, 0x46, - 0x8a, 0x2c, 0x37, 0x46, 0xa6, 0xb4, 0xae, 0x42, 0xf5, 0x84, 0x0d, 0x57, 0x2a, 0xd7, 0xa0, 0x32, - 0xde, 0x90, 0x59, 0x76, 0xbe, 0x85, 0x85, 0x03, 0x91, 0x10, 0x1c, 0xd2, 0xa8, 0xbf, 0x23, 0x43, - 0xb1, 0x0c, 0xf3, 0x9d, 0x91, 0x20, 0x5c, 0x69, 0xd6, 0x7c, 0x3d, 0x41, 0xab, 0x50, 0x24, 0x49, - 0xc2, 0x12, 0x6e, 0x42, 0x64, 0x66, 0xde, 0x3a, 0xd4, 0x9f, 0xb1, 0x78, 0xf4, 0x7a, 0x68, 0x29, - 0x5d, 0x80, 0x4a, 0xc2, 0x98, 0x68, 0xc7, 0x58, 0x0c, 0x8c, 0xb7, 0xb2, 0x14, 0xbc, 0xc1, 0x62, - 0xe0, 0x75, 0xa0, 0xb2, 0x7b, 0x90, 0x6a, 0x4a, 0x48, 0x8c, 0x09, 0x0b, 0x89, 0x31, 0x21, 0xab, - 0x43, 0x42, 0xba, 0xc3, 0x84, 0x93, 0xb4, 0x3a, 0x98, 0x29, 0xba, 0x01, 0x8b, 0x7a, 0x48, 0x59, - 0xd4, 0xee, 0x91, 0x58, 0x0c, 0x54, 0x81, 0x98, 0xf7, 0xeb, 0x56, 0xbc, 0x23, 0xa5, 0xde, 0x7f, - 0x39, 0x28, 0xb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, 0x16, 0xa9, 0x4d, 0xa9, 0xf8, 0x15, - 0x23, 0x79, 0x1d, 0x79, 0xff, 0xe6, 0x60, 0xf1, 0x07, 0xa2, 0x72, 0xe1, 0x14, 0x11, 0x6b, 0x41, - 0xe9, 0x48, 0x1b, 0x51, 0xc8, 0xdc, 0x36, 0xc4, 0x18, 0x57, 0x6d, 0x48, 0xaa, 0x84, 0xbe, 0x86, - 0x72, 0x1c, 0x60, 0x71, 0xc8, 0x92, 0xd0, 0xdc, 0x97, 0xe3, 0x2b, 0xf9, 0x8d, 0x59, 0xd0, 0x8d, - 0x4b, 0xaa, 0x26, 0x3b, 0x2f, 0x8b, 0xf3, 0x43, 0x9d, 0x57, 0x86, 0x90, 0x13, 0xec, 0xbf, 0x72, - 0x50, 0x75, 0x10, 0xc9, 0xab, 0x5d, 0x60, 0x7b, 0xb5, 0x0b, 0xdc, 0x97, 0x12, 0x3e, 0xc0, 0x69, - 0xcf, 0xc7, 0x07, 0xfa, 0x78, 0x0f, 0x69, 0x20, 0xcc, 0xed, 0xaa, 0x27, 0x32, 0xae, 0x7d, 0xd6, - 0x4e, 0x59, 0x9b, 0xb8, 0xf6, 0x99, 0x31, 0x2e, 0xab, 0x0b, 0xe3, 0x2a, 0xd3, 0x2b, 0x7e, 0x9e, - 0x71, 0xb9, 0x71, 0x38, 0xe9, 0x0e, 0x4c, 0x96, 0xab, 0xb1, 0xb7, 0x05, 0x35, 0x97, 0xec, 0xac, - 0x93, 0xa7, 0x4e, 0x99, 0x29, 0xb3, 0x72, 0xec, 0x05, 0x50, 0xdd, 0x65, 0x7d, 0x9e, 0x16, 0x85, - 0x35, 0xa8, 0x48, 0x55, 0x1e, 0xe3, 0x6e, 0xfa, 0xed, 0x58, 0x60, 0xca, 0x5c, 0xde, 0xb6, 0x64, - 0x1b, 0x50, 0xec, 0x25, 0xf4, 0x88, 0x24, 0x8a, 0x4e, 0x7d, 0xf3, 0x5c, 0xba, 0xb5, 0xcf, 0x58, - 0x24, 0x30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 0xd5, 0xed, 0x8e, 0xd6, 0x66, 0x74, 0x78, 0xda, 0x56, - 0x73, 0xc6, 0xaa, 0xb4, 0xf4, 0xdc, 0x72, 0x93, 0xd7, 0x3b, 0xba, 0x70, 0x7c, 0x63, 0xa5, 0xed, - 0x9c, 0x3f, 0x7e, 0x51, 0x9a, 0x79, 0x08, 0xe5, 0xf4, 0x69, 0xfa, 0x31, 0xb9, 0x39, 0xf1, 0xde, - 0x7d, 0x00, 0x25, 0xf3, 0x20, 0x74, 0xce, 0xc5, 0xe4, 0x53, 0xb6, 0xb9, 0x32, 0xbd, 0xa0, 0x3b, - 0xc3, 0x79, 0x1d, 0x00, 0xe7, 0xdd, 0xe2, 0x32, 0x5f, 0xca, 0x8a, 0xe3, 0x60, 0xe4, 0xcd, 0xfd, - 0x99, 0xcf, 0xa1, 0x7b, 0x50, 0x50, 0x84, 0x9d, 0x57, 0xa1, 0xc3, 0x14, 0x65, 0xa4, 0xf6, 0xb3, - 0xfb, 0x50, 0x4a, 0xeb, 0xd8, 0x2c, 0x9a, 0x2b, 0xd3, 0xc5, 0x36, 0x0e, 0x46, 0xdb, 0xaf, 0x60, - 0xb1, 0xcb, 0x42, 0xbb, 0x86, 0x63, 0xba, 0x0d, 0xa6, 0x32, 0x3c, 0x8d, 0xe9, 0x9b, 0xdc, 0x8f, - 0xb7, 0xfa, 0x54, 0x0c, 0x86, 0x1d, 0x79, 0xb2, 0x36, 0x04, 0x0e, 0x18, 0x5f, 0xd7, 0x37, 0x1b, - 0xd7, 0xb3, 0x0d, 0x1c, 0xd3, 0xf4, 0x8f, 0x9e, 0x4e, 0x51, 0xf9, 0xbc, 0xf3, 0x7f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x4a, 0x46, 0xbd, 0x4c, 0x02, 0x12, 0x00, 0x00, + // 1483 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6f, 0x13, 0xc7, + 0x16, 0xd7, 0x3a, 0x1f, 0xb6, 0x8f, 0x13, 0x07, 0x26, 0x1f, 0x18, 0x13, 0xbe, 0x16, 0xee, 0x05, + 0x21, 0xc5, 0xe1, 0x86, 0x80, 0xb8, 0x70, 0x75, 0x45, 0x21, 0x41, 0x54, 0x24, 0x80, 0x36, 0x6d, + 0xa5, 0xf6, 0xc5, 0x1d, 0xdb, 0x13, 0x7b, 0xc4, 0xee, 0xce, 0x76, 0x67, 0x1c, 0x94, 0xaa, 0x7d, + 0x6f, 0xfb, 0xda, 0x3f, 0xa1, 0x6f, 0xfd, 0x23, 0xab, 0x6a, 0x3e, 0x3d, 0x5e, 0xc7, 0x01, 0xd5, + 0x3c, 0x79, 0xe6, 0xcc, 0xd9, 0x73, 0xce, 0xef, 0x7c, 0xcd, 0x19, 0xc3, 0x7a, 0x82, 0xbb, 0x03, + 0x9a, 0x92, 0x6d, 0xf3, 0xdb, 0xca, 0x72, 0x26, 0x18, 0x2a, 0x9b, 0x6d, 0xf3, 0x4a, 0x9f, 0xb1, + 0x7e, 0x4c, 0xb6, 0x15, 0xb9, 0x33, 0x3c, 0xde, 0x26, 0x49, 0x26, 0x4e, 0x35, 0x57, 0xf3, 0x7a, + 0xf1, 0x50, 0xd0, 0x84, 0x70, 0x81, 0x93, 0xcc, 0x30, 0xac, 0x76, 0x59, 0x92, 0xb0, 0x74, 0x5b, + 0xff, 0x68, 0x62, 0xf8, 0x12, 0xea, 0x11, 0xe9, 0x30, 0x26, 0x22, 0xc2, 0x33, 0x96, 0x72, 0x82, + 0x76, 0xa1, 0x92, 0x10, 0x81, 0x7b, 0x58, 0xe0, 0x46, 0x70, 0x23, 0xb8, 0x5b, 0xdb, 0x69, 0xb4, + 0xcc, 0x27, 0x96, 0xe7, 0xd0, 0x9c, 0x47, 0x8e, 0x33, 0x7c, 0x0e, 0x35, 0x2b, 0x27, 0x8b, 0x4f, + 0xd1, 0x03, 0xa8, 0xe4, 0x86, 0xb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7, 0xb0, 0x36, 0xce, 0x36, 0x53, 0x52, 0x23, 0x98, 0x97, 0x09, 0x66, + 0x7c, 0xab, 0xd6, 0xe1, 0x1b, 0xb8, 0x38, 0xae, 0x41, 0xe6, 0xed, 0x7f, 0x27, 0xf2, 0xf6, 0x6a, + 0x31, 0xb0, 0x63, 0xf6, 0x78, 0x89, 0x7b, 0x1b, 0x90, 0xe3, 0x60, 0xd9, 0x34, 0x5c, 0x6d, 0x0f, + 0xbe, 0xe4, 0xfa, 0xec, 0xb0, 0x46, 0xd5, 0xa8, 0x15, 0x7c, 0x62, 0x35, 0xfa, 0xd6, 0x78, 0xa0, + 0xee, 0xc0, 0xba, 0x61, 0x88, 0x64, 0x2c, 0xa7, 0xc7, 0xab, 0x03, 0x1b, 0x45, 0xc6, 0xcf, 0x0e, + 0x2d, 0x72, 0xbe, 0x73, 0x3a, 0x24, 0xba, 0xa7, 0x13, 0xe8, 0xae, 0x17, 0xd1, 0x15, 0x6c, 0xf2, + 0x00, 0x86, 0xb0, 0x74, 0x5e, 0x1e, 0x3e, 0x29, 0x35, 0x82, 0xf0, 0x36, 0x80, 0x97, 0x22, 0xd6, + 0xb2, 0x60, 0x64, 0x99, 0xe2, 0xba, 0x09, 0xb5, 0x73, 0x02, 0xaf, 0x58, 0x6e, 0x41, 0x75, 0x14, + 0x94, 0x69, 0x72, 0xb6, 0xa0, 0xfe, 0x82, 0x65, 0xa7, 0x6f, 0x87, 0xce, 0xa6, 0x2b, 0x50, 0xcd, + 0x19, 0x13, 0xed, 0x0c, 0x8b, 0x81, 0x61, 0xaf, 0x48, 0xc2, 0x3b, 0x2c, 0x06, 0x61, 0x07, 0xaa, + 0x07, 0x47, 0x96, 0x53, 0xca, 0x64, 0x4c, 0x38, 0x99, 0x8c, 0x09, 0x59, 0xea, 0x39, 0xe9, 0x0e, + 0x73, 0x4e, 0x6c, 0xa9, 0x9b, 0x2d, 0xba, 0x03, 0x2b, 0x7a, 0x49, 0x59, 0xda, 0xee, 0x91, 0x4c, + 0x0c, 0x54, 0xb5, 0x2f, 0x44, 0x75, 0x47, 0xde, 0x93, 0xd4, 0xf0, 0xaf, 0x00, 0x2a, 0x2f, 0x69, + 0xac, 0x1b, 0xf2, 0x3f, 0x8e, 0x67, 0x8a, 0x13, 0xdb, 0xdd, 0xd4, 0x5a, 0xd2, 0x38, 0xfd, 0x51, + 0xb7, 0x98, 0xb9, 0x48, 0xad, 0x25, 0x2d, 0x61, 0x3d, 0xdd, 0x54, 0x96, 0x23, 0xb5, 0x46, 0x4d, + 0xa8, 0x24, 0xac, 0x47, 0x8f, 0x29, 0xe9, 0x35, 0x16, 0x14, 0xaf, 0xdb, 0xa3, 0x75, 0x58, 0xa4, + 0xbc, 0xdd, 0xa3, 0x79, 0x63, 0x51, 0x81, 0x5b, 0xa0, 0x7c, 0x8f, 0xe6, 0xb2, 0x9b, 0x92, 0x3c, + 0x67, 0x79, 0xa3, 0xac, 0xbb, 0xa9, 0xda, 0x48, 0xe1, 0x31, 0x4d, 0xdf, 0x37, 0x2a, 0xda, 0x08, + 0xb9, 0x46, 0xb7, 0x60, 0x39, 0x27, 0x31, 0x16, 0xf4, 0x84, 0xb4, 0x95, 0x85, 0x55, 0x75, 0xb8, + 0x64, 0x89, 0x6f, 0x70, 0x42, 0xc2, 0x0c, 0xea, 0x87, 0x6c, 0x28, 0x2f, 0x90, 0xd9, 0xb2, 0xfa, + 0xae, 0x6e, 0xf2, 0xf6, 0x66, 0x45, 0x2e, 0x4f, 0x95, 0xf4, 0x23, 0x81, 0x85, 0x6e, 0xfc, 0x5c, + 0xce, 0x7e, 0x56, 0xe3, 0xc7, 0x66, 0xbf, 0x71, 0xcb, 0xbc, 0xdc, 0xfe, 0x09, 0xaa, 0x4e, 0x2e, + 0xba, 0x06, 0x70, 0x4c, 0x63, 0xc2, 0x4f, 0xb9, 0x20, 0x89, 0x49, 0x10, 0x8f, 0xe2, 0x82, 0x21, + 0x03, 0x34, 0x6f, 0x82, 0xb1, 0x09, 0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ac, 0x23, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2329,7 +2282,7 @@ func (c *machineClient) CopyOut(ctx context.Context, in *CopyOutRequest, opts .. } type Machine_CopyOutClient interface { - Recv() (*StreamingData, error) + Recv() (*common.DataResponse, error) grpc.ClientStream } @@ -2337,8 +2290,8 @@ type machineCopyOutClient struct { grpc.ClientStream } -func (x *machineCopyOutClient) Recv() (*StreamingData, error) { - m := new(StreamingData) +func (x *machineCopyOutClient) Recv() (*common.DataResponse, error) { + m := new(common.DataResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -2361,7 +2314,7 @@ func (c *machineClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts .. } type Machine_KubeconfigClient interface { - Recv() (*StreamingData, error) + Recv() (*common.DataResponse, error) grpc.ClientStream } @@ -2369,8 +2322,8 @@ type machineKubeconfigClient struct { grpc.ClientStream } -func (x *machineKubeconfigClient) Recv() (*StreamingData, error) { - m := new(StreamingData) +func (x *machineKubeconfigClient) Recv() (*common.DataResponse, error) { + m := new(common.DataResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -2425,7 +2378,7 @@ func (c *machineClient) Logs(ctx context.Context, in *LogsRequest, opts ...grpc. } type Machine_LogsClient interface { - Recv() (*common.Data, error) + Recv() (*common.DataResponse, error) grpc.ClientStream } @@ -2433,8 +2386,8 @@ type machineLogsClient struct { grpc.ClientStream } -func (x *machineLogsClient) Recv() (*common.Data, error) { - m := new(common.Data) +func (x *machineLogsClient) Recv() (*common.DataResponse, error) { + m := new(common.DataResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -2466,7 +2419,7 @@ func (c *machineClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc. } type Machine_ReadClient interface { - Recv() (*StreamingData, error) + Recv() (*common.DataResponse, error) grpc.ClientStream } @@ -2474,8 +2427,8 @@ type machineReadClient struct { grpc.ClientStream } -func (x *machineReadClient) Recv() (*StreamingData, error) { - m := new(StreamingData) +func (x *machineReadClient) Recv() (*common.DataResponse, error) { + m := new(common.DataResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -2617,7 +2570,7 @@ func _Machine_CopyOut_Handler(srv interface{}, stream grpc.ServerStream) error { } type Machine_CopyOutServer interface { - Send(*StreamingData) error + Send(*common.DataResponse) error grpc.ServerStream } @@ -2625,7 +2578,7 @@ type machineCopyOutServer struct { grpc.ServerStream } -func (x *machineCopyOutServer) Send(m *StreamingData) error { +func (x *machineCopyOutServer) Send(m *common.DataResponse) error { return x.ServerStream.SendMsg(m) } @@ -2638,7 +2591,7 @@ func _Machine_Kubeconfig_Handler(srv interface{}, stream grpc.ServerStream) erro } type Machine_KubeconfigServer interface { - Send(*StreamingData) error + Send(*common.DataResponse) error grpc.ServerStream } @@ -2646,7 +2599,7 @@ type machineKubeconfigServer struct { grpc.ServerStream } -func (x *machineKubeconfigServer) Send(m *StreamingData) error { +func (x *machineKubeconfigServer) Send(m *common.DataResponse) error { return x.ServerStream.SendMsg(m) } @@ -2680,7 +2633,7 @@ func _Machine_Logs_Handler(srv interface{}, stream grpc.ServerStream) error { } type Machine_LogsServer interface { - Send(*common.Data) error + Send(*common.DataResponse) error grpc.ServerStream } @@ -2688,7 +2641,7 @@ type machineLogsServer struct { grpc.ServerStream } -func (x *machineLogsServer) Send(m *common.Data) error { +func (x *machineLogsServer) Send(m *common.DataResponse) error { return x.ServerStream.SendMsg(m) } @@ -2719,7 +2672,7 @@ func _Machine_Read_Handler(srv interface{}, stream grpc.ServerStream) error { } type Machine_ReadServer interface { - Send(*StreamingData) error + Send(*common.DataResponse) error grpc.ServerStream } @@ -2727,7 +2680,7 @@ type machineReadServer struct { grpc.ServerStream } -func (x *machineReadServer) Send(m *StreamingData) error { +func (x *machineReadServer) Send(m *common.DataResponse) error { return x.ServerStream.SendMsg(m) } diff --git a/api/machine/machine.proto b/api/machine/machine.proto index 9832a7184..c38e564cf 100644 --- a/api/machine/machine.proto +++ b/api/machine/machine.proto @@ -13,12 +13,12 @@ import "common/common.proto"; // The machine service definition. service Machine { - rpc CopyOut(CopyOutRequest) returns (stream StreamingData); - rpc Kubeconfig(google.protobuf.Empty) returns (stream StreamingData); + rpc CopyOut(CopyOutRequest) returns (stream common.DataResponse); + rpc Kubeconfig(google.protobuf.Empty) returns (stream common.DataResponse); rpc LS(LSRequest) returns (stream FileInfo); - rpc Logs(LogsRequest) returns (stream common.Data); + rpc Logs(LogsRequest) returns (stream common.DataResponse); rpc Mounts(google.protobuf.Empty) returns (MountsReply); - rpc Read(ReadRequest) returns (stream StreamingData); + rpc Read(ReadRequest) returns (stream common.DataResponse); rpc Reboot(google.protobuf.Empty) returns (RebootReply); rpc Reset(google.protobuf.Empty) returns (ResetReply); rpc ServiceList(google.protobuf.Empty) returns (ServiceListReply); @@ -41,7 +41,7 @@ service Machine { // rpc reboot // The response message containing the reboot status. message RebootResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; } message RebootReply { repeated RebootResponse response = 1; @@ -50,7 +50,7 @@ message RebootReply { // rpc reset // The response message containing the restart status. message ResetResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; } message ResetReply { repeated ResetResponse response = 1; @@ -59,7 +59,7 @@ message ResetReply { // rpc shutdown // The response message containing the shutdown status. message ShutdownResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; } message ShutdownReply { repeated ShutdownResponse response = 1; @@ -70,7 +70,7 @@ message UpgradeRequest { string image = 1; } message UpgradeResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; string ack = 2; } message UpgradeReply { @@ -79,7 +79,7 @@ message UpgradeReply { // rpc servicelist message ServiceListResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated ServiceInfo services = 2; } message ServiceListReply { @@ -116,7 +116,7 @@ message ServiceStartRequest { } message ServiceStartResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; string resp = 2; } message ServiceStartReply { @@ -128,7 +128,7 @@ message ServiceStopRequest { } message ServiceStopResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; string resp = 2; } message ServiceStopReply { @@ -140,7 +140,7 @@ message ServiceRestartRequest { } message ServiceRestartResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; string resp = 2; } message ServiceRestartReply { @@ -167,12 +167,6 @@ message StopReply { string resp = 1; } -// StreamingData is used to stream back responses -message StreamingData { - bytes bytes = 1; - string errors = 2; -} - // CopyOutRequest describes a request to copy data out of Talos node // // CopyOut produces .tar.gz archive which is streamed back to the caller @@ -195,28 +189,29 @@ message LSRequest { // FileInfo describes a file or directory's information message FileInfo { + common.ResponseMetadata metadata = 1; // Name is the name (including prefixed path) of the file or directory - string name = 1; + string name = 2; // Size indicates the number of bytes contained within the file - int64 size = 2; + int64 size = 3; // Mode is the bitmap of UNIX mode/permission flags of the file - uint32 mode = 3; + uint32 mode = 4; // Modified indicates the UNIX timestamp at which the file was last modified - int64 modified = 4; // TODO: unix timestamp or include proto's Date type + int64 modified = 5; // TODO: unix timestamp or include proto's Date type // IsDir indicates that the file is a directory - bool is_dir = 5; + bool is_dir = 6; // Error describes any error encountered while trying to read the file // information. - string error = 6; + string error = 7; // Link is filled with symlink target - string link = 7; + string link = 8; // RelativeName is the name of the file or directory relative to the RootPath - string relative_name = 8; + string relative_name = 9; } // The response message containing the requested df stats. message MountsResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated MountStat stats = 2; } message MountsReply { @@ -232,7 +227,7 @@ message MountStat { } message VersionResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; VersionInfo version = 2; PlatformInfo platform = 3; } diff --git a/api/network/network.pb.go b/api/network/network.pb.go index 526be121b..69e4aaf62 100644 --- a/api/network/network.pb.go +++ b/api/network/network.pb.go @@ -211,11 +211,11 @@ func (m *RoutesReply) GetResponse() []*RoutesResponse { } type RoutesResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Routes []*Route `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Routes []*Route `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RoutesResponse) Reset() { *m = RoutesResponse{} } @@ -247,7 +247,7 @@ func (m *RoutesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RoutesResponse proto.InternalMessageInfo -func (m *RoutesResponse) GetMetadata() *common.NodeMetadata { +func (m *RoutesResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -422,11 +422,11 @@ func (m *InterfacesReply) GetResponse() []*InterfacesResponse { } type InterfacesResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Interfaces []*Interface `protobuf:"bytes,2,rep,name=interfaces,proto3" json:"interfaces,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Interfaces []*Interface `protobuf:"bytes,2,rep,name=interfaces,proto3" json:"interfaces,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *InterfacesResponse) Reset() { *m = InterfacesResponse{} } @@ -458,7 +458,7 @@ func (m *InterfacesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_InterfacesResponse proto.InternalMessageInfo -func (m *InterfacesResponse) GetMetadata() *common.NodeMetadata { +func (m *InterfacesResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -571,59 +571,59 @@ func init() { func init() { proto.RegisterFile("network/network.proto", fileDescriptor_96ad937ae012c472) } var fileDescriptor_96ad937ae012c472 = []byte{ - // 830 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4d, 0x6f, 0xeb, 0x44, - 0x14, 0xc5, 0xf9, 0xce, 0x4d, 0x9d, 0x4c, 0xa7, 0xa5, 0xb5, 0xfa, 0x58, 0x44, 0x59, 0xa0, 0x2a, - 0xd2, 0x4b, 0x50, 0x1e, 0x2a, 0x3b, 0x24, 0x3b, 0x71, 0x1e, 0x21, 0xa9, 0x6d, 0xa6, 0x2e, 0xa0, - 0xb7, 0xa9, 0xa6, 0xf1, 0x24, 0xcf, 0x10, 0x7f, 0xc8, 0x76, 0x54, 0xc2, 0x0e, 0xf1, 0x4b, 0xf8, - 0x05, 0x6c, 0xf9, 0x79, 0xc8, 0xe3, 0xb1, 0xeb, 0x10, 0xd8, 0xb0, 0xf2, 0xdc, 0x73, 0xce, 0xdc, - 0x7b, 0x67, 0xce, 0xcc, 0x18, 0x3e, 0xf5, 0x59, 0xf2, 0x12, 0x44, 0x3f, 0x8f, 0xc5, 0x77, 0x14, - 0x46, 0x41, 0x12, 0xe0, 0xa6, 0x08, 0x6f, 0xde, 0x6c, 0x83, 0x60, 0xbb, 0x63, 0x63, 0x0e, 0x3f, - 0xef, 0x37, 0x63, 0xe6, 0x85, 0xc9, 0x21, 0x53, 0xdd, 0x5c, 0xac, 0x03, 0xcf, 0x0b, 0xfc, 0x71, - 0xf6, 0xc9, 0xc0, 0x81, 0x06, 0x1d, 0x12, 0xec, 0x13, 0x16, 0x13, 0x16, 0xee, 0x0e, 0xf8, 0x1d, - 0xb4, 0x22, 0x16, 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0x02, - 0x81, 0xdf, 0x21, 0xb8, 0xa9, 0x20, 0x69, 0xf8, 0x67, 0x05, 0xe4, 0xa3, 0x73, 0x80, 0xcf, 0x41, - 0x26, 0xb6, 0x45, 0x4c, 0xfb, 0x35, 0xef, 0x05, 0xf4, 0x04, 0x44, 0xf4, 0xd9, 0x82, 0xe8, 0x53, - 0x1b, 0x49, 0x25, 0xdd, 0x52, 0x27, 0x86, 0xbe, 0x42, 0x15, 0xdc, 0x83, 0x8e, 0x80, 0x34, 0xd3, - 0xb4, 0x51, 0xb5, 0xa4, 0x79, 0xb0, 0x55, 0x7b, 0x31, 0x45, 0x35, 0x8c, 0xe0, 0x4c, 0x40, 0xef, - 0x55, 0x5b, 0x9f, 0xa1, 0x56, 0xba, 0x88, 0x3c, 0xbb, 0x8a, 0xda, 0xb8, 0x0b, 0x20, 0xc2, 0x7b, - 0x62, 0x23, 0x28, 0x4d, 0xf8, 0xa0, 0x6b, 0x44, 0x45, 0x9d, 0x72, 0x99, 0x05, 0x99, 0xa1, 0xb3, - 0x52, 0x7f, 0x33, 0x83, 0x98, 0x8f, 0x69, 0x5a, 0xb9, 0xa4, 0xfa, 0xd1, 0x24, 0x16, 0xea, 0x96, - 0x12, 0x1b, 0xf6, 0x12, 0xf5, 0x4a, 0x82, 0xd9, 0x37, 0x53, 0x0b, 0x21, 0x8c, 0xa1, 0x5b, 0x54, - 0xce, 0xb2, 0x9c, 0x97, 0xaa, 0x6b, 0xaa, 0xa6, 0xaf, 0xd0, 0x70, 0xf8, 0xbb, 0x04, 0xdd, 0x63, - 0xf3, 0x52, 0xd1, 0x7c, 0xa5, 0xbe, 0x7f, 0x7a, 0x34, 0x96, 0x86, 0xf9, 0x83, 0x91, 0x39, 0x91, - 0x21, 0x16, 0x92, 0xd2, 0xbc, 0x3c, 0xd0, 0x88, 0xa9, 0xce, 0xa6, 0xea, 0x43, 0xea, 0xce, 0x39, - 0xc8, 0x1c, 0x5b, 0x99, 0xa6, 0xa5, 0xa9, 0xd3, 0x25, 0xaa, 0xe2, 0x6b, 0xb8, 0xe0, 0x90, 0x65, - 0x2e, 0x0c, 0xfb, 0xc9, 0x36, 0xb3, 0x01, 0xaa, 0x15, 0xf3, 0xef, 0x1f, 0x57, 0xf6, 0x82, 0xcf, - 0xaf, 0x4f, 0x7e, 0x93, 0xa0, 0x69, 0x64, 0x47, 0x09, 0xdf, 0x41, 0x23, 0x7b, 0x29, 0xf1, 0xd5, - 0x28, 0x7b, 0xaa, 0x47, 0xf9, 0x53, 0x3d, 0xd2, 0xd3, 0xa7, 0xfa, 0xe6, 0xf2, 0xe4, 0xb9, 0x4d, - 0xaf, 0xef, 0xd7, 0x00, 0xaf, 0xb7, 0xf0, 0x3f, 0xe7, 0x2a, 0xff, 0x7a, 0xa5, 0xc3, 0xdd, 0x41, - 0x5b, 0x42, 0x6f, 0x1d, 0x78, 0x05, 0x4d, 0x43, 0x57, 0x03, 0xd1, 0x93, 0x1a, 0xba, 0x96, 0xf4, - 0x61, 0xb8, 0x75, 0x93, 0x8f, 0xfb, 0xe7, 0xf4, 0x12, 0x8f, 0x13, 0xba, 0x0b, 0xe2, 0xb7, 0xf1, - 0x21, 0x4e, 0x98, 0x17, 0x67, 0xd1, 0x98, 0x86, 0x6e, 0xfe, 0xcf, 0x79, 0x6e, 0xf0, 0xb2, 0xef, - 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xb1, 0x46, 0x21, 0x8d, 0x06, 0x00, 0x00, + // 829 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4d, 0x6f, 0xe3, 0x36, + 0x10, 0xad, 0xfc, 0xed, 0x71, 0x64, 0x33, 0xcc, 0x36, 0x11, 0xb2, 0x3d, 0x18, 0x3e, 0x14, 0x81, + 0x81, 0xb5, 0x01, 0xef, 0x22, 0xbd, 0x15, 0x90, 0x6c, 0x79, 0xeb, 0xda, 0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x82, 0xa6, 0xa1, 0xab, 0x81, 0xe8, 0x49, 0x0d, 0x5d, 0x4b, 0xfa, 0x34, + 0xdc, 0xba, 0xc9, 0xf3, 0xfe, 0x29, 0xbd, 0xc8, 0xe3, 0x84, 0xee, 0x82, 0xf8, 0x5d, 0x7c, 0x88, + 0x13, 0xe6, 0xc5, 0x59, 0x34, 0xa6, 0xa1, 0x9b, 0xff, 0x7b, 0x9e, 0x1a, 0xbc, 0xec, 0xfb, 0x7f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x6f, 0x63, 0x58, 0x95, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/network/network.proto b/api/network/network.proto index ae2311b9a..26420ccd3 100644 --- a/api/network/network.proto +++ b/api/network/network.proto @@ -59,7 +59,7 @@ message RoutesReply { } message RoutesResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated Route routes = 2; } @@ -90,7 +90,7 @@ message InterfacesReply { } message InterfacesResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated Interface interfaces = 2; } diff --git a/api/os/os.pb.go b/api/os/os.pb.go index 8888ee290..cf071cb3e 100644 --- a/api/os/os.pb.go +++ b/api/os/os.pb.go @@ -174,11 +174,11 @@ func (m *Container) GetName() string { // The response message containing the requested containers. type ContainerResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Containers []*Container `protobuf:"bytes,2,rep,name=containers,proto3" json:"containers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Containers []*Container `protobuf:"bytes,2,rep,name=containers,proto3" json:"containers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ContainerResponse) Reset() { *m = ContainerResponse{} } @@ -210,7 +210,7 @@ func (m *ContainerResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ContainerResponse proto.InternalMessageInfo -func (m *ContainerResponse) GetMetadata() *common.NodeMetadata { +func (m *ContainerResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -347,11 +347,11 @@ func (m *ProcessesReply) GetResponse() []*ProcessResponse { } type ProcessResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Processes []*Process `protobuf:"bytes,2,rep,name=processes,proto3" json:"processes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Processes []*Process `protobuf:"bytes,2,rep,name=processes,proto3" json:"processes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ProcessResponse) Reset() { *m = ProcessResponse{} } @@ -383,7 +383,7 @@ func (m *ProcessResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ProcessResponse proto.InternalMessageInfo -func (m *ProcessResponse) GetMetadata() *common.NodeMetadata { +func (m *ProcessResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -575,10 +575,10 @@ func (m *RestartRequest) GetDriver() common.ContainerDriver { } type RestartResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RestartResponse) Reset() { *m = RestartResponse{} } @@ -610,7 +610,7 @@ func (m *RestartResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RestartResponse proto.InternalMessageInfo -func (m *RestartResponse) GetMetadata() *common.NodeMetadata { +func (m *RestartResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -716,11 +716,11 @@ func (m *StatsRequest) GetDriver() common.ContainerDriver { // The response message containing the requested stats. type StatsResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Stats []*Stat `protobuf:"bytes,2,rep,name=stats,proto3" json:"stats,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Stats []*Stat `protobuf:"bytes,2,rep,name=stats,proto3" json:"stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StatsResponse) Reset() { *m = StatsResponse{} } @@ -752,7 +752,7 @@ func (m *StatsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_StatsResponse proto.InternalMessageInfo -func (m *StatsResponse) GetMetadata() *common.NodeMetadata { +func (m *StatsResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -894,11 +894,11 @@ func (m *Stat) GetName() string { } type MemInfoResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Meminfo *MemInfo `protobuf:"bytes,2,opt,name=meminfo,proto3" json:"meminfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Meminfo *MemInfo `protobuf:"bytes,2,opt,name=meminfo,proto3" json:"meminfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MemInfoResponse) Reset() { *m = MemInfoResponse{} } @@ -930,7 +930,7 @@ func (m *MemInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MemInfoResponse proto.InternalMessageInfo -func (m *MemInfoResponse) GetMetadata() *common.NodeMetadata { +func (m *MemInfoResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -1430,95 +1430,95 @@ func init() { func init() { proto.RegisterFile("os/os.proto", fileDescriptor_b20a722d09fd3254) } var fileDescriptor_b20a722d09fd3254 = []byte{ - // 1400 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdb, 0x6e, 0x1b, 0xb7, - 0x16, 0x85, 0x64, 0xc9, 0xb2, 0x68, 0x5b, 0xb6, 0xe9, 0x5c, 0x18, 0x27, 0x27, 0xc7, 0xd1, 0x89, - 0x13, 0xe7, 0x9c, 0xd8, 0x4a, 0x7c, 0x0a, 0xb4, 0x40, 0x0b, 0x14, 0x49, 0xdc, 0x87, 0x3c, 0xa4, - 0x09, 0x26, 0xed, 0x4b, 0x81, 0xc2, 0xa0, 0x66, 0x28, 0x89, 0xf5, 0x70, 0x38, 0x1d, 0x72, 0x94, - 0xba, 0xbf, 0xd0, 0x1f, 0xe8, 0x5b, 0x5f, 0xfa, 0x17, 0xfd, 0xb9, 0x62, 0x73, 0x73, 0x46, 0x1c, - 0xe5, 0xd2, 0x24, 0x45, 0x9f, 0x34, 0x7b, 0xed, 0xc5, 0x45, 0xee, 0x0b, 0x2f, 0x22, 0xeb, 0xda, - 0x8c, 0xb4, 0x39, 0xce, 0x0b, 0x6d, 0x35, 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0x80, 0x5c, 0xb6, 0x53, 0x1d, 0x9f, 0x8b, 0x84, 0x0d, 0x7c, 0xb6, 0xd1, 0x84, 0xae, 0x87, 0x2c, - 0x60, 0x91, 0xb6, 0x9c, 0x6f, 0x01, 0x40, 0xf4, 0x60, 0xb8, 0x32, 0x6d, 0x63, 0xf4, 0x95, 0x0d, - 0xf7, 0x42, 0x22, 0x0b, 0x7b, 0xc1, 0x76, 0x9c, 0x03, 0x0d, 0xd0, 0x7b, 0x55, 0x48, 0x2b, 0xc6, - 0x3c, 0x3e, 0x67, 0x14, 0xf5, 0x6a, 0x00, 0xbc, 0x10, 0x75, 0xce, 0xa7, 0xc2, 0xb0, 0x5d, 0xf4, - 0xd6, 0x00, 0xd4, 0x40, 0xf1, 0x3c, 0x17, 0x09, 0xbb, 0x84, 0x35, 0x40, 0xcb, 0xdd, 0x40, 0x33, - 0x25, 0x14, 0xbb, 0x8c, 0x33, 0x39, 0x03, 0xb6, 0x8a, 0x49, 0xf9, 0x98, 0x5d, 0x71, 0xa0, 0xfb, - 0x86, 0x6c, 0x99, 0x42, 0xc4, 0x29, 0x97, 0xca, 0xa5, 0xe2, 0x2a, 0x66, 0x2b, 0xc4, 0x5c, 0x27, - 0x94, 0x99, 0x47, 0x18, 0xf3, 0x9d, 0x50, 0x23, 0x90, 0xcd, 0x73, 0x51, 0x64, 0x22, 0x35, 0x16, - 0x62, 0xb8, 0x86, 0xd9, 0x0c, 0x20, 0x50, 0x80, 0x05, 0xbb, 0xd4, 0x1a, 0xb6, 0x87, 0x0a, 0x0b, - 0x04, 0x14, 0xb2, 0x89, 0x29, 0x33, 0x83, 0xf5, 0xb8, 0x8e, 0x0a, 0x01, 0x04, 0x91, 0x8e, 0x75, - 0x99, 0xc5, 0x82, 0xdd, 0xc0, 0x48, 0xd1, 0x82, 0xf5, 0xd7, 0xc9, 0xb2, 0x2a, 0x67, 0xff, 0xc2, - 0xf5, 0x87, 0x18, 0xa8, 0xc3, 0x56, 0x97, 0x36, 0x95, 0x4a, 0x5a, 0x76, 0x13, 0xd5, 0x03, 0x68, - 0xc1, 0xb0, 0x22, 0xe1, 0x86, 0xfd, 0x3b, 0x64, 0x38, 0x08, 0xe6, 0x99, 0x2b, 0x9e, 0xa6, 0x3a, - 0xc6, 0xc2, 0xef, 0xe3, 0x3c, 0x21, 0x06, 0x2a, 0xde, 0x2e, 0x8d, 0x48, 0xd8, 0x2d, 0x54, 0x09, - 0xa0, 0x40, 0x25, 0x9e, 0x95, 0xd9, 0x39, 0x1b, 0x36, 0x54, 0x1c, 0x46, 0xef, 0x93, 0x9d, 0x19, - 0x2f, 0x92, 0x57, 0xbc, 0x10, 0xb1, 0x2e, 0x8a, 0x32, 0xb7, 0x22, 0x61, 0xff, 0x71, 0xc4, 0xd7, - 0x1d, 0xf4, 0x36, 0xd9, 0x84, 0x76, 0x98, 0x95, 0x53, 0x81, 0x3d, 0x72, 0x1b, 0xdf, 0x07, 0x0d, - 0x90, 0xde, 0x21, 0x03, 0xd7, 0x02, 0x0b, 0xda, 0x01, 0x3e, 0x0f, 0x9a, 0x68, 0xcd, 0xcb, 0x55, - 0xe2, 0xfb, 0xea, 0x4e, 0xc0, 0xab, 0x51, 0xe8, 0xf2, 0x58, 0x71, 0xcc, 0xc4, 0x5d, 0x7f, 0x4e, - 0x7b, 0xdb, 0x3d, 0x31, 0x14, 0x77, 0x1b, 0xe0, 0x10, 0x77, 0x8e, 0x37, 0x41, 0xbd, 0x9e, 0x0a, - 0xc7, 0xde, 0x43, 0xf5, 0x26, 0x0a, 0x31, 0xd5, 0x88, 0xd3, 0xf9, 0x2f, 0xc6, 0xd4, 0x00, 0x1b, - 0xac, 0xc2, 0xcc, 0x13, 0xf6, 0xbf, 0x25, 0x16, 0x80, 0x0d, 0x96, 0x29, 0x8b, 0x9c, 0xdd, 0x5f, - 0x62, 0x01, 0x08, 0x75, 0xa9, 0x01, 0xf9, 0xb3, 0x60, 0x47, 0x58, 0x97, 0x10, 0x83, 0xea, 0x26, - 0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, 0xe3, 0x55, 0xb7, 0xfa, 0xff, 0xff, 0x19, 0x00, 0x00, 0xff, 0xff, - 0x42, 0x1d, 0x62, 0x84, 0xc3, 0x0e, 0x00, 0x00, + // 1396 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0x96, 0x1d, 0x3b, 0x8e, 0xc7, 0x89, 0x93, 0x4c, 0xfa, 0x33, 0x4d, 0x4b, 0x49, 0x4d, 0xd3, + 0xa6, 0xd0, 0xd8, 0xd4, 0x54, 0x02, 0x09, 0x24, 0xd4, 0x12, 0x84, 0x7a, 0x51, 0xb5, 0xda, 0xc2, + 0x0d, 0x12, 0x8a, 0xc6, 0xbb, 0x63, 0x7b, 0x94, 0x9d, 0xdd, 0x65, 0x67, 0xd6, 0x6d, 0x78, 0x05, + 0x5e, 0x80, 0x3b, 0x6e, 0x78, 0x0b, 0x5e, 0x0e, 0x9d, 0x39, 0xb3, 0xeb, 0x59, 0xf7, 0x87, 0x96, + 0x88, 0x2b, 0xef, 0xf9, 0xce, 0x37, 0xdf, 0xcc, 0xf9, 0x99, 0x1f, 0x93, 0x5e, 0xaa, 0x47, 0xa9, + 0x1e, 0x66, 0x79, 0x6a, 0x52, 0xda, 0x4c, 0xf5, 0xfe, 0xf5, 0x59, 0x9a, 0xce, 0x62, 0x31, 0xb2, + 0xc8, 0xa4, 0x98, 0x8e, 0x84, 0xca, 0xcc, 0x39, 0x12, 0xf6, 0xf7, 0xc2, 0x54, 0xa9, 0x34, 0x19, + 0xe1, 0x0f, 0x82, 0x83, 0x09, 0xd9, 0xfd, 0x2e, 0x4d, 0x0c, 0x97, 0x89, 0xc8, 0x75, 0x20, 0x7e, + 0x2d, 0x84, 0x36, 0xf4, 0x06, 0xe9, 0x26, 0x5c, 0x09, 0x9d, 0xf1, 0x50, 0xb0, 0xc6, 0x41, 0xe3, +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x9a, 0xed, 0xa1, 0xb7, 0x02, 0xa0, 0x06, + 0x8a, 0x67, 0x99, 0x88, 0xd8, 0x25, 0xac, 0x01, 0x5a, 0xf6, 0x36, 0x9a, 0x2b, 0xa1, 0xd8, 0x65, + 0x9c, 0xc9, 0x1a, 0xb0, 0x5d, 0x74, 0xcc, 0x27, 0xec, 0x8a, 0x05, 0xed, 0x37, 0x64, 0x4b, 0xe7, + 0x22, 0x8c, 0xb9, 0x54, 0x36, 0x15, 0x57, 0x31, 0x5b, 0x3e, 0x66, 0x3b, 0xa1, 0x48, 0x1c, 0xc2, + 0x98, 0xeb, 0x84, 0x0a, 0x81, 0x6c, 0x9e, 0x89, 0x3c, 0x11, 0xb1, 0x36, 0x10, 0xc3, 0x35, 0xcc, + 0xa6, 0x07, 0x81, 0x02, 0x2c, 0xd8, 0xa6, 0x56, 0xb3, 0x7d, 0x54, 0x58, 0x22, 0xa0, 0x90, 0x4c, + 0x75, 0x91, 0x68, 0xac, 0xc7, 0x75, 0x54, 0xf0, 0x20, 0x88, 0x74, 0x92, 0x16, 0x49, 0x28, 0xd8, + 0x0d, 0x8c, 0x14, 0x2d, 0x58, 0x7f, 0x95, 0x2c, 0xa3, 0x32, 0xf6, 0x11, 0xae, 0xdf, 0xc7, 0x40, + 0x1d, 0xb6, 0xbb, 0x34, 0xb1, 0x54, 0xd2, 0xb0, 0x9b, 0xa8, 0xee, 0x41, 0x4b, 0x86, 0x11, 0x11, + 0xd7, 0xec, 0x63, 0x9f, 0x61, 0x21, 0x98, 0x67, 0xa1, 0x78, 0x1c, 0xa7, 0x21, 0x16, 0xfe, 0x00, + 0xe7, 0xf1, 0x31, 0x50, 0x71, 0x76, 0xa1, 0x45, 0xc4, 0x6e, 0xa1, 0x8a, 0x07, 0x79, 0x2a, 0xe1, + 0xbc, 0x48, 0xce, 0xd8, 0xa0, 0xa6, 0x62, 0x31, 0x7a, 0x9f, 0xec, 0xce, 0x79, 0x1e, 0xbd, 0xe4, + 0xb9, 0x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0, 0x33, 0x7a, 0x65, 0x88, 0x7f, 0xc6, 0x86, 0xe5, + 0x9f, 0xb1, 0xe1, 0xf7, 0xf0, 0x67, 0x6c, 0x7f, 0xb7, 0xbc, 0xfb, 0x4e, 0xe0, 0xbe, 0x73, 0x63, + 0xd6, 0xdd, 0x5b, 0xf1, 0x6d, 0x83, 0x76, 0x6a, 0x77, 0x18, 0x8c, 0xf9, 0x92, 0x74, 0xab, 0x97, + 0xfd, 0x5b, 0x87, 0x51, 0xef, 0x7d, 0xbd, 0xfc, 0x03, 0xd0, 0x71, 0x4f, 0x2c, 0x4a, 0x6b, 0xef, + 0x2d, 0x0c, 0x6a, 0xa7, 0x86, 0xc1, 0x80, 0x7b, 0xa4, 0x6d, 0x9f, 0x23, 0x74, 0xc7, 0x7b, 0x99, + 0x20, 0xb9, 0xef, 0x21, 0x59, 0x7c, 0xfe, 0xf8, 0x1b, 0xf8, 0xdf, 0xa3, 0x00, 0xe4, 0x99, 0x7c, + 0xdc, 0x7e, 0xa6, 0x1f, 0x65, 0xf2, 0x79, 0xe3, 0xe7, 0xc3, 0x99, 0x34, 0xf3, 0x62, 0x02, 0x81, + 0x8f, 0x0c, 0x8f, 0x53, 0x7d, 0xac, 0xcf, 0xb5, 0x11, 0x4a, 0xa3, 0x35, 0xe2, 0x99, 0x1c, 0xa5, + 0x7a, 0xb2, 0x6e, 0x57, 0xff, 0xc5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x2c, 0xaa, 0xad, + 0xd7, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/os/os.proto b/api/os/os.proto index 7421570b8..bd5dca3d0 100644 --- a/api/os/os.proto +++ b/api/os/os.proto @@ -44,7 +44,7 @@ message Container { // The response message containing the requested containers. message ContainerResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated Container containers = 2; } @@ -60,7 +60,7 @@ message ProcessesReply { } message ProcessResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated Process processes = 2; } @@ -87,7 +87,7 @@ message RestartRequest { } message RestartResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; } // The response message containing the restart status. @@ -106,7 +106,7 @@ message StatsRequest { // The response message containing the requested stats. message StatsResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; repeated Stat stats = 2; } @@ -126,7 +126,7 @@ message Stat { message MemInfoResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; MemInfo meminfo = 2; } diff --git a/api/time/time.pb.go b/api/time/time.pb.go index 991450b24..b99adb3c7 100644 --- a/api/time/time.pb.go +++ b/api/time/time.pb.go @@ -118,13 +118,13 @@ func (m *TimeReply) GetResponse() []*TimeResponse { } type TimeResponse struct { - Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Server string `protobuf:"bytes,2,opt,name=server,proto3" json:"server,omitempty"` - Localtime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=localtime,proto3" json:"localtime,omitempty"` - Remotetime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=remotetime,proto3" json:"remotetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Metadata *common.ResponseMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Server string `protobuf:"bytes,2,opt,name=server,proto3" json:"server,omitempty"` + Localtime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=localtime,proto3" json:"localtime,omitempty"` + Remotetime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=remotetime,proto3" json:"remotetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *TimeResponse) Reset() { *m = TimeResponse{} } @@ -156,7 +156,7 @@ func (m *TimeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_TimeResponse proto.InternalMessageInfo -func (m *TimeResponse) GetMetadata() *common.NodeMetadata { +func (m *TimeResponse) GetMetadata() *common.ResponseMetadata { if m != nil { return m.Metadata } @@ -193,28 +193,28 @@ func init() { func init() { proto.RegisterFile("time/time.proto", fileDescriptor_e7ed1ef5b20ef4ce) } var fileDescriptor_e7ed1ef5b20ef4ce = []byte{ - // 332 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4e, 0x32, 0x31, - 0x14, 0x85, 0x33, 0x3f, 0x84, 0x1f, 0x2e, 0x24, 0xc4, 0x6a, 0x08, 0x19, 0x17, 0x12, 0x12, 0x23, - 0x1b, 0xa7, 0x06, 0x37, 0x46, 0x57, 0x62, 0x5c, 0x6a, 0xcc, 0xc4, 0x95, 0xbb, 0x32, 0x5c, 0xa1, - 0x71, 0xca, 0xad, 0xd3, 0x62, 0xc2, 0x4b, 0xfa, 0x4c, 0xa6, 0xed, 0x88, 0x8d, 0x2c, 0xdc, 0x4c, - 0xa7, 0xf7, 0x9c, 0x33, 0x3d, 0xf9, 0xa6, 0xd0, 0xb7, 0x52, 0x21, 0x77, 0x8f, 0x4c, 0x57, 0x64, - 0x89, 0x35, 0xdd, 0x7b, 0x7a, 0xbc, 0x24, 0x5a, 0x96, 0xc8, 0xfd, 0x6c, 0xbe, 0x79, 0xe5, 0xa8, - 0xb4, 0xdd, 0x06, 0x4b, 0x7a, 0xf2, 0x5b, 0x74, 0x11, 0x63, 0x85, 0xd2, 0xb5, 0xe1, 0xb0, 0x20, - 0xa5, 0x68, 0xcd, 0xc3, 0x12, 0x86, 0xe3, 0x53, 0xe8, 0x3e, 0x4b, 0x85, 0x39, 0xbe, 0x6f, 0xd0, - 0x58, 0x36, 0x80, 0x96, 0xc1, 0xea, 0x03, 0xab, 0x61, 0x32, 0x4a, 0x26, 0x9d, 0xbc, 0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, 0xa7, 0x62, 0x03, 0x24, 0x55, 0x02, 0x00, 0x00, + // 331 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0x4b, 0xfb, 0x30, + 0x18, 0xc6, 0xe9, 0x7f, 0x63, 0xff, 0xed, 0xdd, 0x60, 0x18, 0x61, 0x94, 0x7a, 0x70, 0x0c, 0xc4, + 0x5d, 0x4c, 0x60, 0x7a, 0x10, 0x3d, 0x39, 0xf1, 0x28, 0x48, 0xf1, 0xe4, 0x2d, 0xab, 0xaf, 0x5b, + 0xb0, 0x59, 0x62, 0x93, 0x0a, 0xfd, 0x9a, 0x7e, 0x22, 0x49, 0xd2, 0xcd, 0xe0, 0x0e, 0x5e, 0x9a, + 0xe6, 0x7d, 0x7e, 0x4f, 0xfb, 0xf0, 0x24, 0x30, 0xb6, 0x42, 0x22, 0x73, 0x0f, 0xaa, 0x2b, 0x65, + 0x15, 0xe9, 0xba, 0xf7, 0xec, 0x64, 0xad, 0xd4, 0xba, 0x44, 0xe6, 0x67, 0xab, 0xfa, 0x8d, 0xa1, + 0xd4, 0xb6, 0x09, 0x48, 0x76, 0xfa, 0x5b, 0x74, 0x16, 0x63, 0xb9, 0xd4, 0x2d, 0x70, 0x5c, 0x28, + 0x29, 0xd5, 0x96, 0x85, 0x25, 0x0c, 0x67, 0x67, 0x30, 0x7c, 0x16, 0x12, 0x73, 0xfc, 0xa8, 0xd1, + 0x58, 0x32, 0x81, 0x9e, 0xc1, 0xea, 0x13, 0xab, 0x34, 0x99, 0x26, 0xf3, 0x41, 0xde, 0xee, 0x66, + 0xb7, 0x30, 0x08, 0x98, 0x2e, 0x1b, 0x42, 0xa1, 0x5f, 0xa1, 0xd1, 0x6a, 0x6b, 0x30, 0x4d, 0xa6, + 0x9d, 0xf9, 0x70, 0x41, 0xa8, 0xcf, 0x1a, 0x90, 0xa0, 0xe4, 0x7b, 0x66, 0xf6, 0x95, 0xc0, 0x28, + 0x96, 0xc8, 0x15, 0xf4, 0x25, 0x5a, 0xfe, 0xca, 0x2d, 0xf7, 0xff, 0x19, 0x2e, 0x52, 0xda, 0xa6, + 0xda, 0x31, 0x8f, 0xad, 0x9e, 0xef, 0xc9, 0x28, 0xdb, 0xbf, 0x38, 0x1b, 0xb9, 0x86, 0x41, 0xa9, + 0x0a, 0x5e, 0xba, 0x08, 0x69, 0xc7, 0x7f, 0x2e, 0xa3, 0xa1, 0x0c, 0xba, 0x2b, 0xc3, 0x47, 0xf3, + 0x65, 0xe4, 0x3f, 0x30, 0xb9, 0x01, 0xa8, 0x50, 0x2a, 0x8b, 0xde, 0xda, 0xfd, 0xd3, 0x1a, 0xd1, + 0x8b, 0x0d, 0x74, 0x9d, 0x40, 0x58, 0xbb, 0x4e, 0x0e, 0x7c, 0x0f, 0xee, 0x70, 0xb2, 0x71, 0x5c, + 0x8d, 0x6b, 0x8f, 0x85, 0x2a, 0xef, 0x37, 0x58, 0xbc, 0x93, 0xa3, 0x58, 0xf5, 0x47, 0x70, 0x60, + 0x58, 0x2e, 0x61, 0x54, 0x28, 0x19, 0xa6, 0x5c, 0x8b, 0xe5, 0x7f, 0x27, 0xdd, 0x69, 0xf1, 0x94, + 0xbc, 0x9c, 0xaf, 0x85, 0xdd, 0xd4, 0x2b, 0x57, 0x1e, 0xb3, 0xbc, 0x54, 0xe6, 0xc2, 0x34, 0xc6, + 0xa2, 0x34, 0x61, 0xc7, 0xb8, 0x16, 0xfe, 0x1a, 0xac, 0x7a, 0x3e, 0xd5, 0xe5, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x2f, 0x43, 0x34, 0x6f, 0x59, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/time/time.proto b/api/time/time.proto index 7a0e0238c..f5f77d93d 100644 --- a/api/time/time.proto +++ b/api/time/time.proto @@ -26,7 +26,7 @@ message TimeReply { } message TimeResponse { - common.NodeMetadata metadata = 1; + common.ResponseMetadata metadata = 1; string server = 2; google.protobuf.Timestamp localtime = 3; google.protobuf.Timestamp remotetime = 4; diff --git a/cmd/osctl/cmd/cluster/pkg/node/node.go b/cmd/osctl/cmd/cluster/pkg/node/node.go index d66250c72..05fb61665 100644 --- a/cmd/osctl/cmd/cluster/pkg/node/node.go +++ b/cmd/osctl/cmd/cluster/pkg/node/node.go @@ -86,8 +86,8 @@ func NewNode(clusterName string, req *Request) (err error) { switch req.Type { case generate.TypeInit: - var osdPort nat.Port - osdPort, err = nat.NewPort("tcp", "50000") + var apidPort nat.Port + apidPort, err = nat.NewPort("tcp", "50000") if err != nil { return err @@ -101,12 +101,12 @@ func NewNode(clusterName string, req *Request) (err error) { } containerConfig.ExposedPorts = nat.PortSet{ - osdPort: struct{}{}, + apidPort: struct{}{}, apiServerPort: struct{}{}, } hostConfig.PortBindings = nat.PortMap{ - osdPort: []nat.PortBinding{ + apidPort: []nat.PortBinding{ { HostIP: "0.0.0.0", HostPort: "50000", diff --git a/cmd/osctl/cmd/dmesg.go b/cmd/osctl/cmd/dmesg.go index dd5f7b690..ad4d491e0 100644 --- a/cmd/osctl/cmd/dmesg.go +++ b/cmd/osctl/cmd/dmesg.go @@ -38,7 +38,7 @@ var dmesgCmd = &cobra.Command{ if len(reply.Response) > 1 { fmt.Println(resp.Metadata.Hostname) } - _, err = os.Stdout.Write(resp.Bytes.Bytes) + _, err = os.Stdout.Write(resp.Bytes) helpers.Should(err) } }) diff --git a/cmd/osctl/cmd/root.go b/cmd/osctl/cmd/root.go index b075a96af..060b89d9d 100644 --- a/cmd/osctl/cmd/root.go +++ b/cmd/osctl/cmd/root.go @@ -119,7 +119,7 @@ func setupClient(action func(*client.Client)) { helpers.Fatalf("error getting client credentials: %s", err) } - c, err := client.NewClient(creds, t, constants.OsdPort) + c, err := client.NewClient(creds, t, constants.ApidPort) if err != nil { helpers.Fatalf("error constructing client: %s", err) } diff --git a/cmd/osctl/pkg/client/client.go b/cmd/osctl/pkg/client/client.go index 5e2e18f88..abc940f45 100644 --- a/cmd/osctl/pkg/client/client.go +++ b/cmd/osctl/pkg/client/client.go @@ -373,7 +373,7 @@ func (c *Client) Read(ctx context.Context, path string) (io.Reader, <-chan error } type machineStream interface { - Recv() (*machineapi.StreamingData, error) + Recv() (*common.DataResponse, error) grpc.ClientStream } @@ -404,8 +404,8 @@ func readStream(stream machineStream) (io.Reader, <-chan error, error) { } } - if data.Errors != "" { - errCh <- errors.New(data.Errors) + if data.Metadata != nil && data.Metadata.Error != "" { + errCh <- errors.New(data.Metadata.Error) } } }() diff --git a/go.mod b/go.mod index ca9d3dd7b..4e9a4a29e 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/gizak/termui/v3 v3.0.0 github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.1.0 // indirect + github.com/gogo/protobuf v1.3.1 github.com/golang/protobuf v1.3.2 github.com/google/uuid v1.1.1 github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 @@ -53,10 +54,12 @@ require ( github.com/spf13/cobra v0.0.5 github.com/stretchr/testify v1.4.0 github.com/syndtr/gocapability v0.0.0-20180223013746-33e07d32887e + github.com/talos-systems/grpc-proxy v0.0.0-20191129165806-5c579a7a6147 github.com/u-root/u-root v6.0.0+incompatible // indirect github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728 go.etcd.io/etcd v3.3.13+incompatible golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a + golang.org/x/net v0.0.0-20191116160921-f9c825593386 // indirect golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e golang.org/x/sys v0.0.0-20191110163157-d32e6e3b99c4 golang.org/x/text v0.3.2 diff --git a/go.sum b/go.sum index b70fb0a73..afffb1c06 100644 --- a/go.sum +++ b/go.sum @@ -394,6 +394,10 @@ github.com/syndtr/gocapability v0.0.0-20180223013746-33e07d32887e h1:QjF5rxNgRSL github.com/syndtr/gocapability v0.0.0-20180223013746-33e07d32887e/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/talos-systems/bootkube v0.14.1-0.20191127182503-08e42a4c200c h1:By7EcuWOTMwvsmymyiWsi+RfK2pVbYEA6Kuk3Ma/K6g= github.com/talos-systems/bootkube v0.14.1-0.20191127182503-08e42a4c200c/go.mod h1:CIpoNLW4Lm9zNVFRgqQIylnbZi/x9TnulTEA8edC0O4= +github.com/talos-systems/grpc-proxy v0.0.0-20191127172027-6c9f7b399173 h1:ZxCT4CuPSQPHkK0pFDg820AhozcaMXmDinuXc/E5HSo= +github.com/talos-systems/grpc-proxy v0.0.0-20191127172027-6c9f7b399173/go.mod h1:sm97Vc/z2cok3pu6ruNeszQej4KDxFrDgfWs4C1mtC4= +github.com/talos-systems/grpc-proxy v0.0.0-20191129165806-5c579a7a6147 h1:Sf4q46/8IkNY+JaYoBV0peSYsO5quJlvvmv2AytJlLI= +github.com/talos-systems/grpc-proxy v0.0.0-20191129165806-5c579a7a6147/go.mod h1:sm97Vc/z2cok3pu6ruNeszQej4KDxFrDgfWs4C1mtC4= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/u-root/u-root v6.0.0+incompatible h1:YqPGmRoRyYmeg17KIWFRSyVq6LX5T6GSzawyA6wG6EE= @@ -480,6 +484,8 @@ golang.org/x/net v0.0.0-20191007182048-72f939374954 h1:JGZucVF/L/TotR719NbujzadO golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191109021931-daa7c04131f5 h1:bHNaocaoJxYBo5cw41UyTMLjYlb8wPY7+WFrnklbHOM= golang.org/x/net v0.0.0-20191109021931-daa7c04131f5/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191116160921-f9c825593386 h1:ktbWvQrW08Txdxno1PiDpSxPXG6ndGsfnJjRRtkM0LQ= +golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/internal/app/apid/main.go b/internal/app/apid/main.go index 1c9de09d5..bc5e687d8 100644 --- a/internal/app/apid/main.go +++ b/internal/app/apid/main.go @@ -9,12 +9,15 @@ import ( "log" stdlibnet "net" "os" + "regexp" "strings" + "github.com/talos-systems/grpc-proxy/proxy" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - "github.com/talos-systems/talos/api" + "github.com/talos-systems/talos/internal/app/apid/pkg/backend" + "github.com/talos-systems/talos/internal/app/apid/pkg/director" "github.com/talos-systems/talos/pkg/config" "github.com/talos-systems/talos/pkg/constants" "github.com/talos-systems/talos/pkg/grpc/factory" @@ -61,43 +64,57 @@ func main() { log.Fatalf("failed to create OS-level TLS configuration: %v", err) } - machineClient, err := api.NewLocalMachineClient() + // TODO: refactor + certs, err := provider.GetCertificate(nil) if err != nil { - log.Fatalf("machine client: %v", err) + log.Fatalf("failed to get TLS certs: %v", err) } - osClient, err := api.NewLocalOSClient() + clientTLSConfig, err := tls.New( + tls.WithClientAuthType(tls.Mutual), + tls.WithCACertPEM(ca), + tls.WithKeypair(*certs), // TODO: this doesn't support cert refresh, fix me! + ) if err != nil { - log.Fatalf("networkd client: %v", err) + log.Fatalf("failed to create client TLS config: %v", err) } - timeClient, err := api.NewLocalTimeClient() - if err != nil { - log.Fatalf("time client: %v", err) + backendFactory := backend.NewAPIDFactory(clientTLSConfig) + router := director.NewRouter(backendFactory.Get) + + router.RegisterLocalBackend("os.OS", backend.NewLocal("osd", constants.OSSocketPath)) + router.RegisterLocalBackend("machine.Machine", backend.NewLocal("machined", constants.MachineSocketPath)) + router.RegisterLocalBackend("time.Time", backend.NewLocal("timed", constants.TimeSocketPath)) + router.RegisterLocalBackend("network.Network", backend.NewLocal("networkd", constants.NetworkSocketPath)) + + // all existing streaming methods + for _, methodName := range []string{ + "/machine.Machine/CopyOut", + "/machine.Machine/Kubeconfig", + "/machine.Machine/LS", + "/machine.Machine/Logs", + "/machine.Machine/Read", + } { + router.RegisterStreamedRegex("^" + regexp.QuoteMeta(methodName) + "$") } - networkClient, err := api.NewLocalNetworkClient() - if err != nil { - log.Fatalf("time client: %v", err) - } - - protoProxy := api.NewApiProxy(provider) + // register future pattern: method should have suffix "Stream" + router.RegisterStreamedRegex("Stream$") err = factory.ListenAndServe( - &api.Registrator{ - MachineClient: machineClient, - OSClient: osClient, - TimeClient: timeClient, - NetworkClient: networkClient, - }, - factory.Port(constants.OsdPort), - factory.WithStreamInterceptor(protoProxy.StreamInterceptor()), - factory.WithUnaryInterceptor(protoProxy.UnaryInterceptor()), + router, + factory.Port(constants.ApidPort), factory.WithDefaultLog(), factory.ServerOptions( grpc.Creds( credentials.NewTLS(tlsConfig), ), + grpc.CustomCodec(proxy.Codec()), + grpc.UnknownServiceHandler( + proxy.TransparentHandler( + router.Director, + proxy.WithStreamedDetector(router.StreamedDetector), + )), ), ) if err != nil { diff --git a/internal/app/apid/pkg/backend/apid.go b/internal/app/apid/pkg/backend/apid.go new file mode 100644 index 000000000..da5d81b9e --- /dev/null +++ b/internal/app/apid/pkg/backend/apid.go @@ -0,0 +1,213 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend + +import ( + "context" + "fmt" + "strings" + "sync" + + "github.com/gogo/protobuf/proto" + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/metadata" + + "github.com/talos-systems/talos/api/common" + "github.com/talos-systems/talos/pkg/constants" +) + +// APID backend performs proxying to another apid instance. +// +// Backend authenticates itself using given grpc credentials. +type APID struct { + target string + creds credentials.TransportCredentials + + mu sync.Mutex + conn *grpc.ClientConn +} + +// NewAPID creates new instance of APID backend +func NewAPID(target string, creds credentials.TransportCredentials) (*APID, error) { + // perform very basic validation on target + if target == "" || strings.Contains(target, ":") { + return nil, fmt.Errorf("invalid target %q", target) + } + + return &APID{ + target: target, + creds: creds, + }, nil +} + +func (a *APID) String() string { + return a.target +} + +// GetConnection returns a grpc connection to the backend. +func (a *APID) GetConnection(ctx context.Context) (context.Context, *grpc.ClientConn, error) { + origMd, ok := metadata.FromIncomingContext(ctx) + + md := origMd.Copy() + delete(md, "targets") + delete(md, ":authority") + + if ok { + md.Set("proxyfrom", origMd[":authority"]...) + } else { + md.Set("proxyfrom", "unknown") + } + + outCtx := metadata.NewOutgoingContext(ctx, md) + + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn != nil { + return outCtx, a.conn, nil + } + + var err error + a.conn, err = grpc.DialContext( + ctx, + fmt.Sprintf("%s:%d", a.target, constants.ApidPort), + grpc.WithTransportCredentials(a.creds), + grpc.WithCodec(proxy.Codec()), //nolint: staticcheck + ) + + return outCtx, a.conn, err +} + +// AppendInfo is called to enhance response from the backend with additional data. +// +// AppendInfo enhances upstream response with node metadata (target). +// +// This method depends on grpc protobuf response structure, each response should +// look like: +// +// message SomeReply { +// repeated SomeResponse response = 1; // please note field ID == 1 +// } +// +// message SomeResponse { +// common.ResponseMetadata metadata = 1; +// +// } +// +// As 'SomeResponse' is repeated in 'SomeReply', if we concatenate protobuf representation +// of several 'SomeReply' messages, we still get valid 'SomeReply' representation but with more +// entries (feature of protobuf binary representation). +// +// If we look at binary representation of any 'SomeReply' message, it will always contain one +// protobuf field with field ID 1 (see above) and type 2 (embedded message SomeResponse is encoded +// as string with length). So if we want to add fields to 'SomeResponse', we can simply read field +// header, adjust length for new 'SomeResponse' representation, and prepend new field header. +// +// At the same time, we can add 'common.ResponseMetadata' structure to 'SomeResponse' by simply +// appending or prepending 'common.ResponseMetadata' as a single field. This requires 'metadata' +// field to be not defined in original response. (This is due to the fact that protobuf message +// representation is concatenation of each field representation). +// +// To build only single field (ResponseMetadata) we use helper message which contains exactly this +// field with same field ID as in every other 'Response': +// +// message EmptyResponse { +// common.ResponseMetadata metadata = 1; +// } +// +// As streaming responses are not wrapped into 'SomeReply' with 'repeated', handling is simpler: we just +// need to append EmptyResponse with details. +// +// So AppendInfo does the following: validates that reply contains field ID 1 encoded as string, +// cuts field header, rest is representation of some 'Response'. Marshal 'EmptyResponse' as protobuf, +// which builds 'common.ResponseMetadata' field, append it to original 'Response' message, build new header +// for new length of some 'Response', and add back new field header. +func (a *APID) AppendInfo(streaming bool, resp []byte) ([]byte, error) { + payload, err := proto.Marshal(&common.EmptyResponse{ + Metadata: &common.ResponseMetadata{ + Hostname: a.target, + }, + }) + + if streaming { + return append(resp, payload...), err + } + + const ( + metadataField = 1 // field number in proto definition for repeated response + metadataType = 2 // "string" for embedded messages + ) + + // decode protobuf embedded header + typ, n1 := proto.DecodeVarint(resp) + _, n2 := proto.DecodeVarint(resp[n1:]) // length + + if typ != (metadataField<<3)|metadataType { + return nil, fmt.Errorf("unexpected message format: %d", typ) + } + + if n1+n2 > len(resp) { + return nil, fmt.Errorf("unexpected message size: %d", len(resp)) + } + + // cut off embedded message header + resp = resp[n1+n2:] + // build new embedded message header + prefix := append(proto.EncodeVarint((metadataField<<3)|metadataType), proto.EncodeVarint(uint64(len(resp)+len(payload)))...) + resp = append(prefix, resp...) + + return append(resp, payload...), err +} + +// BuildError is called to convert error from upstream into response field. +// +// BuildError converts upstream error into message from upstream, so that multiple +// successful and failure responses might be returned. +// +// This simply relies on the fact that any response contains 'EmptyReply' message. +// So if 'EmptyReply' is unmarshalled into any other 'Reply' message, all the fields +// are undefined but 'ResponseMetadata': +// +// message EmptyResponse { +// common.ResponseMetadata metadata = 1; +// } +// +// message EmptyReply { +// repeated EmptyResponse response = 1; +// } +// +// Streaming responses are not wrapped into EmptyReply, so we simply marshall EmptyResponse +// message. +func (a *APID) BuildError(streaming bool, err error) ([]byte, error) { + var resp proto.Message = &common.EmptyResponse{ + Metadata: &common.ResponseMetadata{ + Hostname: a.target, + Error: err.Error(), + }, + } + + if !streaming { + resp = &common.EmptyReply{ + Response: []*common.EmptyResponse{ + resp.(*common.EmptyResponse), + }, + } + } + + return proto.Marshal(resp) +} + +// Close connection. +func (a *APID) Close() { + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn != nil { + a.conn.Close() //nolint: errcheck + a.conn = nil + } +} diff --git a/internal/app/apid/pkg/backend/apid_factory.go b/internal/app/apid/pkg/backend/apid_factory.go new file mode 100644 index 000000000..549798652 --- /dev/null +++ b/internal/app/apid/pkg/backend/apid_factory.go @@ -0,0 +1,55 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend + +import ( + "crypto/tls" + "sync" + + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc/credentials" +) + +// APIDFactory caches connection to apid instances by target. +// +// TODO: need to clean up idle connections from time to time. +type APIDFactory struct { + cache sync.Map + creds credentials.TransportCredentials +} + +// NewAPIDFactory creates new APIDFactory with given tls.Config. +// +// Client TLS config is used to connect to other apid instances. +func NewAPIDFactory(config *tls.Config) *APIDFactory { + return &APIDFactory{ + creds: credentials.NewTLS(config), + } +} + +// Get backend by target. +// +// Get performs caching of backends. +func (factory *APIDFactory) Get(target string) (proxy.Backend, error) { + b, ok := factory.cache.Load(target) + if ok { + return b.(proxy.Backend), nil + } + + backend, err := NewAPID(target, factory.creds) + if err != nil { + return nil, err + } + + existing, loaded := factory.cache.LoadOrStore(target, backend) + if loaded { + // race: another Get() call built different backend + backend.Close() + + return existing.(proxy.Backend), nil + } + + return backend, nil +} diff --git a/internal/app/apid/pkg/backend/apid_factory_test.go b/internal/app/apid/pkg/backend/apid_factory_test.go new file mode 100644 index 000000000..fe354cf7d --- /dev/null +++ b/internal/app/apid/pkg/backend/apid_factory_test.go @@ -0,0 +1,74 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend_test + +import ( + "crypto/tls" + "sync" + "testing" + + "github.com/stretchr/testify/suite" + "github.com/talos-systems/grpc-proxy/proxy" + + "github.com/talos-systems/talos/internal/app/apid/pkg/backend" +) + +type APIDFactorySuite struct { + suite.Suite + + f *backend.APIDFactory +} + +func (suite *APIDFactorySuite) SetupSuite() { + suite.f = backend.NewAPIDFactory(&tls.Config{}) +} + +func (suite *APIDFactorySuite) TestGet() { + b1, err := suite.f.Get("127.0.0.1") + suite.Require().NoError(err) + suite.Require().NotNil(b1) + + b2, err := suite.f.Get("127.0.0.1") + suite.Require().NoError(err) + suite.Require().Equal(b1, b2) + + b3, err := suite.f.Get("127.0.0.2") + suite.Require().NoError(err) + suite.Require().NotEqual(b1, b3) + + _, err = suite.f.Get("127.0.0.2:50000") + suite.Require().Error(err) +} + +func (suite *APIDFactorySuite) TestGetConcurrent() { + // for race detector + var wg sync.WaitGroup + + backendCh := make(chan proxy.Backend, 10) + + for i := 0; i < 10; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + b, _ := suite.f.Get("10.0.0.1") //nolint: errcheck + backendCh <- b + }() + } + + wg.Wait() + close(backendCh) + + b := <-backendCh + + for anotherB := range backendCh { + suite.Assert().Equal(b, anotherB) + } +} + +func TestAPIDFactorySuite(t *testing.T) { + suite.Run(t, new(APIDFactorySuite)) +} diff --git a/internal/app/apid/pkg/backend/apid_test.go b/internal/app/apid/pkg/backend/apid_test.go new file mode 100644 index 000000000..4b4b5217c --- /dev/null +++ b/internal/app/apid/pkg/backend/apid_test.go @@ -0,0 +1,162 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend_test + +import ( + "context" + "crypto/tls" + "errors" + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/metadata" + + "github.com/talos-systems/talos/api/common" + "github.com/talos-systems/talos/internal/app/apid/pkg/backend" +) + +func TestAPIDInterfaces(t *testing.T) { + assert.Implements(t, (*proxy.Backend)(nil), new(backend.APID)) +} + +type APIDSuite struct { + suite.Suite + + b *backend.APID +} + +func (suite *APIDSuite) SetupSuite() { + var err error + suite.b, err = backend.NewAPID("127.0.0.1", credentials.NewTLS(&tls.Config{})) + suite.Require().NoError(err) +} + +func (suite *APIDSuite) TestGetConnection() { + md := metadata.New(nil) + md.Set(":authority", "127.0.0.2") + md.Set("targets", "127.0.0.1") + md.Set("key", "value1", "value2") + ctx := metadata.NewIncomingContext(context.Background(), md) + + outCtx1, conn1, err1 := suite.b.GetConnection(ctx) + suite.Require().NoError(err1) + suite.Assert().NotNil(conn1) + + mdOut1, ok1 := metadata.FromOutgoingContext(outCtx1) + suite.Require().True(ok1) + suite.Assert().Equal([]string{"value1", "value2"}, mdOut1.Get("key")) + suite.Assert().Equal([]string{"127.0.0.2"}, mdOut1.Get("proxyfrom")) + + outCtx2, conn2, err2 := suite.b.GetConnection(ctx) + suite.Require().NoError(err2) + suite.Assert().Equal(conn1, conn2) // connection is cached + + mdOut2, ok2 := metadata.FromOutgoingContext(outCtx2) + suite.Require().True(ok2) + suite.Assert().Equal([]string{"value1", "value2"}, mdOut2.Get("key")) + suite.Assert().Equal([]string{"127.0.0.2"}, mdOut2.Get("proxyfrom")) +} + +func (suite *APIDSuite) TestAppendInfoUnary() { + reply := &common.DataReply{ + Response: []*common.DataResponse{ + { + Bytes: []byte("foobar"), + }, + }, + } + + resp, err := proto.Marshal(reply) + suite.Require().NoError(err) + + newResp, err := suite.b.AppendInfo(false, resp) + suite.Require().NoError(err) + + var newReply common.DataReply + err = proto.Unmarshal(newResp, &newReply) + suite.Require().NoError(err) + + suite.Assert().EqualValues([]byte("foobar"), newReply.Response[0].Bytes) + suite.Assert().Equal(suite.b.String(), newReply.Response[0].Metadata.Hostname) + suite.Assert().Empty(newReply.Response[0].Metadata.Error) +} + +func (suite *APIDSuite) TestAppendInfoStreaming() { + response := &common.DataResponse{ + Bytes: []byte("foobar"), + } + + resp, err := proto.Marshal(response) + suite.Require().NoError(err) + + newResp, err := suite.b.AppendInfo(true, resp) + suite.Require().NoError(err) + + var newResponse common.DataResponse + err = proto.Unmarshal(newResp, &newResponse) + suite.Require().NoError(err) + + suite.Assert().EqualValues([]byte("foobar"), newResponse.Bytes) + suite.Assert().Equal(suite.b.String(), newResponse.Metadata.Hostname) + suite.Assert().Empty(newResponse.Metadata.Error) +} + +func (suite *APIDSuite) TestAppendInfoStreamingMetadata() { + // this tests the case when metadata field is appended twice + // to the message, but protobuf merges definitions + response := &common.DataResponse{ + Metadata: &common.ResponseMetadata{ + Error: "something went wrong", + }, + } + + resp, err := proto.Marshal(response) + suite.Require().NoError(err) + + newResp, err := suite.b.AppendInfo(true, resp) + suite.Require().NoError(err) + + var newResponse common.DataResponse + err = proto.Unmarshal(newResp, &newResponse) + suite.Require().NoError(err) + + suite.Assert().Nil(newResponse.Bytes) + suite.Assert().Equal(suite.b.String(), newResponse.Metadata.Hostname) + suite.Assert().Equal("something went wrong", newResponse.Metadata.Error) +} + +func (suite *APIDSuite) TestBuildErrorUnary() { + resp, err := suite.b.BuildError(false, errors.New("some error")) + suite.Require().NoError(err) + + var reply common.DataReply + err = proto.Unmarshal(resp, &reply) + suite.Require().NoError(err) + + suite.Assert().Nil(reply.Response[0].Bytes) + suite.Assert().Equal(suite.b.String(), reply.Response[0].Metadata.Hostname) + suite.Assert().Equal("some error", reply.Response[0].Metadata.Error) +} + +func (suite *APIDSuite) TestBuildErrorStreaming() { + resp, err := suite.b.BuildError(true, errors.New("some error")) + suite.Require().NoError(err) + + var response common.DataResponse + err = proto.Unmarshal(resp, &response) + suite.Require().NoError(err) + + suite.Assert().Nil(response.Bytes) + suite.Assert().Equal(suite.b.String(), response.Metadata.Hostname) + suite.Assert().Equal("some error", response.Metadata.Error) +} + +func TestAPIDSuite(t *testing.T) { + suite.Run(t, new(APIDSuite)) +} diff --git a/internal/app/apid/pkg/backend/backend.go b/internal/app/apid/pkg/backend/backend.go new file mode 100644 index 000000000..f9208cfb1 --- /dev/null +++ b/internal/app/apid/pkg/backend/backend.go @@ -0,0 +1,6 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package backend implements backends satisfying proxy.Backend interface +package backend diff --git a/internal/app/apid/pkg/backend/local.go b/internal/app/apid/pkg/backend/local.go new file mode 100644 index 000000000..56d71cef3 --- /dev/null +++ b/internal/app/apid/pkg/backend/local.go @@ -0,0 +1,72 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend + +import ( + "context" + "sync" + + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// Local implements local backend (proxying one2one to local service) +type Local struct { + name string + socketPath string + + mu sync.Mutex + conn *grpc.ClientConn +} + +// NewLocal builds new Local backend +func NewLocal(name, socketPath string) *Local { + return &Local{ + name: name, + socketPath: socketPath, + } +} + +func (l *Local) String() string { + return l.name +} + +// GetConnection returns a grpc connection to the backend. +func (l *Local) GetConnection(ctx context.Context) (context.Context, *grpc.ClientConn, error) { + l.mu.Lock() + defer l.mu.Unlock() + + // copy metadata + outCtx := ctx + if md, ok := metadata.FromIncomingContext(ctx); ok { + outCtx = metadata.NewOutgoingContext(ctx, md) + } + + if l.conn != nil { + return outCtx, l.conn, nil + } + + var err error + l.conn, err = grpc.DialContext( + ctx, + "unix:"+l.socketPath, + grpc.WithInsecure(), + grpc.WithCodec(proxy.Codec()), //nolint: staticcheck + + ) + + return outCtx, l.conn, err +} + +// AppendInfo is called to enhance response from the backend with additional data. +func (l *Local) AppendInfo(streaming bool, resp []byte) ([]byte, error) { + return resp, nil +} + +// BuildError is called to convert error from upstream into response field. +func (l *Local) BuildError(streaming bool, err error) ([]byte, error) { + return nil, nil +} diff --git a/internal/app/apid/pkg/backend/local_test.go b/internal/app/apid/pkg/backend/local_test.go new file mode 100644 index 000000000..a46ef3a5b --- /dev/null +++ b/internal/app/apid/pkg/backend/local_test.go @@ -0,0 +1,44 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package backend_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc/metadata" + + "github.com/talos-systems/talos/internal/app/apid/pkg/backend" +) + +func TestLocalInterfaces(t *testing.T) { + assert.Implements(t, (*proxy.Backend)(nil), new(backend.Local)) +} + +func TestLocalGetConnection(t *testing.T) { + l := backend.NewLocal("test", "/tmp/test.sock") + + md := metadata.New(nil) + md.Set("key", "value1", "value2") + ctx := metadata.NewIncomingContext(context.Background(), md) + + outCtx1, conn1, err1 := l.GetConnection(ctx) + assert.NoError(t, err1) + assert.NotNil(t, conn1) + + mdOut1, ok1 := metadata.FromOutgoingContext(outCtx1) + assert.True(t, ok1) + assert.Equal(t, []string{"value1", "value2"}, mdOut1.Get("key")) + + outCtx2, conn2, err2 := l.GetConnection(ctx) + assert.NoError(t, err2) + assert.Equal(t, conn1, conn2) // connection is cached + + mdOut2, ok2 := metadata.FromOutgoingContext(outCtx2) + assert.True(t, ok2) + assert.Equal(t, []string{"value1", "value2"}, mdOut2.Get("key")) +} diff --git a/internal/app/apid/pkg/director/director.go b/internal/app/apid/pkg/director/director.go new file mode 100644 index 000000000..f75223413 --- /dev/null +++ b/internal/app/apid/pkg/director/director.go @@ -0,0 +1,122 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package director provides proxy call routing facility +package director + +import ( + "context" + "fmt" + "regexp" + "strings" + + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Router wraps grpc-proxy StreamDirector +type Router struct { + localBackends map[string]proxy.Backend + remoteBackendFactory RemoteBackendFactory + streamedMatchers []*regexp.Regexp +} + +// RemoteBackendFactory provides backend generation by address (target) +type RemoteBackendFactory func(target string) (proxy.Backend, error) + +// NewRouter builds new Router +func NewRouter(backendFactory RemoteBackendFactory) *Router { + return &Router{ + localBackends: map[string]proxy.Backend{}, + remoteBackendFactory: backendFactory, + } +} + +// Register is no-op to implement factory.Registrator interface. +// +// Actual proxy handler is installed via grpc.UnknownServiceHandler option. +func (r *Router) Register(srv *grpc.Server) { +} + +// Director implements proxy.StreamDirector function +func (r *Router) Director(ctx context.Context, fullMethodName string) (proxy.Mode, []proxy.Backend, error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return r.localDirector(fullMethodName) + } + + if _, exists := md["proxyfrom"]; exists { + return r.localDirector(fullMethodName) + } + + var targets []string + + if targets, ok = md["targets"]; !ok { + // send directly to local node, skips another layer of proxying + return r.localDirector(fullMethodName) + } + + return r.aggregateDirector(targets) +} + +// localDirector sends requests down to local service in one2one mode. +// +// Local backends are registered via RegisterLocalBackend +func (r *Router) localDirector(fullMethodName string) (proxy.Mode, []proxy.Backend, error) { + parts := strings.SplitN(fullMethodName, "/", 3) + serviceName := parts[1] + + if backend, ok := r.localBackends[serviceName]; ok { + return proxy.One2One, []proxy.Backend{backend}, nil + } + + return proxy.One2One, nil, status.Errorf(codes.Unknown, "service %v is not defined", serviceName) +} + +// aggregateDirector sends request across set of remote instances and aggregates results. +func (r *Router) aggregateDirector(targets []string) (proxy.Mode, []proxy.Backend, error) { + var err error + + backends := make([]proxy.Backend, len(targets)) + + for i, target := range targets { + backends[i], err = r.remoteBackendFactory(target) + if err != nil { + return proxy.One2Many, nil, status.Error(codes.Internal, err.Error()) + } + } + + return proxy.One2Many, backends, nil +} + +// RegisterLocalBackend registers local backend by service name. +func (r *Router) RegisterLocalBackend(serviceName string, backend proxy.Backend) { + if _, exists := r.localBackends[serviceName]; exists { + panic(fmt.Sprintf("local backend %v already registered", serviceName)) + } + + r.localBackends[serviceName] = backend +} + +// StreamedDetector implements proxy.StreamedDetector. +func (r *Router) StreamedDetector(fullMethodName string) bool { + for _, re := range r.streamedMatchers { + if re.MatchString(fullMethodName) { + return true + } + } + + return false +} + +// RegisterStreamedRegex register regex for streamed method. +// +// This could be exact literal match: /^\/serviceName\/methodName$/ or any +// suffix/prefix match. +func (r *Router) RegisterStreamedRegex(regex string) { + r.streamedMatchers = append(r.streamedMatchers, regexp.MustCompile(regex)) +} diff --git a/internal/app/apid/pkg/director/director_test.go b/internal/app/apid/pkg/director/director_test.go new file mode 100644 index 000000000..1d0855bff --- /dev/null +++ b/internal/app/apid/pkg/director/director_test.go @@ -0,0 +1,105 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package director_test + +import ( + "context" + "regexp" + "testing" + + "github.com/stretchr/testify/suite" + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc/metadata" + + "github.com/talos-systems/talos/internal/app/apid/pkg/director" +) + +type DirectorSuite struct { + suite.Suite + + router *director.Router +} + +func (suite *DirectorSuite) SetupSuite() { + suite.router = director.NewRouter(mockBackendFactory) +} + +func (suite *DirectorSuite) TestRegisterLocalBackend() { + suite.router.RegisterLocalBackend("a.A", &mockBackend{}) + suite.router.RegisterLocalBackend("b.B", &mockBackend{}) + + suite.Require().Panics(func() { suite.router.RegisterLocalBackend("a.A", &mockBackend{}) }) +} + +func (suite *DirectorSuite) TestStreamedDetector() { + suite.Assert().False(suite.router.StreamedDetector("/service.Service/someMethod")) + + suite.router.RegisterStreamedRegex("^" + regexp.QuoteMeta("/service.Service/someMethod") + "$") + + suite.Assert().True(suite.router.StreamedDetector("/service.Service/someMethod")) + suite.Assert().False(suite.router.StreamedDetector("/service.Service/someMethod2")) + suite.Assert().False(suite.router.StreamedDetector("/servicexService/someMethod")) + + suite.router.RegisterStreamedRegex("Stream$") + + suite.Assert().True(suite.router.StreamedDetector("/service.Service/getStream")) + suite.Assert().False(suite.router.StreamedDetector("/service.Service/getStreamItem")) +} + +func (suite *DirectorSuite) TestDirectorLocal() { + ctx := context.Background() + + mode, backends, err := suite.router.Director(ctx, "/service.Service/method") + suite.Assert().Equal(proxy.One2One, mode) + suite.Assert().Nil(backends) + suite.Assert().EqualError(err, "rpc error: code = Unknown desc = service service.Service is not defined") + + suite.router.RegisterLocalBackend("service.Service", &mockBackend{target: "local"}) + + mode, backends, err = suite.router.Director(ctx, "/service.Service/method") + suite.Assert().Equal(proxy.One2One, mode) + suite.Assert().Len(backends, 1) + suite.Assert().Equal("local", backends[0].(*mockBackend).target) + suite.Assert().NoError(err) + + ctxProxyFrom := metadata.NewIncomingContext(ctx, metadata.Pairs("proxyfrom", "127.0.0.1")) + mode, backends, err = suite.router.Director(ctxProxyFrom, "/service.Service/method") + suite.Assert().Equal(proxy.One2One, mode) + suite.Assert().Len(backends, 1) + suite.Assert().Equal("local", backends[0].(*mockBackend).target) + suite.Assert().NoError(err) + + ctxNoTargets := metadata.NewIncomingContext(ctx, metadata.Pairs(":authority", "127.0.0.1")) + mode, backends, err = suite.router.Director(ctxNoTargets, "/service.Service/method") + suite.Assert().Equal(proxy.One2One, mode) + suite.Assert().Len(backends, 1) + suite.Assert().Equal("local", backends[0].(*mockBackend).target) + suite.Assert().NoError(err) +} + +func (suite *DirectorSuite) TestDirectorAggregate() { + ctx := context.Background() + + md := metadata.New(nil) + md.Set("targets", "127.0.0.1", "127.0.0.2") + mode, backends, err := suite.router.Director(metadata.NewIncomingContext(ctx, md), "/service.Service/method") + suite.Assert().Equal(proxy.One2Many, mode) + suite.Assert().Len(backends, 2) + suite.Assert().Equal("127.0.0.1", backends[0].(*mockBackend).target) + suite.Assert().Equal("127.0.0.2", backends[1].(*mockBackend).target) + suite.Assert().NoError(err) + + md = metadata.New(nil) + md.Set("targets", "127.0.0.1") + mode, backends, err = suite.router.Director(metadata.NewIncomingContext(ctx, md), "/service.Service/method") + suite.Assert().Equal(proxy.One2Many, mode) + suite.Assert().Len(backends, 1) + suite.Assert().Equal("127.0.0.1", backends[0].(*mockBackend).target) + suite.Assert().NoError(err) +} + +func TestDirectorSuite(t *testing.T) { + suite.Run(t, new(DirectorSuite)) +} diff --git a/internal/app/apid/pkg/director/mocks_test.go b/internal/app/apid/pkg/director/mocks_test.go new file mode 100644 index 000000000..4126636b3 --- /dev/null +++ b/internal/app/apid/pkg/director/mocks_test.go @@ -0,0 +1,36 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package director_test + +import ( + "context" + + "github.com/talos-systems/grpc-proxy/proxy" + "google.golang.org/grpc" +) + +type mockBackend struct { + target string +} + +func (m *mockBackend) String() string { + return m.target +} + +func (m *mockBackend) GetConnection(ctx context.Context) (context.Context, *grpc.ClientConn, error) { + return ctx, nil, nil +} + +func (m *mockBackend) AppendInfo(streaming bool, resp []byte) ([]byte, error) { + return resp, nil +} + +func (m *mockBackend) BuildError(streaming bool, err error) ([]byte, error) { + return nil, nil +} + +func mockBackendFactory(target string) (proxy.Backend, error) { + return &mockBackend{target: target}, nil +} diff --git a/internal/app/machined/internal/api/reg/reg.go b/internal/app/machined/internal/api/reg/reg.go index 419500ca6..7c4a509f2 100644 --- a/internal/app/machined/internal/api/reg/reg.go +++ b/internal/app/machined/internal/api/reg/reg.go @@ -259,7 +259,7 @@ func (r *Registrator) CopyOut(req *machineapi.CopyOutRequest, s machineapi.Machi chunkCh := chunker.Read(ctx) for data := range chunkCh { - err := s.SendMsg(&machineapi.StreamingData{Bytes: data}) + err := s.SendMsg(&common.DataResponse{Bytes: data}) if err != nil { ctxCancel() } @@ -267,7 +267,11 @@ func (r *Registrator) CopyOut(req *machineapi.CopyOutRequest, s machineapi.Machi archiveErr := <-errCh if archiveErr != nil { - return s.SendMsg(&machineapi.StreamingData{Errors: archiveErr.Error()}) + return s.SendMsg(&common.DataResponse{ + Metadata: &common.ResponseMetadata{ + Error: archiveErr.Error(), + }, + }) } return nil @@ -460,7 +464,7 @@ func (r *Registrator) Logs(req *machineapi.LogsRequest, l machineapi.Machine_Log } for data := range chunk.Read(l.Context()) { - if err = l.Send(&common.Data{Bytes: data}); err != nil { + if err = l.Send(&common.DataResponse{Bytes: data}); err != nil { return } } @@ -531,7 +535,7 @@ func (r *Registrator) Read(in *machineapi.ReadRequest, srv machineapi.Machine_Re chunkCh := chunker.Read(ctx) for data := range chunkCh { - err := srv.SendMsg(&machineapi.StreamingData{Bytes: data}) + err := srv.SendMsg(&common.DataResponse{Bytes: data}) if err != nil { cancel() } diff --git a/internal/app/machined/pkg/system/services/apid.go b/internal/app/machined/pkg/system/services/apid.go index 7ffddae8c..5b170a6d2 100644 --- a/internal/app/machined/pkg/system/services/apid.go +++ b/internal/app/machined/pkg/system/services/apid.go @@ -146,7 +146,7 @@ func (o *APID) Runner(config runtime.Configurator) (runner.Runner, error) { func (o *APID) HealthFunc(runtime.Configurator) health.Check { return func(ctx context.Context) error { var d net.Dialer - conn, err := d.DialContext(ctx, "tcp", fmt.Sprintf("%s:%d", "127.0.0.1", constants.OsdPort)) + conn, err := d.DialContext(ctx, "tcp", fmt.Sprintf("%s:%d", "127.0.0.1", constants.ApidPort)) if err != nil { return err } diff --git a/internal/app/osd/internal/reg/reg.go b/internal/app/osd/internal/reg/reg.go index 517ee2e9e..77f662fc4 100644 --- a/internal/app/osd/internal/reg/reg.go +++ b/internal/app/osd/internal/reg/reg.go @@ -181,7 +181,7 @@ func (r *Registrator) Dmesg(ctx context.Context, in *empty.Empty) (data *common. data = &common.DataReply{ Response: []*common.DataResponse{ { - Bytes: &common.Data{Bytes: buf[:n]}, + Bytes: buf[:n], }, }, } diff --git a/internal/integration/base/api.go b/internal/integration/base/api.go index 6a52d2861..5584c0e70 100644 --- a/internal/integration/base/api.go +++ b/internal/integration/base/api.go @@ -30,7 +30,7 @@ func (apiSuite *APISuite) SetupSuite() { target = apiSuite.Target } - apiSuite.Client, err = client.NewClient(creds, target, constants.OsdPort) + apiSuite.Client, err = client.NewClient(creds, target, constants.ApidPort) apiSuite.Require().NoError(err) } diff --git a/internal/pkg/cri/client.go b/internal/pkg/cri/client.go index 6d2dc92da..9d15a8cc0 100644 --- a/internal/pkg/cri/client.go +++ b/internal/pkg/cri/client.go @@ -33,7 +33,7 @@ func NewClient(endpoint string, connectionTimeout time.Duration) (*Client, error grpc.WithInsecure(), grpc.WithBlock(), grpc.FailOnNonTempDialError(false), - grpc.WithBackoffMaxDelay(3*time.Second), + grpc.WithBackoffMaxDelay(3*time.Second), //nolint: staticcheck grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize))) if err != nil { return nil, fmt.Errorf("error connecting to CRI: %w", err) diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 2bd1509bb..8e9d4f351 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -179,8 +179,8 @@ const ( // EncryptionConfigRootfsPath is the path to the EncryptionConfig relative to rootfs. EncryptionConfigRootfsPath = "/etc/kubernetes/encryptionconfig.yaml" - // OsdPort is the port for the osd service. - OsdPort = 50000 + // ApidPort is the port for the apid service. + ApidPort = 50000 // TrustdPort is the port for the trustd service. TrustdPort = 50001