diff --git a/.drone.yml b/.drone.yml index 4c6becb5f..fe73333b1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -48,6 +48,24 @@ steps: depends_on: - fetch-tags +- name: apid + pull: always + image: autonomy/build-container:latest + commands: + - make apid + environment: + BINDIR: /usr/local/bin + BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234} + volumes: + - name: dockersock + path: /var/run + - name: dev + path: /dev + - name: tmp + path: /tmp + depends_on: + - fetch-tags + - name: trustd pull: always image: autonomy/build-container:latest @@ -159,6 +177,7 @@ steps: - trustd - ntpd - networkd + - apid - name: initramfs pull: always @@ -465,6 +484,24 @@ steps: depends_on: - fetch-tags +- name: apid + pull: always + image: autonomy/build-container:latest + commands: + - make apid + environment: + BINDIR: /usr/local/bin + BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234} + volumes: + - name: dockersock + path: /var/run + - name: dev + path: /dev + - name: tmp + path: /tmp + depends_on: + - fetch-tags + - name: trustd pull: always image: autonomy/build-container:latest @@ -576,6 +613,7 @@ steps: - trustd - ntpd - networkd + - apid - name: initramfs pull: always @@ -1095,6 +1133,24 @@ steps: depends_on: - fetch-tags +- name: apid + pull: always + image: autonomy/build-container:latest + commands: + - make apid + environment: + BINDIR: /usr/local/bin + BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234} + volumes: + - name: dockersock + path: /var/run + - name: dev + path: /dev + - name: tmp + path: /tmp + depends_on: + - fetch-tags + - name: trustd pull: always image: autonomy/build-container:latest @@ -1206,6 +1262,7 @@ steps: - trustd - ntpd - networkd + - apid - name: initramfs pull: always @@ -1728,6 +1785,24 @@ steps: depends_on: - fetch-tags +- name: apid + pull: always + image: autonomy/build-container:latest + commands: + - make apid + environment: + BINDIR: /usr/local/bin + BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234} + volumes: + - name: dockersock + path: /var/run + - name: dev + path: /dev + - name: tmp + path: /tmp + depends_on: + - fetch-tags + - name: trustd pull: always image: autonomy/build-container:latest @@ -1839,6 +1914,7 @@ steps: - trustd - ntpd - networkd + - apid - name: initramfs pull: always @@ -2361,6 +2437,24 @@ steps: depends_on: - fetch-tags +- name: apid + pull: always + image: autonomy/build-container:latest + commands: + - make apid + environment: + BINDIR: /usr/local/bin + BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234} + volumes: + - name: dockersock + path: /var/run + - name: dev + path: /dev + - name: tmp + path: /tmp + depends_on: + - fetch-tags + - name: trustd pull: always image: autonomy/build-container:latest @@ -2472,6 +2566,7 @@ steps: - trustd - ntpd - networkd + - apid - name: initramfs pull: always diff --git a/Dockerfile b/Dockerfile index dd8765c86..e86251269 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,13 +18,13 @@ 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:ec650af /protoc-gen-proxy /toolchain/bin/protoc-gen-proxy # The build target creates a container that will be used to build Talos source # code. FROM scratch AS build COPY --from=tools / / -COPY --from=autonomy/protoc-gen-proxy:a87401e /protoc-gen-proxy /toolchain/bin/protoc-gen-proxy SHELL ["/toolchain/bin/bash", "-c"] ENV PATH /toolchain/bin:/toolchain/go/bin ENV GO111MODULE on @@ -35,13 +35,11 @@ WORKDIR /src # The generate target generates code from protobuf service definitions. FROM build AS generate-build +# Common needs to be at or near the top to satisfy the subsequent imports COPY ./api/common/common.proto /api/common/common.proto RUN protoc -I/api --go_out=plugins=grpc:/api/common /api/common/common.proto -#RUN protoc -I/api --plugin=proxy --proxy_out=plugins=grpc+proxy:proto api/api.proto COPY ./api/os/os.proto /api/os/os.proto -# TODO: switch up os proxy generation with apid -#RUN protoc -I/api --go_out=plugins=grpc:/api/os /api/os/os.proto -RUN protoc -I/api --plugin=proxy --proxy_out=plugins=grpc+proxy:/api/os /api/os/os.proto +RUN protoc -I/api --go_out=plugins=grpc:/api/os /api/os/os.proto COPY ./api/security/security.proto /api/security/security.proto RUN protoc -I/api --go_out=plugins=grpc:/api/security /api/security/security.proto COPY ./api/machine/machine.proto /api/machine/machine.proto @@ -50,9 +48,13 @@ 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 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/ @@ -114,6 +116,20 @@ FROM scratch AS ntpd COPY --from=ntpd-build /ntpd /ntpd ENTRYPOINT ["/ntpd"] +# The apid target builds the api image. + +FROM base AS apid-build +ARG SHA +ARG TAG +ARG VERSION_PKG="github.com/talos-systems/talos/pkg/version" +WORKDIR /src/internal/app/apid +RUN --mount=type=cache,target=/.cache/go-build go build -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /apid +RUN chmod +x /apid + +FROM scratch AS apid +COPY --from=apid-build /apid /apid +ENTRYPOINT ["/apid"] + # The osd target builds the osd image. FROM base AS osd-build @@ -208,6 +224,7 @@ COPY --from=docker.io/autonomy/util-linux:dad1273 /lib/libuuid.* /rootfs/lib COPY --from=docker.io/autonomy/kmod:dad1273 /lib/libkmod.* /rootfs/lib COPY --from=docker.io/autonomy/kernel:dad1273 /lib/modules /rootfs/lib/modules COPY --from=machined /machined /rootfs/sbin/init +COPY images/apid.tar /rootfs/usr/images/ COPY images/ntpd.tar /rootfs/usr/images/ COPY images/osd.tar /rootfs/usr/images/ COPY images/trustd.tar /rootfs/usr/images/ diff --git a/Makefile b/Makefile index 0682d0ba8..e99d21de6 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ initramfs: buildkitd $(COMMON_ARGS) .PHONY: rootfs -rootfs: buildkitd osd trustd ntpd networkd +rootfs: buildkitd osd trustd ntpd networkd apid @$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \ build \ --opt target=$@ \ @@ -318,6 +318,14 @@ osd: buildkitd images --opt target=$@ \ $(COMMON_ARGS) +.PHONY: apid +apid: buildkitd images + @$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \ + build \ + --output type=docker,dest=images/$@.tar,name=docker.io/autonomy/$@:$(TAG) \ + --opt target=$@ \ + $(COMMON_ARGS) + .PHONY: trustd trustd: buildkitd images @$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \ diff --git a/api/api.pb.go b/api/api.pb.go new file mode 100644 index 000000000..3ff6abf57 --- /dev/null +++ b/api/api.pb.go @@ -0,0 +1,1026 @@ +// 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" + os "github.com/talos-systems/talos/api/os" + 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 +var _ = fmt.Errorf +var _ = 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 + +// Data from public import os/os.proto +type Data = os.Data + +// DataResponse from public import os/os.proto +type DataResponse = os.DataResponse + +// DataReply from public import os/os.proto +type DataReply = os.DataReply + +// LogsRequest from public import os/os.proto +type LogsRequest = os.LogsRequest + +// 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 + +// ContainerDriver from public import os/os.proto +type ContainerDriver = os.ContainerDriver + +var ContainerDriver_name = os.ContainerDriver_name +var ContainerDriver_value = os.ContainerDriver_value + +const ContainerDriver_CONTAINERD = ContainerDriver(os.ContainerDriver_CONTAINERD) +const ContainerDriver_CRI = ContainerDriver(os.ContainerDriver_CRI) + +// 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 + +// NodeMetadata from public import common/common.proto +type NodeMetadata = common.NodeMetadata + +// Empty from public import google/protobuf/empty.proto +type Empty = empty.Empty + +func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } + +var fileDescriptor_00212fb1f9d3bf1c = []byte{ + // 140 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x2c, 0x8b, 0xb1, 0x0a, 0xc2, 0x30, + 0x14, 0x45, 0xd5, 0x82, 0xa0, 0x6e, 0x8a, 0x4b, 0xdd, 0xc4, 0xd5, 0xbe, 0xc1, 0x3f, 0xf0, 0x0b, + 0x32, 0xbb, 0xa5, 0x21, 0xa6, 0x81, 0xbe, 0xde, 0x87, 0xef, 0x75, 0xe8, 0xdf, 0x0b, 0x4d, 0xa6, + 0xc3, 0x39, 0x97, 0x7b, 0x3c, 0x78, 0xc9, 0x9d, 0xfc, 0x60, 0x38, 0x37, 0x5e, 0x72, 0x7b, 0x82, + 0x12, 0xb4, 0x94, 0xf6, 0xca, 0x3e, 0x0c, 0x79, 0x8a, 0x54, 0x59, 0xf3, 0x25, 0x80, 0x19, 0x13, + 0x15, 0xd4, 0x78, 0x4b, 0x40, 0x1a, 0x23, 0xad, 0xd6, 0xcf, 0x5f, 0x8a, 0x2c, 0xb6, 0x94, 0xf1, + 0xfd, 0xf8, 0xdc, 0x53, 0xb6, 0x61, 0xee, 0xbb, 0x00, 0x26, 0xf3, 0x23, 0xf4, 0xa9, 0x8b, 0x5a, + 0x64, 0x2d, 0x46, 0x5e, 0xb2, 0xdb, 0xb8, 0xad, 0xdb, 0xb9, 0xa6, 0xdf, 0xaf, 0xa7, 0xd7, 0x3f, + 0x00, 0x00, 0xff, 0xff, 0x96, 0x64, 0x43, 0x69, 0x9c, 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.Proxy(ctx, info.FullMethod, credentials.NewTLS(tlsConfig), req) + } +} + +func (p *ApiProxy) Proxy(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 := &os.DataReply{} + msgs, err = proxyOSRunner(clients, in, proxyDmesg) + for _, msg := range msgs { + resp.Response = append(resp.Response, msg.(*os.DataReply).Response[0]) + } + response = resp + case "/os.OS/Kubeconfig": + // Initialize target clients + clients, err := createOSClient(targets, creds, proxyMd) + if err != nil { + break + } + resp := &os.DataReply{} + msgs, err = proxyOSRunner(clients, in, proxyKubeconfig) + for _, msg := range msgs { + resp.Response = append(resp.Response, msg.(*os.DataReply).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/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/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/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/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/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 + + } + + 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 +} + +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 proxyKubeconfig(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { + defer wg.Done() + resp, err := client.Conn.Kubeconfig(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 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 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 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 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 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 +} + +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() +} + +type Registrator struct { + os.OSClient + machine.MachineClient +} + +func (r *Registrator) Register(s *grpc.Server) { + os.RegisterOSServer(s, r) + machine.RegisterMachineServer(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) (*os.DataReply, error) { + return r.OSClient.Dmesg(ctx, in) +} + +func (r *Registrator) Kubeconfig(ctx context.Context, in *empty.Empty) (*os.DataReply, error) { + return r.OSClient.Kubeconfig(ctx, in) +} + +func (r *Registrator) Logs(in *os.LogsRequest, srv os.OS_LogsServer) error { + client, err := r.OSClient.Logs(srv.Context(), in) + if err != nil { + return err + } + var msg os.Data + return copyClientServer(&msg, client, srv) +} + +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) Mounts(ctx context.Context, in *empty.Empty) (*machine.MountsReply, error) { + return r.MachineClient.Mounts(ctx, in) +} + +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) 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) 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) ServiceList(ctx context.Context, in *empty.Empty) (*machine.ServiceListReply, error) { + return r.MachineClient.ServiceList(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) ServiceRestart(ctx context.Context, in *machine.ServiceRestartRequest) (*machine.ServiceRestartReply, error) { + return r.MachineClient.ServiceRestart(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) +} + +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) (*os.DataReply, error) { + return c.OSClient.Dmesg(ctx, in, opts...) +} + +func (c *LocalOSClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*os.DataReply, error) { + return c.OSClient.Kubeconfig(ctx, in, opts...) +} + +func (c *LocalOSClient) Logs(ctx context.Context, in *os.LogsRequest, opts ...grpc.CallOption) (os.OS_LogsClient, error) { + return c.OSClient.Logs(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) Mounts(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.MountsReply, error) { + return c.MachineClient.Mounts(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) 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) 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) ServiceList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*machine.ServiceListReply, error) { + return c.MachineClient.ServiceList(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) ServiceRestart(ctx context.Context, in *machine.ServiceRestartRequest, opts ...grpc.CallOption) (*machine.ServiceRestartReply, error) { + return c.MachineClient.ServiceRestart(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...) +} diff --git a/api/api.proto b/api/api.proto new file mode 100644 index 000000000..52ceb56d0 --- /dev/null +++ b/api/api.proto @@ -0,0 +1,10 @@ +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 "common/common.proto"; +import public "google/protobuf/empty.proto"; diff --git a/api/machine/machine.pb.go b/api/machine/machine.pb.go index 082331a26..1c4b7c105 100644 --- a/api/machine/machine.pb.go +++ b/api/machine/machine.pb.go @@ -1962,137 +1962,136 @@ func (m *VersionInfo) GetArch() string { } func init() { - proto.RegisterType((*RebootResponse)(nil), "machineapi.RebootResponse") - proto.RegisterType((*RebootReply)(nil), "machineapi.RebootReply") - proto.RegisterType((*ResetResponse)(nil), "machineapi.ResetResponse") - proto.RegisterType((*ResetReply)(nil), "machineapi.ResetReply") - proto.RegisterType((*ShutdownResponse)(nil), "machineapi.ShutdownResponse") - proto.RegisterType((*ShutdownReply)(nil), "machineapi.ShutdownReply") - proto.RegisterType((*UpgradeRequest)(nil), "machineapi.UpgradeRequest") - proto.RegisterType((*UpgradeResponse)(nil), "machineapi.UpgradeResponse") - proto.RegisterType((*UpgradeReply)(nil), "machineapi.UpgradeReply") - proto.RegisterType((*ServiceListResponse)(nil), "machineapi.ServiceListResponse") - proto.RegisterType((*ServiceListReply)(nil), "machineapi.ServiceListReply") - proto.RegisterType((*ServiceInfo)(nil), "machineapi.ServiceInfo") - proto.RegisterType((*ServiceEvents)(nil), "machineapi.ServiceEvents") - proto.RegisterType((*ServiceEvent)(nil), "machineapi.ServiceEvent") - proto.RegisterType((*ServiceHealth)(nil), "machineapi.ServiceHealth") - proto.RegisterType((*ServiceStartRequest)(nil), "machineapi.ServiceStartRequest") - proto.RegisterType((*ServiceStartResponse)(nil), "machineapi.ServiceStartResponse") - proto.RegisterType((*ServiceStartReply)(nil), "machineapi.ServiceStartReply") - proto.RegisterType((*ServiceStopRequest)(nil), "machineapi.ServiceStopRequest") - proto.RegisterType((*ServiceStopResponse)(nil), "machineapi.ServiceStopResponse") - proto.RegisterType((*ServiceStopReply)(nil), "machineapi.ServiceStopReply") - proto.RegisterType((*ServiceRestartRequest)(nil), "machineapi.ServiceRestartRequest") - proto.RegisterType((*ServiceRestartResponse)(nil), "machineapi.ServiceRestartResponse") - proto.RegisterType((*ServiceRestartReply)(nil), "machineapi.ServiceRestartReply") - proto.RegisterType((*StartRequest)(nil), "machineapi.StartRequest") - proto.RegisterType((*StartReply)(nil), "machineapi.StartReply") - proto.RegisterType((*StopRequest)(nil), "machineapi.StopRequest") - proto.RegisterType((*StopReply)(nil), "machineapi.StopReply") - proto.RegisterType((*StreamingData)(nil), "machineapi.StreamingData") - proto.RegisterType((*CopyOutRequest)(nil), "machineapi.CopyOutRequest") - proto.RegisterType((*LSRequest)(nil), "machineapi.LSRequest") - proto.RegisterType((*FileInfo)(nil), "machineapi.FileInfo") - proto.RegisterType((*MountsResponse)(nil), "machineapi.MountsResponse") - proto.RegisterType((*MountsReply)(nil), "machineapi.MountsReply") - proto.RegisterType((*MountStat)(nil), "machineapi.MountStat") - proto.RegisterType((*VersionResponse)(nil), "machineapi.VersionResponse") - proto.RegisterType((*VersionReply)(nil), "machineapi.VersionReply") - proto.RegisterType((*VersionInfo)(nil), "machineapi.VersionInfo") + proto.RegisterType((*RebootResponse)(nil), "machine.RebootResponse") + proto.RegisterType((*RebootReply)(nil), "machine.RebootReply") + proto.RegisterType((*ResetResponse)(nil), "machine.ResetResponse") + proto.RegisterType((*ResetReply)(nil), "machine.ResetReply") + proto.RegisterType((*ShutdownResponse)(nil), "machine.ShutdownResponse") + proto.RegisterType((*ShutdownReply)(nil), "machine.ShutdownReply") + proto.RegisterType((*UpgradeRequest)(nil), "machine.UpgradeRequest") + proto.RegisterType((*UpgradeResponse)(nil), "machine.UpgradeResponse") + proto.RegisterType((*UpgradeReply)(nil), "machine.UpgradeReply") + proto.RegisterType((*ServiceListResponse)(nil), "machine.ServiceListResponse") + proto.RegisterType((*ServiceListReply)(nil), "machine.ServiceListReply") + proto.RegisterType((*ServiceInfo)(nil), "machine.ServiceInfo") + proto.RegisterType((*ServiceEvents)(nil), "machine.ServiceEvents") + proto.RegisterType((*ServiceEvent)(nil), "machine.ServiceEvent") + proto.RegisterType((*ServiceHealth)(nil), "machine.ServiceHealth") + proto.RegisterType((*ServiceStartRequest)(nil), "machine.ServiceStartRequest") + proto.RegisterType((*ServiceStartResponse)(nil), "machine.ServiceStartResponse") + proto.RegisterType((*ServiceStartReply)(nil), "machine.ServiceStartReply") + proto.RegisterType((*ServiceStopRequest)(nil), "machine.ServiceStopRequest") + proto.RegisterType((*ServiceStopResponse)(nil), "machine.ServiceStopResponse") + proto.RegisterType((*ServiceStopReply)(nil), "machine.ServiceStopReply") + proto.RegisterType((*ServiceRestartRequest)(nil), "machine.ServiceRestartRequest") + proto.RegisterType((*ServiceRestartResponse)(nil), "machine.ServiceRestartResponse") + proto.RegisterType((*ServiceRestartReply)(nil), "machine.ServiceRestartReply") + proto.RegisterType((*StartRequest)(nil), "machine.StartRequest") + 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") + proto.RegisterType((*MountsResponse)(nil), "machine.MountsResponse") + proto.RegisterType((*MountsReply)(nil), "machine.MountsReply") + proto.RegisterType((*MountStat)(nil), "machine.MountStat") + proto.RegisterType((*VersionResponse)(nil), "machine.VersionResponse") + proto.RegisterType((*VersionReply)(nil), "machine.VersionReply") + proto.RegisterType((*VersionInfo)(nil), "machine.VersionInfo") } func init() { proto.RegisterFile("machine/machine.proto", fileDescriptor_84b4f59d98cc997c) } var fileDescriptor_84b4f59d98cc997c = []byte{ - // 1379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x6d, 0x6f, 0x13, 0xc7, - 0x13, 0x97, 0xed, 0x38, 0xb6, 0xc7, 0x89, 0xc3, 0x7f, 0x49, 0xc2, 0x61, 0x02, 0x81, 0x83, 0x7f, - 0x41, 0x54, 0x38, 0x3c, 0xa8, 0xa5, 0x2d, 0xa5, 0x15, 0x49, 0x68, 0x8b, 0x20, 0x40, 0xcf, 0xd0, - 0x17, 0x6d, 0x55, 0x6b, 0x6d, 0x6f, 0x7c, 0x2b, 0xee, 0x6e, 0xaf, 0xb7, 0xeb, 0x20, 0x57, 0xfd, - 0x00, 0x55, 0xbf, 0x41, 0x5f, 0xf3, 0x65, 0xfa, 0xb1, 0xaa, 0x7d, 0xb8, 0xf3, 0x9e, 0xed, 0x8b, - 0xa2, 0x84, 0x57, 0xde, 0x87, 0xb9, 0x99, 0xdf, 0x6f, 0x66, 0x76, 0x76, 0xd6, 0xb0, 0x11, 0xe2, - 0x81, 0x4f, 0x23, 0xb2, 0x63, 0x7e, 0x3b, 0x71, 0xc2, 0x04, 0x43, 0x60, 0xa6, 0x38, 0xa6, 0xed, - 0x4b, 0x23, 0xc6, 0x46, 0x01, 0xd9, 0x51, 0x3b, 0xfd, 0xf1, 0xe1, 0x0e, 0x09, 0x63, 0x31, 0xd1, - 0x82, 0xed, 0xed, 0xd9, 0x4d, 0x41, 0x43, 0xc2, 0x05, 0x0e, 0x63, 0x23, 0x70, 0x7e, 0xc0, 0xc2, - 0x90, 0x45, 0x3b, 0xfa, 0x47, 0x2f, 0xba, 0xbb, 0xd0, 0xf2, 0x48, 0x9f, 0x31, 0xe1, 0x11, 0x1e, - 0xb3, 0x88, 0x13, 0x74, 0x17, 0xea, 0x21, 0x11, 0x78, 0x88, 0x05, 0x76, 0x4a, 0x57, 0x4b, 0xb7, - 0x9a, 0xf7, 0xd7, 0x3b, 0xe6, 0x93, 0x97, 0x6c, 0x48, 0x0e, 0xcc, 0x9e, 0x97, 0x49, 0xb9, 0x4f, - 0xa1, 0x99, 0xea, 0x88, 0x83, 0x09, 0xfa, 0x1c, 0xea, 0x89, 0x51, 0xe6, 0x94, 0xae, 0x56, 0x6e, - 0x35, 0xef, 0xb7, 0x3b, 0x53, 0x12, 0x9d, 0xbc, 0x39, 0x2f, 0x93, 0x75, 0x9f, 0xc0, 0xaa, 0x47, - 0x38, 0x39, 0x0b, 0x92, 0x3d, 0x00, 0xa3, 0x42, 0x02, 0xf9, 0x6c, 0x0e, 0xc8, 0xc5, 0x3c, 0x10, - 0xcb, 0x98, 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0x60, 0x71, 0x11, 0xad, 0x5f, 0x2c, 0xf6, 0x52, 0xea, 0xa3, 0xb2, 0x9a, 0x1e, 0x4a, 0xad, 0xfc, - 0xe4, 0x87, 0xd2, 0x06, 0x63, 0x71, 0xba, 0x09, 0x1b, 0x46, 0xc0, 0x93, 0x91, 0x2c, 0x8e, 0xd6, - 0x6f, 0xb0, 0x39, 0x2b, 0xf8, 0x51, 0x99, 0xbd, 0xcd, 0xdc, 0x96, 0xe9, 0x97, 0xe4, 0xbe, 0x99, - 0x23, 0xe7, 0x2e, 0x20, 0x37, 0x03, 0xc9, 0xe2, 0xe7, 0xc2, 0xca, 0x71, 0x49, 0xf8, 0x55, 0xd9, - 0x29, 0xb9, 0x37, 0x00, 0xac, 0x1c, 0x49, 0xc1, 0x95, 0xa6, 0xe0, 0x94, 0xd4, 0x35, 0x68, 0x1e, - 0x13, 0x76, 0x25, 0x72, 0x1d, 0x1a, 0xd3, 0xb0, 0x14, 0xe9, 0x79, 0x0c, 0xab, 0x5d, 0x91, 0x10, - 0x1c, 0xd2, 0x68, 0xb4, 0x2f, 0xbd, 0xb1, 0x0e, 0xd5, 0xfe, 0x44, 0x10, 0xae, 0x24, 0x57, 0x3c, - 0x3d, 0x41, 0x9b, 0xb0, 0x4c, 0x92, 0x84, 0x25, 0xdc, 0x78, 0xc9, 0xcc, 0xdc, 0x3b, 0xd0, 0xda, - 0x63, 0xf1, 0xe4, 0xd5, 0x38, 0xa3, 0x74, 0x09, 0x1a, 0x09, 0x63, 0xa2, 0x17, 0x63, 0xe1, 0x1b, - 0x6b, 0x75, 0xb9, 0xf0, 0x1a, 0x0b, 0xdf, 0xed, 0x43, 0xe3, 0x45, 0x37, 0x95, 0x94, 0x90, 0x18, - 0x13, 0x19, 0x24, 0xc6, 0x84, 0x2c, 0x13, 0x09, 0x19, 0x8c, 0x13, 0x4e, 0xd2, 0x32, 0x61, 0xa6, - 0xe8, 0x26, 0xac, 0xe9, 0x21, 0x65, 0x51, 0x6f, 0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 0x15, 0xfe, 0xb8, 0x2f, 0xab, - 0xde, 0x8e, 0xc0, 0x01, 0xe3, 0x77, 0x74, 0xf9, 0xe5, 0x7a, 0xb6, 0x83, 0x63, 0x9a, 0xfe, 0x75, - 0xd1, 0x5f, 0x56, 0x66, 0x1f, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x31, 0xe8, 0x4c, 0xb0, 0xd4, - 0x10, 0x00, 0x00, + // 1371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xfd, 0x6e, 0x13, 0x47, + 0x10, 0x97, 0xed, 0xf8, 0x6b, 0x9c, 0x38, 0xb0, 0xf9, 0xa8, 0x31, 0xe1, 0xeb, 0xa0, 0x05, 0x21, + 0xc5, 0x41, 0x01, 0x2a, 0x0a, 0x6d, 0x05, 0x21, 0x20, 0xaa, 0x26, 0x01, 0x9d, 0x4b, 0xff, 0x68, + 0xab, 0x5a, 0x6b, 0x7b, 0x63, 0xaf, 0xb8, 0xbb, 0xbd, 0xde, 0xae, 0x83, 0x5c, 0xf5, 0x01, 0xaa, + 0xfe, 0xdb, 0x47, 0xe8, 0xcb, 0xf4, 0x35, 0xfa, 0x26, 0xd5, 0x7e, 0xdc, 0x7a, 0x7d, 0xce, 0x01, + 0x22, 0xfc, 0xe5, 0xdd, 0xd9, 0xd9, 0x99, 0xdf, 0x6f, 0x67, 0x76, 0x76, 0xce, 0xb0, 0x11, 0xe2, + 0xc1, 0x98, 0x46, 0x64, 0xc7, 0xfc, 0x76, 0xe2, 0x84, 0x09, 0x86, 0xaa, 0x66, 0xda, 0xbe, 0x38, + 0x62, 0x6c, 0x14, 0x90, 0x1d, 0x25, 0xee, 0x4f, 0x8e, 0x77, 0x48, 0x18, 0x8b, 0xa9, 0xd6, 0x6a, + 0x5f, 0xc9, 0x2e, 0x0a, 0x1a, 0x12, 0x2e, 0x70, 0x18, 0x1b, 0x85, 0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0x0e, 0xf5, + 0x59, 0x40, 0xf2, 0xec, 0x7c, 0x03, 0x2b, 0x5d, 0x91, 0x10, 0x1c, 0xd2, 0x68, 0xb4, 0x2f, 0x8f, + 0x62, 0x1d, 0xca, 0xfd, 0xa9, 0x20, 0x5c, 0x69, 0x2e, 0xfb, 0x7a, 0x82, 0x36, 0xa1, 0x42, 0x92, + 0x84, 0x25, 0xdc, 0x1c, 0x91, 0x99, 0x79, 0xdb, 0xd0, 0x7c, 0xca, 0xe2, 0xe9, 0xcb, 0x89, 0xa5, + 0x74, 0x11, 0xea, 0x09, 0x63, 0xa2, 0x17, 0x63, 0x31, 0x36, 0xde, 0x6a, 0x52, 0xf0, 0x0a, 0x8b, + 0xb1, 0xd7, 0x87, 0xfa, 0x41, 0x37, 0xd5, 0x94, 0x90, 0x18, 0x13, 0x16, 0x12, 0x63, 0x42, 0x56, + 0x87, 0x84, 0x0c, 0x26, 0x09, 0x27, 0x69, 0x75, 0x30, 0x53, 0x74, 0x13, 0x56, 0xf5, 0x90, 0xb2, + 0xa8, 0x37, 0x24, 0xb1, 0x18, 0xab, 0x02, 0x51, 0xf6, 0x9b, 0x56, 0xbc, 0x2f, 0xa5, 0xde, 0xbf, + 0x05, 0xa8, 0x3d, 0xa7, 0x81, 0xae, 0xe1, 0x08, 0x96, 0x22, 0x1c, 0xa6, 0xcf, 0xa9, 0x1a, 0x4b, + 0x19, 0xa7, 0xbf, 0x6b, 0x07, 0x25, 0x5f, 0x8d, 0xa5, 0x2c, 0x64, 0x43, 0x5d, 0x73, 0x56, 0x7c, + 0x35, 0x46, 0x6d, 0xa8, 0x85, 0x6c, 0x48, 0x8f, 0x29, 0x19, 0xaa, 0x4a, 0x53, 0xf2, 0xed, 0x1c, + 0x6d, 0x40, 0x85, 0xf2, 0xde, 0x90, 0x26, 0xad, 0xb2, 0x82, 0x59, 0xa6, 0x7c, 0x9f, 0x26, 0xf2, + 0xf0, 0xd4, 0xc1, 0xb4, 0x2a, 0xba, 0x94, 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45, 0x3e, 0x31, 0xe8, 0xe2, 0xe9, 0x8f, 0xbb, 0xb6, 0x73, 0xe1, 0xf4, 0x45, 0x69, + 0xe6, 0x08, 0x9a, 0xf3, 0x6f, 0x26, 0xba, 0x9c, 0xfb, 0x98, 0x6a, 0x63, 0x5b, 0xb9, 0xeb, 0xba, + 0xed, 0x28, 0x6b, 0x66, 0x4e, 0x53, 0xec, 0xee, 0x5e, 0xcb, 0x8a, 0xe3, 0x60, 0xea, 0x95, 0xfe, + 0x2c, 0x16, 0xd0, 0x7d, 0x58, 0x52, 0x4c, 0x9c, 0x4f, 0x0e, 0x87, 0x02, 0xca, 0x48, 0xed, 0xb6, + 0x07, 0x50, 0x4d, 0x2f, 0x56, 0x5e, 0x3c, 0x36, 0x16, 0x6f, 0x7f, 0x1c, 0x4c, 0xf7, 0xbe, 0x87, + 0xd5, 0x01, 0x0b, 0xed, 0x1a, 0x8e, 0xe9, 0x1e, 0x98, 0x3b, 0xf7, 0x24, 0xa6, 0xaf, 0x0a, 0x3f, + 0xdd, 0x1e, 0x51, 0x31, 0x9e, 0xf4, 0x65, 0xb5, 0xda, 0x11, 0x38, 0x60, 0x7c, 0x5b, 0x97, 0x4d, + 0xae, 0x67, 0x3b, 0x38, 0xa6, 0xe9, 0xbf, 0x08, 0xfd, 0x8a, 0xf2, 0x79, 0xf7, 0xff, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x16, 0x91, 0x56, 0x62, 0x5f, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2132,7 +2131,7 @@ func NewMachineClient(cc *grpc.ClientConn) MachineClient { } func (c *machineClient) CopyOut(ctx context.Context, in *CopyOutRequest, opts ...grpc.CallOption) (Machine_CopyOutClient, error) { - stream, err := c.cc.NewStream(ctx, &_Machine_serviceDesc.Streams[0], "/machineapi.Machine/CopyOut", opts...) + stream, err := c.cc.NewStream(ctx, &_Machine_serviceDesc.Streams[0], "/machine.Machine/CopyOut", opts...) if err != nil { return nil, err } @@ -2165,7 +2164,7 @@ func (x *machineCopyOutClient) Recv() (*StreamingData, error) { func (c *machineClient) Mounts(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*MountsReply, error) { out := new(MountsReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Mounts", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Mounts", in, out, opts...) if err != nil { return nil, err } @@ -2173,7 +2172,7 @@ func (c *machineClient) Mounts(ctx context.Context, in *empty.Empty, opts ...grp } func (c *machineClient) LS(ctx context.Context, in *LSRequest, opts ...grpc.CallOption) (Machine_LSClient, error) { - stream, err := c.cc.NewStream(ctx, &_Machine_serviceDesc.Streams[1], "/machineapi.Machine/LS", opts...) + stream, err := c.cc.NewStream(ctx, &_Machine_serviceDesc.Streams[1], "/machine.Machine/LS", opts...) if err != nil { return nil, err } @@ -2206,7 +2205,7 @@ func (x *machineLSClient) Recv() (*FileInfo, error) { func (c *machineClient) Reboot(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*RebootReply, error) { out := new(RebootReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Reboot", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Reboot", in, out, opts...) if err != nil { return nil, err } @@ -2215,7 +2214,7 @@ func (c *machineClient) Reboot(ctx context.Context, in *empty.Empty, opts ...grp func (c *machineClient) Reset(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ResetReply, error) { out := new(ResetReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Reset", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Reset", in, out, opts...) if err != nil { return nil, err } @@ -2224,7 +2223,7 @@ func (c *machineClient) Reset(ctx context.Context, in *empty.Empty, opts ...grpc func (c *machineClient) Shutdown(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ShutdownReply, error) { out := new(ShutdownReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Shutdown", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Shutdown", in, out, opts...) if err != nil { return nil, err } @@ -2233,7 +2232,7 @@ func (c *machineClient) Shutdown(ctx context.Context, in *empty.Empty, opts ...g func (c *machineClient) Upgrade(ctx context.Context, in *UpgradeRequest, opts ...grpc.CallOption) (*UpgradeReply, error) { out := new(UpgradeReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Upgrade", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Upgrade", in, out, opts...) if err != nil { return nil, err } @@ -2242,7 +2241,7 @@ func (c *machineClient) Upgrade(ctx context.Context, in *UpgradeRequest, opts .. func (c *machineClient) ServiceList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ServiceListReply, error) { out := new(ServiceListReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/ServiceList", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/ServiceList", in, out, opts...) if err != nil { return nil, err } @@ -2251,7 +2250,7 @@ func (c *machineClient) ServiceList(ctx context.Context, in *empty.Empty, opts . func (c *machineClient) ServiceStart(ctx context.Context, in *ServiceStartRequest, opts ...grpc.CallOption) (*ServiceStartReply, error) { out := new(ServiceStartReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/ServiceStart", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/ServiceStart", in, out, opts...) if err != nil { return nil, err } @@ -2260,7 +2259,7 @@ func (c *machineClient) ServiceStart(ctx context.Context, in *ServiceStartReques func (c *machineClient) ServiceStop(ctx context.Context, in *ServiceStopRequest, opts ...grpc.CallOption) (*ServiceStopReply, error) { out := new(ServiceStopReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/ServiceStop", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/ServiceStop", in, out, opts...) if err != nil { return nil, err } @@ -2269,7 +2268,7 @@ func (c *machineClient) ServiceStop(ctx context.Context, in *ServiceStopRequest, func (c *machineClient) ServiceRestart(ctx context.Context, in *ServiceRestartRequest, opts ...grpc.CallOption) (*ServiceRestartReply, error) { out := new(ServiceRestartReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/ServiceRestart", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/ServiceRestart", in, out, opts...) if err != nil { return nil, err } @@ -2279,7 +2278,7 @@ func (c *machineClient) ServiceRestart(ctx context.Context, in *ServiceRestartRe // Deprecated: Do not use. func (c *machineClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartReply, error) { out := new(StartReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Start", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Start", in, out, opts...) if err != nil { return nil, err } @@ -2289,7 +2288,7 @@ func (c *machineClient) Start(ctx context.Context, in *StartRequest, opts ...grp // Deprecated: Do not use. func (c *machineClient) Stop(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*StopReply, error) { out := new(StopReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Stop", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Stop", in, out, opts...) if err != nil { return nil, err } @@ -2298,7 +2297,7 @@ func (c *machineClient) Stop(ctx context.Context, in *StopRequest, opts ...grpc. func (c *machineClient) Version(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*VersionReply, error) { out := new(VersionReply) - err := c.cc.Invoke(ctx, "/machineapi.Machine/Version", in, out, opts...) + err := c.cc.Invoke(ctx, "/machine.Machine/Version", in, out, opts...) if err != nil { return nil, err } @@ -2358,7 +2357,7 @@ func _Machine_Mounts_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Mounts", + FullMethod: "/machine.Machine/Mounts", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Mounts(ctx, req.(*empty.Empty)) @@ -2397,7 +2396,7 @@ func _Machine_Reboot_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Reboot", + FullMethod: "/machine.Machine/Reboot", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Reboot(ctx, req.(*empty.Empty)) @@ -2415,7 +2414,7 @@ func _Machine_Reset_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Reset", + FullMethod: "/machine.Machine/Reset", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Reset(ctx, req.(*empty.Empty)) @@ -2433,7 +2432,7 @@ func _Machine_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Shutdown", + FullMethod: "/machine.Machine/Shutdown", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Shutdown(ctx, req.(*empty.Empty)) @@ -2451,7 +2450,7 @@ func _Machine_Upgrade_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Upgrade", + FullMethod: "/machine.Machine/Upgrade", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Upgrade(ctx, req.(*UpgradeRequest)) @@ -2469,7 +2468,7 @@ func _Machine_ServiceList_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/ServiceList", + FullMethod: "/machine.Machine/ServiceList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).ServiceList(ctx, req.(*empty.Empty)) @@ -2487,7 +2486,7 @@ func _Machine_ServiceStart_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/ServiceStart", + FullMethod: "/machine.Machine/ServiceStart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).ServiceStart(ctx, req.(*ServiceStartRequest)) @@ -2505,7 +2504,7 @@ func _Machine_ServiceStop_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/ServiceStop", + FullMethod: "/machine.Machine/ServiceStop", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).ServiceStop(ctx, req.(*ServiceStopRequest)) @@ -2523,7 +2522,7 @@ func _Machine_ServiceRestart_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/ServiceRestart", + FullMethod: "/machine.Machine/ServiceRestart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).ServiceRestart(ctx, req.(*ServiceRestartRequest)) @@ -2541,7 +2540,7 @@ func _Machine_Start_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Start", + FullMethod: "/machine.Machine/Start", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Start(ctx, req.(*StartRequest)) @@ -2559,7 +2558,7 @@ func _Machine_Stop_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Stop", + FullMethod: "/machine.Machine/Stop", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Stop(ctx, req.(*StopRequest)) @@ -2577,7 +2576,7 @@ func _Machine_Version_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/machineapi.Machine/Version", + FullMethod: "/machine.Machine/Version", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Version(ctx, req.(*empty.Empty)) @@ -2586,7 +2585,7 @@ func _Machine_Version_Handler(srv interface{}, ctx context.Context, dec func(int } var _Machine_serviceDesc = grpc.ServiceDesc{ - ServiceName: "machineapi.Machine", + ServiceName: "machine.Machine", HandlerType: (*MachineServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/api/machine/machine.proto b/api/machine/machine.proto index 923449fba..3b838a125 100644 --- a/api/machine/machine.proto +++ b/api/machine/machine.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package machineapi; +package machine; option go_package = "github.com/talos-systems/talos/api/machine"; option java_multiple_files = true; diff --git a/api/os/os.pb.go b/api/os/os.pb.go index 2f46a4c55..49d605c95 100644 --- a/api/os/os.pb.go +++ b/api/os/os.pb.go @@ -7,20 +7,12 @@ import ( context "context" fmt "fmt" math "math" - strings "strings" - 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" - codes "google.golang.org/grpc/codes" - credentials "google.golang.org/grpc/credentials" - metadata "google.golang.org/grpc/metadata" - status "google.golang.org/grpc/status" common "github.com/talos-systems/talos/api/common" - tls "github.com/talos-systems/talos/pkg/grpc/tls" ) // Reference imports to suppress errors if they are not otherwise used. @@ -34,9 +26,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// NodeMetadata from public import common/common.proto -type NodeMetadata = common.NodeMetadata - // The request message containing the containerd namespace. type ContainerDriver int32 @@ -66,7 +55,7 @@ func (ContainerDriver) EnumDescriptor() ([]byte, []int) { type ContainersRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` // driver might be default "containerd" or "cri" - Driver ContainerDriver `protobuf:"varint,2,opt,name=driver,proto3,enum=osapi.ContainerDriver" json:"driver,omitempty"` + Driver ContainerDriver `protobuf:"varint,2,opt,name=driver,proto3,enum=os.ContainerDriver" json:"driver,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -445,7 +434,7 @@ type LogsRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // driver might be default "containerd" or "cri" - Driver ContainerDriver `protobuf:"varint,3,opt,name=driver,proto3,enum=osapi.ContainerDriver" json:"driver,omitempty"` + Driver ContainerDriver `protobuf:"varint,3,opt,name=driver,proto3,enum=os.ContainerDriver" json:"driver,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -752,7 +741,7 @@ type RestartRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // driver might be default "containerd" or "cri" - Driver ContainerDriver `protobuf:"varint,3,opt,name=driver,proto3,enum=osapi.ContainerDriver" json:"driver,omitempty"` + Driver ContainerDriver `protobuf:"varint,3,opt,name=driver,proto3,enum=os.ContainerDriver" json:"driver,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -899,7 +888,7 @@ func (m *RestartReply) GetResponse() []*RestartResponse { type StatsRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` // driver might be default "containerd" or "cri" - Driver ContainerDriver `protobuf:"varint,2,opt,name=driver,proto3,enum=osapi.ContainerDriver" json:"driver,omitempty"` + Driver ContainerDriver `protobuf:"varint,2,opt,name=driver,proto3,enum=os.ContainerDriver" json:"driver,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1128,89 +1117,89 @@ func (m *Stat) GetName() string { } func init() { - proto.RegisterEnum("osapi.ContainerDriver", ContainerDriver_name, ContainerDriver_value) - proto.RegisterType((*ContainersRequest)(nil), "osapi.ContainersRequest") - proto.RegisterType((*Container)(nil), "osapi.Container") - proto.RegisterType((*ContainerResponse)(nil), "osapi.ContainerResponse") - proto.RegisterType((*ContainersReply)(nil), "osapi.ContainersReply") - proto.RegisterType((*Data)(nil), "osapi.Data") - proto.RegisterType((*DataResponse)(nil), "osapi.DataResponse") - proto.RegisterType((*DataReply)(nil), "osapi.DataReply") - proto.RegisterType((*LogsRequest)(nil), "osapi.LogsRequest") - proto.RegisterType((*ProcessesRequest)(nil), "osapi.ProcessesRequest") - proto.RegisterType((*ProcessesReply)(nil), "osapi.ProcessesReply") - proto.RegisterType((*ProcessResponse)(nil), "osapi.ProcessResponse") - proto.RegisterType((*Process)(nil), "osapi.Process") - proto.RegisterType((*RestartRequest)(nil), "osapi.RestartRequest") - proto.RegisterType((*RestartResponse)(nil), "osapi.RestartResponse") - proto.RegisterType((*RestartReply)(nil), "osapi.RestartReply") - proto.RegisterType((*StatsRequest)(nil), "osapi.StatsRequest") - proto.RegisterType((*StatsResponse)(nil), "osapi.StatsResponse") - proto.RegisterType((*StatsReply)(nil), "osapi.StatsReply") - proto.RegisterType((*Stat)(nil), "osapi.Stat") + proto.RegisterEnum("os.ContainerDriver", ContainerDriver_name, ContainerDriver_value) + proto.RegisterType((*ContainersRequest)(nil), "os.ContainersRequest") + proto.RegisterType((*Container)(nil), "os.Container") + proto.RegisterType((*ContainerResponse)(nil), "os.ContainerResponse") + proto.RegisterType((*ContainersReply)(nil), "os.ContainersReply") + proto.RegisterType((*Data)(nil), "os.Data") + proto.RegisterType((*DataResponse)(nil), "os.DataResponse") + proto.RegisterType((*DataReply)(nil), "os.DataReply") + proto.RegisterType((*LogsRequest)(nil), "os.LogsRequest") + proto.RegisterType((*ProcessesRequest)(nil), "os.ProcessesRequest") + proto.RegisterType((*ProcessesReply)(nil), "os.ProcessesReply") + proto.RegisterType((*ProcessResponse)(nil), "os.ProcessResponse") + proto.RegisterType((*Process)(nil), "os.Process") + proto.RegisterType((*RestartRequest)(nil), "os.RestartRequest") + proto.RegisterType((*RestartResponse)(nil), "os.RestartResponse") + proto.RegisterType((*RestartReply)(nil), "os.RestartReply") + proto.RegisterType((*StatsRequest)(nil), "os.StatsRequest") + proto.RegisterType((*StatsResponse)(nil), "os.StatsResponse") + proto.RegisterType((*StatsReply)(nil), "os.StatsReply") + proto.RegisterType((*Stat)(nil), "os.Stat") } func init() { proto.RegisterFile("os/os.proto", fileDescriptor_b20a722d09fd3254) } var fileDescriptor_b20a722d09fd3254 = []byte{ - // 909 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6f, 0xdb, 0x36, - 0x10, 0x9f, 0x1c, 0xcb, 0x8e, 0xce, 0x8e, 0xe3, 0x32, 0x1f, 0xd0, 0xdc, 0x62, 0x48, 0x05, 0x14, - 0xcb, 0x8a, 0x4d, 0xce, 0xbc, 0x8f, 0x87, 0xa1, 0x28, 0xd0, 0xc4, 0xc5, 0x10, 0x6c, 0x4d, 0x02, - 0xb6, 0x7b, 0x19, 0x06, 0x04, 0xb4, 0xc4, 0xba, 0xc4, 0x2c, 0x91, 0x15, 0xa9, 0x6e, 0xfe, 0x4f, - 0xf6, 0xb6, 0x97, 0xfd, 0x9d, 0xc3, 0xc0, 0x0f, 0x29, 0x8a, 0x9d, 0x6d, 0x69, 0x8b, 0xed, 0x49, - 0xe4, 0xef, 0x8e, 0x77, 0xbc, 0xe3, 0xef, 0xee, 0x04, 0x3d, 0x2e, 0xc7, 0x5c, 0xc6, 0xa2, 0xe0, - 0x8a, 0x23, 0x9f, 0x4b, 0x22, 0xd8, 0xe8, 0xee, 0x9c, 0xf3, 0xf9, 0x82, 0x8e, 0x0d, 0x38, 0x2b, - 0x5f, 0x8e, 0x69, 0x26, 0xd4, 0xd2, 0xea, 0x8c, 0x76, 0x12, 0x9e, 0x65, 0x3c, 0x1f, 0xdb, 0x8f, - 0x05, 0x23, 0x02, 0x77, 0x4e, 0x78, 0xae, 0x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7, 0xe3, - 0x83, 0x39, 0x53, 0xaf, 0xca, 0x99, 0xa6, 0xfb, 0x58, 0x91, 0x05, 0x97, 0x9f, 0xc9, 0xa5, 0x54, - 0x34, 0x93, 0x76, 0x37, 0x26, 0x82, 0x8d, 0xb9, 0xbc, 0xf0, 0x66, 0x1d, 0x13, 0xce, 0x17, 0x7f, - 0x05, 0x00, 0x00, 0xff, 0xff, 0x20, 0x41, 0x0c, 0xc5, 0xbc, 0x09, 0x00, 0x00, + // 900 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x5f, 0x73, 0xdb, 0x44, + 0x10, 0x47, 0xb2, 0x65, 0x5b, 0xeb, 0xbf, 0xbd, 0xa4, 0x1d, 0xe1, 0x76, 0x3a, 0x41, 0x4c, 0x87, + 0xb4, 0x10, 0xbb, 0xa4, 0x0f, 0xc0, 0xc0, 0x0c, 0x93, 0xc6, 0x7d, 0xc8, 0x40, 0x93, 0xce, 0xb5, + 0x3c, 0xc0, 0x03, 0xe1, 0x6c, 0x5d, 0x9d, 0x1b, 0x2c, 0xdd, 0xa1, 0x3b, 0x75, 0xf0, 0x37, 0xe1, + 0x8d, 0x17, 0xbe, 0x16, 0xdf, 0x85, 0xb9, 0x3f, 0x92, 0xe5, 0xa4, 0xd0, 0xd0, 0x0e, 0x3c, 0xf9, + 0xee, 0xb7, 0xbf, 0xdb, 0xdd, 0x5b, 0xff, 0x76, 0x4f, 0xd0, 0xe5, 0x72, 0xca, 0xe5, 0x44, 0xe4, + 0x5c, 0x71, 0xe4, 0x73, 0x39, 0xbe, 0xbd, 0xe4, 0x7c, 0xb9, 0xa2, 0x53, 0x83, 0xcc, 0x8b, 0x97, + 0x53, 0x9a, 0x0a, 0xb5, 0xb6, 0x84, 0xf1, 0xce, 0x82, 0xa7, 0x29, 0xcf, 0xa6, 0xf6, 0xc7, 0x82, + 0xf1, 0x8f, 0x70, 0x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, 0xba, 0x28, 0xe6, 0x5a, + 0xc7, 0x53, 0x45, 0x56, 0x5c, 0x1e, 0xc8, 0xb5, 0x54, 0x34, 0x95, 0x76, 0x37, 0x25, 0x82, 0x4d, + 0xb9, 0x9c, 0xb7, 0x4c, 0xf6, 0x8f, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xe5, 0x4b, 0x71, + 0x6f, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1244,7 +1233,7 @@ func NewOSClient(cc *grpc.ClientConn) OSClient { func (c *oSClient) Containers(ctx context.Context, in *ContainersRequest, opts ...grpc.CallOption) (*ContainersReply, error) { out := new(ContainersReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Containers", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Containers", in, out, opts...) if err != nil { return nil, err } @@ -1253,7 +1242,7 @@ func (c *oSClient) Containers(ctx context.Context, in *ContainersRequest, opts . func (c *oSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) { out := new(DataReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Dmesg", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Dmesg", in, out, opts...) if err != nil { return nil, err } @@ -1262,7 +1251,7 @@ func (c *oSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.Call func (c *oSClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) { out := new(DataReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Kubeconfig", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Kubeconfig", in, out, opts...) if err != nil { return nil, err } @@ -1270,7 +1259,7 @@ func (c *oSClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc } func (c *oSClient) Logs(ctx context.Context, in *LogsRequest, opts ...grpc.CallOption) (OS_LogsClient, error) { - stream, err := c.cc.NewStream(ctx, &_OS_serviceDesc.Streams[0], "/osapi.OS/Logs", opts...) + stream, err := c.cc.NewStream(ctx, &_OS_serviceDesc.Streams[0], "/os.OS/Logs", opts...) if err != nil { return nil, err } @@ -1303,7 +1292,7 @@ func (x *oSLogsClient) Recv() (*Data, error) { func (c *oSClient) Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ProcessesReply, error) { out := new(ProcessesReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Processes", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Processes", in, out, opts...) if err != nil { return nil, err } @@ -1312,7 +1301,7 @@ func (c *oSClient) Processes(ctx context.Context, in *empty.Empty, opts ...grpc. func (c *oSClient) Restart(ctx context.Context, in *RestartRequest, opts ...grpc.CallOption) (*RestartReply, error) { out := new(RestartReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Restart", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Restart", in, out, opts...) if err != nil { return nil, err } @@ -1321,7 +1310,7 @@ func (c *oSClient) Restart(ctx context.Context, in *RestartRequest, opts ...grpc func (c *oSClient) Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsReply, error) { out := new(StatsReply) - err := c.cc.Invoke(ctx, "/osapi.OS/Stats", in, out, opts...) + err := c.cc.Invoke(ctx, "/os.OS/Stats", in, out, opts...) if err != nil { return nil, err } @@ -1339,38 +1328,6 @@ type OSServer interface { Stats(context.Context, *StatsRequest) (*StatsReply, error) } -// UnimplementedOSServer can be embedded to have forward compatible implementations. -type UnimplementedOSServer struct { -} - -func (*UnimplementedOSServer) Containers(ctx context.Context, req *ContainersRequest) (*ContainersReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Containers not implemented") -} - -func (*UnimplementedOSServer) Dmesg(ctx context.Context, req *empty.Empty) (*DataReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Dmesg not implemented") -} - -func (*UnimplementedOSServer) Kubeconfig(ctx context.Context, req *empty.Empty) (*DataReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Kubeconfig not implemented") -} - -func (*UnimplementedOSServer) Logs(req *LogsRequest, srv OS_LogsServer) error { - return status.Errorf(codes.Unimplemented, "method Logs not implemented") -} - -func (*UnimplementedOSServer) Processes(ctx context.Context, req *empty.Empty) (*ProcessesReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Processes not implemented") -} - -func (*UnimplementedOSServer) Restart(ctx context.Context, req *RestartRequest) (*RestartReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Restart not implemented") -} - -func (*UnimplementedOSServer) Stats(ctx context.Context, req *StatsRequest) (*StatsReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stats not implemented") -} - func RegisterOSServer(s *grpc.Server, srv OSServer) { s.RegisterService(&_OS_serviceDesc, srv) } @@ -1385,7 +1342,7 @@ func _OS_Containers_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Containers", + FullMethod: "/os.OS/Containers", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Containers(ctx, req.(*ContainersRequest)) @@ -1403,7 +1360,7 @@ func _OS_Dmesg_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Dmesg", + FullMethod: "/os.OS/Dmesg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Dmesg(ctx, req.(*empty.Empty)) @@ -1421,7 +1378,7 @@ func _OS_Kubeconfig_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Kubeconfig", + FullMethod: "/os.OS/Kubeconfig", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Kubeconfig(ctx, req.(*empty.Empty)) @@ -1460,7 +1417,7 @@ func _OS_Processes_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Processes", + FullMethod: "/os.OS/Processes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Processes(ctx, req.(*empty.Empty)) @@ -1478,7 +1435,7 @@ func _OS_Restart_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Restart", + FullMethod: "/os.OS/Restart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Restart(ctx, req.(*RestartRequest)) @@ -1496,7 +1453,7 @@ func _OS_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/osapi.OS/Stats", + FullMethod: "/os.OS/Stats", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OSServer).Stats(ctx, req.(*StatsRequest)) @@ -1505,7 +1462,7 @@ func _OS_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{ } var _OS_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osapi.OS", + ServiceName: "os.OS", HandlerType: (*OSServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1542,221 +1499,3 @@ var _OS_serviceDesc = grpc.ServiceDesc{ }, Metadata: "os/os.proto", } - -type runnerfn func(*proxyOSClient, interface{}, *sync.WaitGroup, chan proto.Message, chan error) - -type proxyOSClient struct { - Conn OSClient - Context context.Context - Target string - DialOpts []grpc.DialOption -} - -func proxyOSRunner(clients []*proxyOSClient, in interface{}, runner runnerfn) ([]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 OSProxy struct { - Provider tls.CertificateProvider -} - -func NewOSProxy(provider tls.CertificateProvider) *OSProxy { - return &OSProxy{Provider: provider} -} - -func (p *OSProxy) UnaryInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - pkg := strings.Split(info.FullMethod, "/")[1] - if pkg != "osapi.OS" { - return handler(ctx, req) - } - 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.Proxy(ctx, info.FullMethod, credentials.NewTLS(tlsConfig), req) - } -} - -func (p *OSProxy) Proxy(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"]...) - - clients := []*proxyOSClient{} - for _, target := range targets { - c := &proxyOSClient{ - Context: metadata.NewOutgoingContext(context.Background(), proxyMd), - Target: target, - } - overrideCreds := creds - conn, err := grpc.Dial(fmt.Sprintf("%s:%d", c.Target, 50000), grpc.WithTransportCredentials(overrideCreds)) - if err != nil { - errors = go_multierror.Append(errors, err) - continue - } - c.Conn = NewOSClient(conn) - clients = append(clients, c) - } - switch method { - case "/osapi.OS/Containers": - resp := &ContainersReply{} - msgs, err = proxyOSRunner(clients, in, proxyContainers) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*ContainersReply).Response[0]) - } - response = resp - case "/osapi.OS/Dmesg": - resp := &DataReply{} - msgs, err = proxyOSRunner(clients, in, proxyDmesg) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*DataReply).Response[0]) - } - response = resp - case "/osapi.OS/Kubeconfig": - resp := &DataReply{} - msgs, err = proxyOSRunner(clients, in, proxyKubeconfig) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*DataReply).Response[0]) - } - response = resp - case "/osapi.OS/Processes": - resp := &ProcessesReply{} - msgs, err = proxyOSRunner(clients, in, proxyProcesses) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*ProcessesReply).Response[0]) - } - response = resp - case "/osapi.OS/Restart": - resp := &RestartReply{} - msgs, err = proxyOSRunner(clients, in, proxyRestart) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*RestartReply).Response[0]) - } - response = resp - case "/osapi.OS/Stats": - resp := &StatsReply{} - msgs, err = proxyOSRunner(clients, in, proxyStats) - for _, msg := range msgs { - resp.Response = append(resp.Response, msg.(*StatsReply).Response[0]) - } - response = resp - } - - if err != nil { - errors = go_multierror.Append(errors, err) - } - return response, errors.ErrorOrNil() -} - -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.(*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 proxyKubeconfig(client *proxyOSClient, in interface{}, wg *sync.WaitGroup, respCh chan proto.Message, errCh chan error) { - defer wg.Done() - resp, err := client.Conn.Kubeconfig(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.(*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.(*StatsRequest)) - if err != nil { - errCh <- err - return - } - resp.Response[0].Metadata = &NodeMetadata{Hostname: client.Target} - respCh <- resp -} diff --git a/api/os/os.proto b/api/os/os.proto index 1fe5c3705..cb53f6375 100644 --- a/api/os/os.proto +++ b/api/os/os.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package osapi; +package os; option go_package = "github.com/talos-systems/talos/api/os"; option java_multiple_files = true; @@ -8,7 +8,7 @@ option java_outer_classname = "OsApi"; option java_package = "com.os.api"; import "google/protobuf/empty.proto"; -import public "common/common.proto"; +import "common/common.proto"; // The OS service definition. // diff --git a/cmd/osctl/cmd/root.go b/cmd/osctl/cmd/root.go index b855e03e0..1affefc36 100644 --- a/cmd/osctl/cmd/root.go +++ b/cmd/osctl/cmd/root.go @@ -59,11 +59,6 @@ func Execute() { defer globalCtxCancel() - // Update context with grpc metadata for proxy/relay requests - md := metadata.New(make(map[string]string)) - md.Set("targets", target...) - globalCtx = metadata.NewOutgoingContext(globalCtx, md) - // listen for ^C and SIGTERM and abort context sigCh := make(chan os.Signal, 1) signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM) @@ -111,6 +106,11 @@ func Execute() { // setupClient wraps common code to initialize osd client func setupClient(action func(*client.Client)) { + // Update context with grpc metadata for proxy/relay requests + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + globalCtx = metadata.NewOutgoingContext(globalCtx, md) + t, creds, err := client.NewClientTargetAndCredentialsFromConfig(talosconfig) if err != nil { helpers.Fatalf("error getting client credentials: %s", err) diff --git a/hack/drone.jsonnet b/hack/drone.jsonnet index 04730190b..5b066610b 100644 --- a/hack/drone.jsonnet +++ b/hack/drone.jsonnet @@ -139,7 +139,8 @@ local ntpd = Step("ntpd", depends_on=[fetchtags]); local networkd = Step("networkd", depends_on=[fetchtags]); local osctl_linux = Step("osctl-linux", depends_on=[fetchtags]); local osctl_darwin = Step("osctl-darwin", depends_on=[fetchtags]); -local rootfs = Step("rootfs", depends_on=[machined, osd, trustd, ntpd, networkd]); +local apid = Step("apid", depends_on=[fetchtags]); +local rootfs = Step("rootfs", depends_on=[machined, osd, trustd, ntpd, networkd, apid]); local initramfs = Step("initramfs", depends_on=[rootfs]); local installer = Step("installer", depends_on=[rootfs]); local container = Step("container", depends_on=[rootfs]); @@ -189,6 +190,7 @@ local default_steps = [ fetchtags, machined, osd, + apid, trustd, ntpd, networkd, diff --git a/hack/test/basic-integration.sh b/hack/test/basic-integration.sh index 023b95d29..27d0bd178 100755 --- a/hack/test/basic-integration.sh +++ b/hack/test/basic-integration.sh @@ -88,4 +88,5 @@ run "kubectl wait --timeout=${TIMEOUT}s --for=condition=ready=true pod -l k8s-ap run "osctl config target 10.5.0.2 && osctl -t 10.5.0.2 service etcd | grep Running" run "osctl config target 10.5.0.3 && osctl -t 10.5.0.3 service etcd | grep Running" run "osctl config target 10.5.0.4 && osctl -t 10.5.0.4 service etcd | grep Running" -run "osctl --target 10.5.0.2,10.5.0.3,10.5.0.4,10.5.0.5 containers | grep osd" +run "osctl --target 10.5.0.2,10.5.0.3,10.5.0.4,10.5.0.5 containers" +run "osctl --target 10.5.0.2,10.5.0.3,10.5.0.4,10.5.0.5 services" diff --git a/internal/app/apid/main.go b/internal/app/apid/main.go new file mode 100644 index 000000000..7ef61a415 --- /dev/null +++ b/internal/app/apid/main.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 main + +import ( + "flag" + "log" + stdlibnet "net" + "os" + "strings" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + + "github.com/talos-systems/talos/api" + "github.com/talos-systems/talos/pkg/config" + "github.com/talos-systems/talos/pkg/constants" + "github.com/talos-systems/talos/pkg/grpc/factory" + "github.com/talos-systems/talos/pkg/grpc/tls" + "github.com/talos-systems/talos/pkg/net" + "github.com/talos-systems/talos/pkg/startup" +) + +var ( + configPath *string + endpoints *string +) + +func init() { + log.SetFlags(log.Lshortfile | log.Ldate | log.Lmicroseconds | log.Ltime) + + configPath = flag.String("config", "", "the path to the config") + endpoints = flag.String("endpoints", "", "the IPs of the control plane nodes") + + flag.Parse() +} + +func main() { + if err := startup.RandSeed(); err != nil { + log.Fatalf("failed to seed RNG: %v", err) + } + + provider, err := createProvider() + if err != nil { + log.Fatalf("failed to create remote certificate provider: %+v", err) + } + + ca, err := provider.GetCA() + if err != nil { + log.Fatalf("failed to get root CA: %+v", err) + } + + tlsConfig, err := tls.New( + tls.WithClientAuthType(tls.Mutual), + tls.WithCACertPEM(ca), + tls.WithCertificateProvider(provider), + ) + if err != nil { + log.Fatalf("failed to create OS-level TLS configuration: %v", err) + } + + machineClient, err := api.NewLocalMachineClient() + if err != nil { + log.Fatalf("machine client: %v", err) + } + + osClient, err := api.NewLocalOSClient() + if err != nil { + log.Fatalf("networkd client: %v", err) + } + + protoProxy := api.NewApiProxy(provider) + + err = factory.ListenAndServe( + &api.Registrator{ + MachineClient: machineClient, + OSClient: osClient, + }, + factory.Port(constants.OsdPort), + factory.ServerOptions( + grpc.Creds( + credentials.NewTLS(tlsConfig), + ), + grpc.UnaryInterceptor(protoProxy.UnaryInterceptor()), + ), + ) + if err != nil { + log.Fatalf("listen: %v", err) + } +} + +func createProvider() (tls.CertificateProvider, error) { + content, err := config.FromFile(*configPath) + if err != nil { + log.Fatalf("open config: %v", err) + } + + config, err := config.New(content) + if err != nil { + log.Fatalf("open config: %v", err) + } + + ips, err := net.IPAddrs() + if err != nil { + log.Fatalf("failed to discover IP addresses: %+v", err) + } + // TODO(andrewrynhard): Allow for DNS names. + for _, san := range config.Machine().Security().CertSANs() { + if ip := stdlibnet.ParseIP(san); ip != nil { + ips = append(ips, ip) + } + } + + hostname, err := os.Hostname() + if err != nil { + log.Fatalf("failed to discover hostname: %+v", err) + } + + return tls.NewRemoteRenewingFileCertificateProvider(config.Machine().Security().Token(), strings.Split(*endpoints, ","), constants.TrustdPort, hostname, ips) +} diff --git a/internal/app/machined/internal/api/api.go b/internal/app/machined/internal/api/api.go index dab4a8ddc..b15817b7d 100644 --- a/internal/app/machined/internal/api/api.go +++ b/internal/app/machined/internal/api/api.go @@ -27,7 +27,7 @@ func (s *Service) Main(ctx context.Context, config runtime.Configurator, logWrit api := reg.NewRegistrator(config) server := factory.NewServer(api) - listener, err := factory.NewListener(factory.Network("unix"), factory.SocketPath(constants.InitSocketPath)) + listener, err := factory.NewListener(factory.Network("unix"), factory.SocketPath(constants.MachineSocketPath)) if err != nil { return err } diff --git a/internal/app/machined/internal/phase/services/start_services.go b/internal/app/machined/internal/phase/services/start_services.go index 43e77d860..10bcfc38d 100644 --- a/internal/app/machined/internal/phase/services/start_services.go +++ b/internal/app/machined/internal/phase/services/start_services.go @@ -40,6 +40,7 @@ func (task *StartServices) loadSystemServices(r runtime.Runtime) { svcs.Load( &services.MachinedAPI{}, &services.Containerd{}, + &services.APID{}, &services.OSD{}, &services.Networkd{}, ) diff --git a/internal/app/machined/internal/phase/services/stop_non_crucial_services.go b/internal/app/machined/internal/phase/services/stop_non_crucial_services.go index 9f64fa553..5bc71535c 100644 --- a/internal/app/machined/internal/phase/services/stop_non_crucial_services.go +++ b/internal/app/machined/internal/phase/services/stop_non_crucial_services.go @@ -32,7 +32,7 @@ func (task *StopNonCrucialServices) TaskFunc(mode runtime.Mode) phase.TaskFunc { func (task *StopNonCrucialServices) standard(r runtime.Runtime) (err error) { ctx := namespaces.WithNamespace(context.Background(), "k8s.io") - services := []string{"osd", "udevd", "networkd", "ntpd"} + services := []string{"osd", "udevd", "networkd", "ntpd", "apid"} if r.Config().Machine().Type() == machine.Bootstrap || r.Config().Machine().Type() == machine.ControlPlane { services = append(services, "trustd", "proxyd") } diff --git a/internal/app/machined/pkg/system/services/apid.go b/internal/app/machined/pkg/system/services/apid.go new file mode 100644 index 000000000..213c341cd --- /dev/null +++ b/internal/app/machined/pkg/system/services/apid.go @@ -0,0 +1,150 @@ +/* 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/. */ + +// nolint: dupl,golint +package services + +import ( + "context" + "fmt" + "net" + "strings" + "time" + + containerdapi "github.com/containerd/containerd" + "github.com/containerd/containerd/oci" + specs "github.com/opencontainers/runtime-spec/specs-go" + + "github.com/talos-systems/talos/internal/app/machined/pkg/system/conditions" + "github.com/talos-systems/talos/internal/app/machined/pkg/system/health" + "github.com/talos-systems/talos/internal/app/machined/pkg/system/runner" + "github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/containerd" + "github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/restart" + "github.com/talos-systems/talos/internal/pkg/runtime" + "github.com/talos-systems/talos/pkg/config/machine" + "github.com/talos-systems/talos/pkg/constants" + "github.com/talos-systems/talos/pkg/kubernetes" + "github.com/talos-systems/talos/pkg/retry" +) + +// APID implements the Service interface. It serves as the concrete type with +// the required methods. +type APID struct{} + +// ID implements the Service interface. +func (o *APID) ID(config runtime.Configurator) string { + return "apid" +} + +// PreFunc implements the Service interface. +func (o *APID) PreFunc(ctx context.Context, config runtime.Configurator) error { + importer := containerd.NewImporter(constants.SystemContainerdNamespace, containerd.WithContainerdAddress(constants.SystemContainerdAddress)) + + return importer.Import(&containerd.ImportRequest{ + Path: "/usr/images/apid.tar", + Options: []containerdapi.ImportOpt{ + containerdapi.WithIndexName("talos/apid"), + }, + }) +} + +// PostFunc implements the Service interface. +func (o *APID) PostFunc(config runtime.Configurator) (err error) { + return nil +} + +// Condition implements the Service interface. +func (o *APID) Condition(config runtime.Configurator) conditions.Condition { + if config.Machine().Type() == machine.Worker { + return conditions.WaitForFileToExist(constants.KubeletKubeconfig) + } + + return nil +} + +// DependsOn implements the Service interface. +func (o *APID) DependsOn(config runtime.Configurator) []string { + return []string{"system-containerd", "containerd"} +} + +func (o *APID) Runner(config runtime.Configurator) (runner.Runner, error) { + image := "talos/apid" + + endpoints := []string{"127.0.0.1"} + + if config.Machine().Type() == machine.Worker { + opts := []retry.Option{retry.WithUnits(3 * time.Second), retry.WithJitter(time.Second)} + + err := retry.Constant(10*time.Minute, opts...).Retry(func() error { + h, err := kubernetes.NewHelper() + if err != nil { + return retry.ExpectedError(fmt.Errorf("failed to create client: %w", err)) + } + + endpoints, err = h.MasterIPs() + if err != nil { + return retry.ExpectedError(err) + } + + return nil + }) + if err != nil { + return nil, err + } + } + + // Set the process arguments. + args := runner.Args{ + ID: o.ID(config), + ProcessArgs: []string{ + "/apid", + "--config=" + constants.ConfigPath, + "--endpoints=" + strings.Join(endpoints, ","), + }, + } + + // Set the mounts. + mounts := []specs.Mount{ + {Type: "bind", Destination: "/etc/ssl", Source: "/etc/ssl", Options: []string{"bind", "ro"}}, + {Type: "bind", Destination: constants.ConfigPath, Source: constants.ConfigPath, Options: []string{"rbind", "ro"}}, + // Other grpc server sockets + {Type: "bind", Destination: constants.SystemRunPath, Source: constants.SystemRunPath, Options: []string{"bind", "ro"}}, + } + + env := []string{} + for key, val := range config.Machine().Env() { + env = append(env, fmt.Sprintf("%s=%s", key, val)) + } + + return restart.New(containerd.NewRunner( + config.Debug(), + &args, + runner.WithContainerdAddress(constants.SystemContainerdAddress), + runner.WithContainerImage(image), + runner.WithEnv(env), + runner.WithOCISpecOpts( + oci.WithMounts(mounts), + ), + ), + restart.WithType(restart.Forever), + ), nil +} + +// HealthFunc implements the HealthcheckedService interface +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)) + if err != nil { + return err + } + + return conn.Close() + } +} + +// HealthSettings implements the HealthcheckedService interface +func (o *APID) HealthSettings(runtime.Configurator) *health.Settings { + return &health.DefaultSettings +} diff --git a/internal/app/machined/pkg/system/services/apid_test.go b/internal/app/machined/pkg/system/services/apid_test.go new file mode 100644 index 000000000..6325875e8 --- /dev/null +++ b/internal/app/machined/pkg/system/services/apid_test.go @@ -0,0 +1,18 @@ +/* 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 services_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/talos-systems/talos/internal/app/machined/pkg/system" + "github.com/talos-systems/talos/internal/app/machined/pkg/system/services" +) + +func TestAPIDInterfaces(t *testing.T) { + assert.Implements(t, (*system.HealthcheckedService)(nil), new(services.APID)) +} diff --git a/internal/app/machined/pkg/system/services/osd.go b/internal/app/machined/pkg/system/services/osd.go index 66c76c643..400d67787 100644 --- a/internal/app/machined/pkg/system/services/osd.go +++ b/internal/app/machined/pkg/system/services/osd.go @@ -8,13 +8,13 @@ package services import ( "context" "fmt" - "net" - "strings" - "time" + "os" + "path/filepath" containerdapi "github.com/containerd/containerd" "github.com/containerd/containerd/oci" specs "github.com/opencontainers/runtime-spec/specs-go" + "google.golang.org/grpc" "github.com/talos-systems/talos/internal/app/machined/pkg/system/conditions" "github.com/talos-systems/talos/internal/app/machined/pkg/system/health" @@ -24,8 +24,6 @@ import ( "github.com/talos-systems/talos/internal/pkg/runtime" "github.com/talos-systems/talos/pkg/config/machine" "github.com/talos-systems/talos/pkg/constants" - "github.com/talos-systems/talos/pkg/kubernetes" - "github.com/talos-systems/talos/pkg/retry" ) // OSD implements the Service interface. It serves as the concrete type with @@ -56,17 +54,13 @@ func (o *OSD) PostFunc(config runtime.Configurator) (err error) { // Condition implements the Service interface. func (o *OSD) Condition(config runtime.Configurator) conditions.Condition { - if config.Machine().Type() == machine.Worker { - return conditions.WaitForFileToExist(constants.KubeletKubeconfig) - } - return nil } // DependsOn implements the Service interface. func (o *OSD) DependsOn(config runtime.Configurator) []string { if config.Machine().Type() == machine.Worker { - return []string{"system-containerd", "containerd", "kubelet"} + return []string{"system-containerd", "containerd"} } return []string{"system-containerd", "containerd"} @@ -75,48 +69,30 @@ func (o *OSD) DependsOn(config runtime.Configurator) []string { func (o *OSD) Runner(config runtime.Configurator) (runner.Runner, error) { image := "talos/osd" - endpoints := []string{"127.0.0.1"} - - if config.Machine().Type() == machine.Worker { - opts := []retry.Option{retry.WithUnits(3 * time.Second), retry.WithJitter(time.Second)} - - err := retry.Constant(10*time.Minute, opts...).Retry(func() error { - h, err := kubernetes.NewHelper() - if err != nil { - return retry.ExpectedError(fmt.Errorf("failed to create client: %w", err)) - } - - endpoints, err = h.MasterIPs() - if err != nil { - return retry.ExpectedError(err) - } - - return nil - }) - if err != nil { - return nil, err - } - } - // Set the process arguments. args := runner.Args{ ID: o.ID(config), ProcessArgs: []string{ "/osd", - "--config=" + constants.ConfigPath, - "--endpoints=" + strings.Join(endpoints, ","), }, } + // Ensure socket dir exists + if err := os.MkdirAll(filepath.Dir(constants.OSSocketPath), os.ModeDir); err != nil { + return nil, err + } + // Set the mounts. mounts := []specs.Mount{ - {Type: "bind", Destination: "/tmp", Source: "/tmp", Options: []string{"rbind", "rshared", "rw"}}, {Type: "bind", Destination: "/etc/kubernetes", Source: "/etc/kubernetes", Options: []string{"rbind", "ro"}}, {Type: "bind", Destination: "/etc/ssl", Source: "/etc/ssl", Options: []string{"bind", "ro"}}, + {Type: "bind", Destination: "/tmp", Source: "/tmp", Options: []string{"rbind", "rshared", "rw"}}, + {Type: "bind", Destination: "/var/log/pods", Source: "/var/log/pods", Options: []string{"bind", "ro"}}, {Type: "bind", Destination: constants.ConfigPath, Source: constants.ConfigPath, Options: []string{"rbind", "ro"}}, {Type: "bind", Destination: constants.ContainerdAddress, Source: constants.ContainerdAddress, Options: []string{"bind", "ro"}}, + {Type: "bind", Destination: constants.DefaultLogPath, Source: constants.DefaultLogPath, Options: []string{"bind", "ro"}}, {Type: "bind", Destination: constants.SystemRunPath, Source: constants.SystemRunPath, Options: []string{"bind", "ro"}}, - {Type: "bind", Destination: "/var/log/pods", Source: "/var/log/pods", Options: []string{"bind", "ro"}}, + {Type: "bind", Destination: filepath.Dir(constants.OSSocketPath), Source: filepath.Dir(constants.OSSocketPath), Options: []string{"rbind", "rw"}}, } env := []string{} @@ -141,12 +117,10 @@ func (o *OSD) Runner(config runtime.Configurator) (runner.Runner, error) { // HealthFunc implements the HealthcheckedService interface func (o *OSD) 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 := grpc.Dial("unix:"+constants.OSSocketPath, grpc.WithInsecure()) if err != nil { return err } - return conn.Close() } } diff --git a/internal/app/osd/internal/reg/machine_client.go b/internal/app/osd/internal/reg/machine_client.go deleted file mode 100644 index 26fc51ff1..000000000 --- a/internal/app/osd/internal/reg/machine_client.go +++ /dev/null @@ -1,136 +0,0 @@ -/* 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 reg - -import ( - "context" - "io" - - "github.com/golang/protobuf/ptypes/empty" - "google.golang.org/grpc" - - machineapi "github.com/talos-systems/talos/api/machine" - "github.com/talos-systems/talos/pkg/constants" -) - -// MachineClient is a gRPC client for init service API -type MachineClient struct { - machineapi.MachineClient -} - -// NewMachineClient initializes new client and connects to init -func NewMachineClient() (*MachineClient, error) { - conn, err := grpc.Dial("unix:"+constants.InitSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - - return &MachineClient{ - MachineClient: machineapi.NewMachineClient(conn), - }, nil -} - -// Reboot executes init Reboot() API -func (c *MachineClient) Reboot(ctx context.Context, in *empty.Empty) (*machineapi.RebootReply, error) { - return c.MachineClient.Reboot(ctx, in) -} - -// Shutdown executes init Shutdown() API. -func (c *MachineClient) Shutdown(ctx context.Context, in *empty.Empty) (*machineapi.ShutdownReply, error) { - return c.MachineClient.Shutdown(ctx, in) -} - -// Upgrade executes the init Upgrade() API. -func (c *MachineClient) Upgrade(ctx context.Context, in *machineapi.UpgradeRequest) (data *machineapi.UpgradeReply, err error) { - return c.MachineClient.Upgrade(ctx, in) -} - -// Reset executes the init Reset() API. -func (c *MachineClient) Reset(ctx context.Context, in *empty.Empty) (data *machineapi.ResetReply, err error) { - return c.MachineClient.Reset(ctx, in) -} - -// ServiceStart executes the init ServiceStart() API. -func (c *MachineClient) ServiceStart(ctx context.Context, in *machineapi.ServiceStartRequest) (data *machineapi.ServiceStartReply, err error) { - return c.MachineClient.ServiceStart(ctx, in) -} - -// ServiceStop executes the init ServiceStop() API. -func (c *MachineClient) ServiceStop(ctx context.Context, in *machineapi.ServiceStopRequest) (data *machineapi.ServiceStopReply, err error) { - return c.MachineClient.ServiceStop(ctx, in) -} - -// ServiceRestart executes the init ServiceRestart() API. -func (c *MachineClient) ServiceRestart(ctx context.Context, in *machineapi.ServiceRestartRequest) (data *machineapi.ServiceRestartReply, err error) { - return c.MachineClient.ServiceRestart(ctx, in) -} - -// Start executes the init Start() API (deprecated). -//nolint: staticcheck -func (c *MachineClient) Start(ctx context.Context, in *machineapi.StartRequest) (data *machineapi.StartReply, err error) { - return c.MachineClient.Start(ctx, in) -} - -// Stop executes the init Stop() API (deprecated). -//nolint: staticcheck -func (c *MachineClient) Stop(ctx context.Context, in *machineapi.StopRequest) (data *machineapi.StopReply, err error) { - return c.MachineClient.Stop(ctx, in) -} - -// ServiceList executes the init ServiceList() API. -func (c *MachineClient) ServiceList(ctx context.Context, in *empty.Empty) (data *machineapi.ServiceListReply, err error) { - return c.MachineClient.ServiceList(ctx, in) -} - -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 -} - -// CopyOut executes the init CopyOut() API. -func (c *MachineClient) CopyOut(req *machineapi.CopyOutRequest, srv machineapi.Machine_CopyOutServer) error { - client, err := c.MachineClient.CopyOut(srv.Context(), req) - if err != nil { - return err - } - - var msg machineapi.StreamingData - - return copyClientServer(&msg, client, srv) -} - -// LS executes the init LS() API. -func (c *MachineClient) LS(req *machineapi.LSRequest, srv machineapi.Machine_LSServer) error { - client, err := c.MachineClient.LS(srv.Context(), req) - if err != nil { - return err - } - - var msg machineapi.FileInfo - - return copyClientServer(&msg, client, srv) -} - -// Mounts implements the machineapi.OSDServer interface. -func (c *MachineClient) Mounts(ctx context.Context, in *empty.Empty) (reply *machineapi.MountsReply, err error) { - return c.MachineClient.Mounts(ctx, in) -} diff --git a/internal/app/osd/internal/reg/network_client.go b/internal/app/osd/internal/reg/network_client.go deleted file mode 100644 index 23cc895fe..000000000 --- a/internal/app/osd/internal/reg/network_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 reg // nolint: dupl - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "google.golang.org/grpc" - - networkapi "github.com/talos-systems/talos/api/network" - "github.com/talos-systems/talos/pkg/constants" -) - -// NetworkClient is a gRPC client for init service API -type NetworkClient struct { - networkapi.NetworkClient -} - -// NewNetworkClient initializes new client and connects to networkd -func NewNetworkClient() (*NetworkClient, error) { - conn, err := grpc.Dial("unix:"+constants.NetworkdSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - - return &NetworkClient{ - NetworkClient: networkapi.NewNetworkClient(conn), - }, nil -} - -// Routes returns the hosts routing table. -func (c *NetworkClient) Routes(ctx context.Context, in *empty.Empty) (*networkapi.RoutesReply, error) { - return c.NetworkClient.Routes(ctx, in) -} - -// Interfaces returns the hosts network interfaces and addresses. -func (c *NetworkClient) Interfaces(ctx context.Context, in *empty.Empty) (*networkapi.InterfacesReply, error) { - return c.NetworkClient.Interfaces(ctx, in) -} diff --git a/internal/app/osd/internal/reg/reg.go b/internal/app/osd/internal/reg/reg.go index 5aa84d629..031dd1824 100644 --- a/internal/app/osd/internal/reg/reg.go +++ b/internal/app/osd/internal/reg/reg.go @@ -22,10 +22,7 @@ import ( "golang.org/x/sys/unix" "google.golang.org/grpc" - machineapi "github.com/talos-systems/talos/api/machine" - networkapi "github.com/talos-systems/talos/api/network" osapi "github.com/talos-systems/talos/api/os" - timeapi "github.com/talos-systems/talos/api/time" "github.com/talos-systems/talos/internal/pkg/containers" "github.com/talos-systems/talos/internal/pkg/containers/containerd" "github.com/talos-systems/talos/internal/pkg/containers/cri" @@ -36,19 +33,11 @@ import ( // Registrator is the concrete type that implements the factory.Registrator and // osapi.OSDServer interfaces. -type Registrator struct { - // every Init service API is proxied via OSD - *MachineClient - *TimeClient - *NetworkClient -} +type Registrator struct{} // Register implements the factory.Registrator interface. func (r *Registrator) Register(s *grpc.Server) { osapi.RegisterOSServer(s, r) - machineapi.RegisterMachineServer(s, r) - timeapi.RegisterTimeServer(s, r) - networkapi.RegisterNetworkServer(s, r) } // Kubeconfig implements the osapi.OSDServer interface. @@ -262,11 +251,6 @@ func (r *Registrator) Logs(req *osapi.LogsRequest, l osapi.OS_LogsServer) (err e return nil } -// Version implements the osapi.OSDServer interface. -func (r *Registrator) Version(ctx context.Context, in *empty.Empty) (reply *machineapi.VersionReply, err error) { - return r.MachineClient.Version(ctx, in) -} - // Processes implements the osapi.OSDServer interface func (r *Registrator) Processes(ctx context.Context, in *empty.Empty) (reply *osapi.ProcessesReply, err error) { procs, err := procfs.AllProcs() diff --git a/internal/app/osd/internal/reg/time_client.go b/internal/app/osd/internal/reg/time_client.go deleted file mode 100644 index 970058c24..000000000 --- a/internal/app/osd/internal/reg/time_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 reg // nolint: dupl - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "google.golang.org/grpc" - - timeapi "github.com/talos-systems/talos/api/time" - "github.com/talos-systems/talos/pkg/constants" -) - -// TimeClient is a gRPC client for init service API -type TimeClient struct { - timeapi.TimeClient -} - -// NewTimeClient initializes new client and connects to ntpd -func NewTimeClient() (*TimeClient, error) { - conn, err := grpc.Dial("unix:"+constants.NtpdSocketPath, - grpc.WithInsecure(), - ) - if err != nil { - return nil, err - } - - return &TimeClient{ - TimeClient: timeapi.NewTimeClient(conn), - }, nil -} - -// Time issues a query to the configured ntp server and displays the results -func (c *TimeClient) Time(ctx context.Context, in *empty.Empty) (*timeapi.TimeReply, error) { - return c.TimeClient.Time(ctx, in) -} - -// TimeCheck issues a query to the specified ntp server and displays the results -func (c *TimeClient) TimeCheck(ctx context.Context, in *timeapi.TimeRequest) (*timeapi.TimeReply, error) { - return c.TimeClient.TimeCheck(ctx, in) -} diff --git a/internal/app/osd/main.go b/internal/app/osd/main.go index 58a284a19..3d5edccab 100644 --- a/internal/app/osd/main.go +++ b/internal/app/osd/main.go @@ -5,131 +5,27 @@ package main import ( - "flag" "log" - stdlibnet "net" - "os" - "strings" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - osapi "github.com/talos-systems/talos/api/os" "github.com/talos-systems/talos/internal/app/osd/internal/reg" - "github.com/talos-systems/talos/pkg/config" "github.com/talos-systems/talos/pkg/constants" "github.com/talos-systems/talos/pkg/grpc/factory" - "github.com/talos-systems/talos/pkg/grpc/tls" - "github.com/talos-systems/talos/pkg/net" "github.com/talos-systems/talos/pkg/startup" ) -var ( - configPath *string - endpoints *string -) - func init() { log.SetFlags(log.Lshortfile | log.Ldate | log.Lmicroseconds | log.Ltime) - - configPath = flag.String("config", "", "the path to the config") - endpoints = flag.String("endpoints", "", "the IPs of the control plane nodes") - - flag.Parse() } -// nolint: gocyclo func main() { if err := startup.RandSeed(); err != nil { log.Fatalf("failed to seed RNG: %v", err) } - provider, err := createProvider() - if err != nil { - log.Fatalf("failed to create remote certificate provider: %+v", err) - } - - ca, err := provider.GetCA() - if err != nil { - log.Fatalf("failed to get root CA: %+v", err) - } - - tlsConfig, err := tls.New( - tls.WithClientAuthType(tls.Mutual), - tls.WithCACertPEM(ca), - tls.WithCertificateProvider(provider), + log.Fatalf("%+v", factory.ListenAndServe( + ®.Registrator{}, + factory.Network("unix"), + factory.SocketPath(constants.OSSocketPath), + ), ) - if err != nil { - log.Fatalf("failed to create OS-level TLS configuration: %v", err) - } - - machineClient, err := reg.NewMachineClient() - if err != nil { - log.Fatalf("init client: %v", err) - } - - timeClient, err := reg.NewTimeClient() - if err != nil { - log.Fatalf("ntp client: %v", err) - } - - networkClient, err := reg.NewNetworkClient() - if err != nil { - log.Fatalf("networkd client: %v", err) - } - - interceptorProvider, err := createProvider() - if err != nil { - log.Fatalf("failed to create remote certificate provider for interceptor: %+v", err) - } - - protoProxy := osapi.NewOSProxy(interceptorProvider) - - err = factory.ListenAndServe( - ®.Registrator{ - MachineClient: machineClient, - TimeClient: timeClient, - NetworkClient: networkClient, - }, - factory.Port(constants.OsdPort), - factory.ServerOptions( - grpc.Creds( - credentials.NewTLS(tlsConfig), - ), - grpc.UnaryInterceptor(protoProxy.UnaryInterceptor()), - ), - ) - if err != nil { - log.Fatalf("listen: %v", err) - } -} - -func createProvider() (tls.CertificateProvider, error) { - content, err := config.FromFile(*configPath) - if err != nil { - log.Fatalf("open config: %v", err) - } - - config, err := config.New(content) - if err != nil { - log.Fatalf("open config: %v", err) - } - - ips, err := net.IPAddrs() - if err != nil { - log.Fatalf("failed to discover IP addresses: %+v", err) - } - // TODO(andrewrynhard): Allow for DNS names. - for _, san := range config.Machine().Security().CertSANs() { - if ip := stdlibnet.ParseIP(san); ip != nil { - ips = append(ips, ip) - } - } - - hostname, err := os.Hostname() - if err != nil { - log.Fatalf("failed to discover hostname: %+v", err) - } - - return tls.NewRemoteRenewingFileCertificateProvider(config.Machine().Security().Token(), strings.Split(*endpoints, ","), constants.TrustdPort, hostname, ips) } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index d0079c6cc..8aa4a48ff 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -191,8 +191,8 @@ const ( // TalosConfigEnvVar is the environment variable for setting the Talos configuration file path. TalosConfigEnvVar = "TALOSCONFIG" - // InitSocketPath is the path to file socket of machine API. - InitSocketPath = SystemRunPath + "/init/init.sock" + // MachineSocketPath is the path to file socket of machine API. + MachineSocketPath = SystemRunPath + "/machined/machine.sock" // NtpdSocketPath is the path to file socket of time API. NtpdSocketPath = SystemRunPath + "/ntpd/ntpd.sock" @@ -200,6 +200,9 @@ const ( // NetworkdSocketPath is the path to file socket of network API. NetworkdSocketPath = SystemRunPath + "/networkd/networkd.sock" + // OSSocketPath is the path to file socket of os API. + OSSocketPath = SystemRunPath + "/osd/osd.sock" + // KernelAsset defines a well known name for our kernel filename KernelAsset = "vmlinuz"