diff --git a/Dockerfile b/Dockerfile index 909d51c3a..46e75a5c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ RUN curl -sfL https://github.com/uber/prototool/releases/download/v1.8.0/prototo 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 @@ -36,7 +37,8 @@ WORKDIR /src FROM build AS generate-build WORKDIR /osd COPY ./api/os ./proto -RUN protoc -I./proto --go_out=plugins=grpc:proto proto/api.proto +# Generate additional grpc functionality only for OSD +RUN protoc -I./proto --plugin=proxy --proxy_out=plugins=grpc+proxy:proto proto/api.proto WORKDIR /trustd COPY ./api/security ./proto RUN protoc -I./proto --go_out=plugins=grpc:proto proto/api.proto diff --git a/api/os/api.pb.go b/api/os/api.pb.go index b49a992d6..a7d4af831 100644 --- a/api/os/api.pb.go +++ b/api/os/api.pb.go @@ -7,10 +7,19 @@ 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" + + tls "github.com/talos-systems/talos/pkg/grpc/tls" ) // Reference imports to suppress errors if they are not otherwise used. @@ -24,6 +33,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// The request message containing the containerd namespace. type ContainerDriver int32 const ( @@ -49,7 +59,50 @@ func (ContainerDriver) EnumDescriptor() ([]byte, []int) { return fileDescriptor_00212fb1f9d3bf1c, []int{0} } -// The request message containing the containerd namespace. +// Common metadata message nested in all reply message types +type NodeMetadata struct { + Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeMetadata) Reset() { *m = NodeMetadata{} } +func (m *NodeMetadata) String() string { return proto.CompactTextString(m) } +func (*NodeMetadata) ProtoMessage() {} +func (*NodeMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{0} +} + +func (m *NodeMetadata) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NodeMetadata.Unmarshal(m, b) +} + +func (m *NodeMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NodeMetadata.Marshal(b, m, deterministic) +} + +func (m *NodeMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeMetadata.Merge(m, src) +} + +func (m *NodeMetadata) XXX_Size() int { + return xxx_messageInfo_NodeMetadata.Size(m) +} + +func (m *NodeMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_NodeMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeMetadata proto.InternalMessageInfo + +func (m *NodeMetadata) GetHostname() string { + if m != nil { + return m.Hostname + } + return "" +} + type ContainersRequest struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` // driver might be default "containerd" or "cri" @@ -63,7 +116,7 @@ func (m *ContainersRequest) Reset() { *m = ContainersRequest{} } func (m *ContainersRequest) String() string { return proto.CompactTextString(m) } func (*ContainersRequest) ProtoMessage() {} func (*ContainersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{0} + return fileDescriptor_00212fb1f9d3bf1c, []int{1} } func (m *ContainersRequest) XXX_Unmarshal(b []byte) error { @@ -102,50 +155,6 @@ func (m *ContainersRequest) GetDriver() ContainerDriver { return ContainerDriver_CONTAINERD } -// The response message containing the requested containers. -type ContainersReply struct { - Containers []*Container `protobuf:"bytes,1,rep,name=containers,proto3" json:"containers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContainersReply) Reset() { *m = ContainersReply{} } -func (m *ContainersReply) String() string { return proto.CompactTextString(m) } -func (*ContainersReply) ProtoMessage() {} -func (*ContainersReply) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{1} -} - -func (m *ContainersReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ContainersReply.Unmarshal(m, b) -} - -func (m *ContainersReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ContainersReply.Marshal(b, m, deterministic) -} - -func (m *ContainersReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainersReply.Merge(m, src) -} - -func (m *ContainersReply) XXX_Size() int { - return xxx_messageInfo_ContainersReply.Size(m) -} - -func (m *ContainersReply) XXX_DiscardUnknown() { - xxx_messageInfo_ContainersReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainersReply proto.InternalMessageInfo - -func (m *ContainersReply) GetContainers() []*Container { - if m != nil { - return m.Containers - } - return nil -} - // The response message containing the requested containers. type Container struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` @@ -238,283 +247,238 @@ func (m *Container) GetName() string { return "" } -// The request message containing the containerd namespace. -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=proto.ContainerDriver" json:"driver,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// The response message containing the requested containers. +type ContainerResponse struct { + Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Containers []*Container `protobuf:"bytes,2,rep,name=containers,proto3" json:"containers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *StatsRequest) Reset() { *m = StatsRequest{} } -func (m *StatsRequest) String() string { return proto.CompactTextString(m) } -func (*StatsRequest) ProtoMessage() {} -func (*StatsRequest) Descriptor() ([]byte, []int) { +func (m *ContainerResponse) Reset() { *m = ContainerResponse{} } +func (m *ContainerResponse) String() string { return proto.CompactTextString(m) } +func (*ContainerResponse) ProtoMessage() {} +func (*ContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptor_00212fb1f9d3bf1c, []int{3} } -func (m *StatsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatsRequest.Unmarshal(m, b) +func (m *ContainerResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContainerResponse.Unmarshal(m, b) } -func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatsRequest.Marshal(b, m, deterministic) +func (m *ContainerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContainerResponse.Marshal(b, m, deterministic) } -func (m *StatsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatsRequest.Merge(m, src) +func (m *ContainerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContainerResponse.Merge(m, src) } -func (m *StatsRequest) XXX_Size() int { - return xxx_messageInfo_StatsRequest.Size(m) +func (m *ContainerResponse) XXX_Size() int { + return xxx_messageInfo_ContainerResponse.Size(m) } -func (m *StatsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StatsRequest.DiscardUnknown(m) +func (m *ContainerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ContainerResponse.DiscardUnknown(m) } -var xxx_messageInfo_StatsRequest proto.InternalMessageInfo +var xxx_messageInfo_ContainerResponse proto.InternalMessageInfo -func (m *StatsRequest) GetNamespace() string { +func (m *ContainerResponse) GetMetadata() *NodeMetadata { if m != nil { - return m.Namespace - } - return "" -} - -func (m *StatsRequest) GetDriver() ContainerDriver { - if m != nil { - return m.Driver - } - return ContainerDriver_CONTAINERD -} - -// The response message containing the requested stats. -type StatsReply struct { - Stats []*Stat `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StatsReply) Reset() { *m = StatsReply{} } -func (m *StatsReply) String() string { return proto.CompactTextString(m) } -func (*StatsReply) ProtoMessage() {} -func (*StatsReply) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{4} -} - -func (m *StatsReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatsReply.Unmarshal(m, b) -} - -func (m *StatsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatsReply.Marshal(b, m, deterministic) -} - -func (m *StatsReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatsReply.Merge(m, src) -} - -func (m *StatsReply) XXX_Size() int { - return xxx_messageInfo_StatsReply.Size(m) -} - -func (m *StatsReply) XXX_DiscardUnknown() { - xxx_messageInfo_StatsReply.DiscardUnknown(m) -} - -var xxx_messageInfo_StatsReply proto.InternalMessageInfo - -func (m *StatsReply) GetStats() []*Stat { - if m != nil { - return m.Stats + return m.Metadata } return nil } -// The response message containing the requested stat. -type Stat 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"` - MemoryUsage uint64 `protobuf:"varint,4,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` - CpuUsage uint64 `protobuf:"varint,5,opt,name=cpu_usage,json=cpuUsage,proto3" json:"cpu_usage,omitempty"` - PodId string `protobuf:"bytes,6,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` - Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` +func (m *ContainerResponse) GetContainers() []*Container { + if m != nil { + return m.Containers + } + return nil +} + +type ContainersReply struct { + Response []*ContainerResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContainersReply) Reset() { *m = ContainersReply{} } +func (m *ContainersReply) String() string { return proto.CompactTextString(m) } +func (*ContainersReply) ProtoMessage() {} +func (*ContainersReply) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{4} +} + +func (m *ContainersReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContainersReply.Unmarshal(m, b) +} + +func (m *ContainersReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContainersReply.Marshal(b, m, deterministic) +} + +func (m *ContainersReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContainersReply.Merge(m, src) +} + +func (m *ContainersReply) XXX_Size() int { + return xxx_messageInfo_ContainersReply.Size(m) +} + +func (m *ContainersReply) XXX_DiscardUnknown() { + xxx_messageInfo_ContainersReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ContainersReply proto.InternalMessageInfo + +func (m *ContainersReply) GetResponse() []*ContainerResponse { + if m != nil { + return m.Response + } + return nil +} + +// The response message containing the requested logs. +type Data struct { + Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *Stat) Reset() { *m = Stat{} } -func (m *Stat) String() string { return proto.CompactTextString(m) } -func (*Stat) ProtoMessage() {} -func (*Stat) Descriptor() ([]byte, []int) { +func (m *Data) Reset() { *m = Data{} } +func (m *Data) String() string { return proto.CompactTextString(m) } +func (*Data) ProtoMessage() {} +func (*Data) Descriptor() ([]byte, []int) { return fileDescriptor_00212fb1f9d3bf1c, []int{5} } -func (m *Stat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Stat.Unmarshal(m, b) +func (m *Data) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Data.Unmarshal(m, b) } -func (m *Stat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Stat.Marshal(b, m, deterministic) +func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Data.Marshal(b, m, deterministic) } -func (m *Stat) XXX_Merge(src proto.Message) { - xxx_messageInfo_Stat.Merge(m, src) +func (m *Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_Data.Merge(m, src) } -func (m *Stat) XXX_Size() int { - return xxx_messageInfo_Stat.Size(m) +func (m *Data) XXX_Size() int { + return xxx_messageInfo_Data.Size(m) } -func (m *Stat) XXX_DiscardUnknown() { - xxx_messageInfo_Stat.DiscardUnknown(m) +func (m *Data) XXX_DiscardUnknown() { + xxx_messageInfo_Data.DiscardUnknown(m) } -var xxx_messageInfo_Stat proto.InternalMessageInfo +var xxx_messageInfo_Data proto.InternalMessageInfo -func (m *Stat) GetNamespace() string { +func (m *Data) GetBytes() []byte { if m != nil { - return m.Namespace + return m.Bytes } - return "" + return nil } -func (m *Stat) GetId() string { +type DataResponse struct { + Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Bytes *Data `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DataResponse) Reset() { *m = DataResponse{} } +func (m *DataResponse) String() string { return proto.CompactTextString(m) } +func (*DataResponse) ProtoMessage() {} +func (*DataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{6} +} + +func (m *DataResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DataResponse.Unmarshal(m, b) +} + +func (m *DataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DataResponse.Marshal(b, m, deterministic) +} + +func (m *DataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataResponse.Merge(m, src) +} + +func (m *DataResponse) XXX_Size() int { + return xxx_messageInfo_DataResponse.Size(m) +} + +func (m *DataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DataResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DataResponse proto.InternalMessageInfo + +func (m *DataResponse) GetMetadata() *NodeMetadata { if m != nil { - return m.Id + return m.Metadata } - return "" + return nil } -func (m *Stat) GetMemoryUsage() uint64 { +func (m *DataResponse) GetBytes() *Data { if m != nil { - return m.MemoryUsage + return m.Bytes } - return 0 + return nil } -func (m *Stat) GetCpuUsage() uint64 { - if m != nil { - return m.CpuUsage - } - return 0 -} - -func (m *Stat) GetPodId() string { - if m != nil { - return m.PodId - } - return "" -} - -func (m *Stat) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// The request message containing the process to restart. -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=proto.ContainerDriver" json:"driver,omitempty"` +type DataReply struct { + Response []*DataResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *RestartRequest) Reset() { *m = RestartRequest{} } -func (m *RestartRequest) String() string { return proto.CompactTextString(m) } -func (*RestartRequest) ProtoMessage() {} -func (*RestartRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{6} -} - -func (m *RestartRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RestartRequest.Unmarshal(m, b) -} - -func (m *RestartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RestartRequest.Marshal(b, m, deterministic) -} - -func (m *RestartRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RestartRequest.Merge(m, src) -} - -func (m *RestartRequest) XXX_Size() int { - return xxx_messageInfo_RestartRequest.Size(m) -} - -func (m *RestartRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RestartRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RestartRequest proto.InternalMessageInfo - -func (m *RestartRequest) GetNamespace() string { - if m != nil { - return m.Namespace - } - return "" -} - -func (m *RestartRequest) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *RestartRequest) GetDriver() ContainerDriver { - if m != nil { - return m.Driver - } - return ContainerDriver_CONTAINERD -} - -// The response message containing the restart status. -type RestartReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RestartReply) Reset() { *m = RestartReply{} } -func (m *RestartReply) String() string { return proto.CompactTextString(m) } -func (*RestartReply) ProtoMessage() {} -func (*RestartReply) Descriptor() ([]byte, []int) { +func (m *DataReply) Reset() { *m = DataReply{} } +func (m *DataReply) String() string { return proto.CompactTextString(m) } +func (*DataReply) ProtoMessage() {} +func (*DataReply) Descriptor() ([]byte, []int) { return fileDescriptor_00212fb1f9d3bf1c, []int{7} } -func (m *RestartReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RestartReply.Unmarshal(m, b) +func (m *DataReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DataReply.Unmarshal(m, b) } -func (m *RestartReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RestartReply.Marshal(b, m, deterministic) +func (m *DataReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DataReply.Marshal(b, m, deterministic) } -func (m *RestartReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_RestartReply.Merge(m, src) +func (m *DataReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataReply.Merge(m, src) } -func (m *RestartReply) XXX_Size() int { - return xxx_messageInfo_RestartReply.Size(m) +func (m *DataReply) XXX_Size() int { + return xxx_messageInfo_DataReply.Size(m) } -func (m *RestartReply) XXX_DiscardUnknown() { - xxx_messageInfo_RestartReply.DiscardUnknown(m) +func (m *DataReply) XXX_DiscardUnknown() { + xxx_messageInfo_DataReply.DiscardUnknown(m) } -var xxx_messageInfo_RestartReply proto.InternalMessageInfo +var xxx_messageInfo_DataReply proto.InternalMessageInfo + +func (m *DataReply) GetResponse() []*DataResponse { + if m != nil { + return m.Response + } + return nil +} // The request message containing the process name. type LogsRequest struct { @@ -577,50 +541,7 @@ func (m *LogsRequest) GetDriver() ContainerDriver { return ContainerDriver_CONTAINERD } -// The response message containing the requested logs. -type Data struct { - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Data) Reset() { *m = Data{} } -func (m *Data) String() string { return proto.CompactTextString(m) } -func (*Data) ProtoMessage() {} -func (*Data) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{9} -} - -func (m *Data) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Data.Unmarshal(m, b) -} - -func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Data.Marshal(b, m, deterministic) -} - -func (m *Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_Data.Merge(m, src) -} - -func (m *Data) XXX_Size() int { - return xxx_messageInfo_Data.Size(m) -} - -func (m *Data) XXX_DiscardUnknown() { - xxx_messageInfo_Data.DiscardUnknown(m) -} - -var xxx_messageInfo_Data proto.InternalMessageInfo - -func (m *Data) GetBytes() []byte { - if m != nil { - return m.Bytes - } - return nil -} - +// rpc processes type ProcessesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -631,7 +552,7 @@ func (m *ProcessesRequest) Reset() { *m = ProcessesRequest{} } func (m *ProcessesRequest) String() string { return proto.CompactTextString(m) } func (*ProcessesRequest) ProtoMessage() {} func (*ProcessesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{10} + return fileDescriptor_00212fb1f9d3bf1c, []int{9} } func (m *ProcessesRequest) XXX_Unmarshal(b []byte) error { @@ -657,17 +578,17 @@ func (m *ProcessesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ProcessesRequest proto.InternalMessageInfo type ProcessesReply struct { - Processes []*Process `protobuf:"bytes,1,rep,name=processes,proto3" json:"processes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Response []*ProcessResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ProcessesReply) Reset() { *m = ProcessesReply{} } func (m *ProcessesReply) String() string { return proto.CompactTextString(m) } func (*ProcessesReply) ProtoMessage() {} func (*ProcessesReply) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{11} + return fileDescriptor_00212fb1f9d3bf1c, []int{10} } func (m *ProcessesReply) XXX_Unmarshal(b []byte) error { @@ -692,7 +613,58 @@ func (m *ProcessesReply) XXX_DiscardUnknown() { var xxx_messageInfo_ProcessesReply proto.InternalMessageInfo -func (m *ProcessesReply) GetProcesses() []*Process { +func (m *ProcessesReply) GetResponse() []*ProcessResponse { + if m != nil { + return m.Response + } + return nil +} + +type ProcessResponse struct { + Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Processes []*Process `protobuf:"bytes,2,rep,name=processes,proto3" json:"processes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProcessResponse) Reset() { *m = ProcessResponse{} } +func (m *ProcessResponse) String() string { return proto.CompactTextString(m) } +func (*ProcessResponse) ProtoMessage() {} +func (*ProcessResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{11} +} + +func (m *ProcessResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProcessResponse.Unmarshal(m, b) +} + +func (m *ProcessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProcessResponse.Marshal(b, m, deterministic) +} + +func (m *ProcessResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProcessResponse.Merge(m, src) +} + +func (m *ProcessResponse) XXX_Size() int { + return xxx_messageInfo_ProcessResponse.Size(m) +} + +func (m *ProcessResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ProcessResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ProcessResponse proto.InternalMessageInfo + +func (m *ProcessResponse) GetMetadata() *NodeMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *ProcessResponse) GetProcesses() []*Process { if m != nil { return m.Processes } @@ -814,73 +786,471 @@ func (m *Process) GetArgs() string { return "" } +// rpc restart +// The request message containing the process to restart. +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=proto.ContainerDriver" json:"driver,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RestartRequest) Reset() { *m = RestartRequest{} } +func (m *RestartRequest) String() string { return proto.CompactTextString(m) } +func (*RestartRequest) ProtoMessage() {} +func (*RestartRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{13} +} + +func (m *RestartRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RestartRequest.Unmarshal(m, b) +} + +func (m *RestartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RestartRequest.Marshal(b, m, deterministic) +} + +func (m *RestartRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RestartRequest.Merge(m, src) +} + +func (m *RestartRequest) XXX_Size() int { + return xxx_messageInfo_RestartRequest.Size(m) +} + +func (m *RestartRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RestartRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_RestartRequest proto.InternalMessageInfo + +func (m *RestartRequest) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *RestartRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *RestartRequest) GetDriver() ContainerDriver { + if m != nil { + return m.Driver + } + return ContainerDriver_CONTAINERD +} + +type RestartResponse struct { + Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RestartResponse) Reset() { *m = RestartResponse{} } +func (m *RestartResponse) String() string { return proto.CompactTextString(m) } +func (*RestartResponse) ProtoMessage() {} +func (*RestartResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{14} +} + +func (m *RestartResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RestartResponse.Unmarshal(m, b) +} + +func (m *RestartResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RestartResponse.Marshal(b, m, deterministic) +} + +func (m *RestartResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RestartResponse.Merge(m, src) +} + +func (m *RestartResponse) XXX_Size() int { + return xxx_messageInfo_RestartResponse.Size(m) +} + +func (m *RestartResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RestartResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RestartResponse proto.InternalMessageInfo + +func (m *RestartResponse) GetMetadata() *NodeMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +// The response message containing the restart status. +type RestartReply struct { + Response []*RestartResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RestartReply) Reset() { *m = RestartReply{} } +func (m *RestartReply) String() string { return proto.CompactTextString(m) } +func (*RestartReply) ProtoMessage() {} +func (*RestartReply) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{15} +} + +func (m *RestartReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RestartReply.Unmarshal(m, b) +} + +func (m *RestartReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RestartReply.Marshal(b, m, deterministic) +} + +func (m *RestartReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_RestartReply.Merge(m, src) +} + +func (m *RestartReply) XXX_Size() int { + return xxx_messageInfo_RestartReply.Size(m) +} + +func (m *RestartReply) XXX_DiscardUnknown() { + xxx_messageInfo_RestartReply.DiscardUnknown(m) +} + +var xxx_messageInfo_RestartReply proto.InternalMessageInfo + +func (m *RestartReply) GetResponse() []*RestartResponse { + if m != nil { + return m.Response + } + return nil +} + +// The request message containing the containerd namespace. +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=proto.ContainerDriver" json:"driver,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatsRequest) Reset() { *m = StatsRequest{} } +func (m *StatsRequest) String() string { return proto.CompactTextString(m) } +func (*StatsRequest) ProtoMessage() {} +func (*StatsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{16} +} + +func (m *StatsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatsRequest.Unmarshal(m, b) +} + +func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatsRequest.Marshal(b, m, deterministic) +} + +func (m *StatsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatsRequest.Merge(m, src) +} + +func (m *StatsRequest) XXX_Size() int { + return xxx_messageInfo_StatsRequest.Size(m) +} + +func (m *StatsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StatsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StatsRequest proto.InternalMessageInfo + +func (m *StatsRequest) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *StatsRequest) GetDriver() ContainerDriver { + if m != nil { + return m.Driver + } + return ContainerDriver_CONTAINERD +} + +// The response message containing the requested stats. +type StatsResponse struct { + Metadata *NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Stats []*Stat `protobuf:"bytes,2,rep,name=stats,proto3" json:"stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatsResponse) Reset() { *m = StatsResponse{} } +func (m *StatsResponse) String() string { return proto.CompactTextString(m) } +func (*StatsResponse) ProtoMessage() {} +func (*StatsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{17} +} + +func (m *StatsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatsResponse.Unmarshal(m, b) +} + +func (m *StatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatsResponse.Marshal(b, m, deterministic) +} + +func (m *StatsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatsResponse.Merge(m, src) +} + +func (m *StatsResponse) XXX_Size() int { + return xxx_messageInfo_StatsResponse.Size(m) +} + +func (m *StatsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StatsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StatsResponse proto.InternalMessageInfo + +func (m *StatsResponse) GetMetadata() *NodeMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *StatsResponse) GetStats() []*Stat { + if m != nil { + return m.Stats + } + return nil +} + +type StatsReply struct { + Response []*StatsResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatsReply) Reset() { *m = StatsReply{} } +func (m *StatsReply) String() string { return proto.CompactTextString(m) } +func (*StatsReply) ProtoMessage() {} +func (*StatsReply) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{18} +} + +func (m *StatsReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatsReply.Unmarshal(m, b) +} + +func (m *StatsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatsReply.Marshal(b, m, deterministic) +} + +func (m *StatsReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatsReply.Merge(m, src) +} + +func (m *StatsReply) XXX_Size() int { + return xxx_messageInfo_StatsReply.Size(m) +} + +func (m *StatsReply) XXX_DiscardUnknown() { + xxx_messageInfo_StatsReply.DiscardUnknown(m) +} + +var xxx_messageInfo_StatsReply proto.InternalMessageInfo + +func (m *StatsReply) GetResponse() []*StatsResponse { + if m != nil { + return m.Response + } + return nil +} + +// The response message containing the requested stat. +type Stat 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"` + MemoryUsage uint64 `protobuf:"varint,4,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` + CpuUsage uint64 `protobuf:"varint,5,opt,name=cpu_usage,json=cpuUsage,proto3" json:"cpu_usage,omitempty"` + PodId string `protobuf:"bytes,6,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` + Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Stat) Reset() { *m = Stat{} } +func (m *Stat) String() string { return proto.CompactTextString(m) } +func (*Stat) ProtoMessage() {} +func (*Stat) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{19} +} + +func (m *Stat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Stat.Unmarshal(m, b) +} + +func (m *Stat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Stat.Marshal(b, m, deterministic) +} + +func (m *Stat) XXX_Merge(src proto.Message) { + xxx_messageInfo_Stat.Merge(m, src) +} + +func (m *Stat) XXX_Size() int { + return xxx_messageInfo_Stat.Size(m) +} + +func (m *Stat) XXX_DiscardUnknown() { + xxx_messageInfo_Stat.DiscardUnknown(m) +} + +var xxx_messageInfo_Stat proto.InternalMessageInfo + +func (m *Stat) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *Stat) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Stat) GetMemoryUsage() uint64 { + if m != nil { + return m.MemoryUsage + } + return 0 +} + +func (m *Stat) GetCpuUsage() uint64 { + if m != nil { + return m.CpuUsage + } + return 0 +} + +func (m *Stat) GetPodId() string { + if m != nil { + return m.PodId + } + return "" +} + +func (m *Stat) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func init() { proto.RegisterEnum("proto.ContainerDriver", ContainerDriver_name, ContainerDriver_value) + proto.RegisterType((*NodeMetadata)(nil), "proto.NodeMetadata") proto.RegisterType((*ContainersRequest)(nil), "proto.ContainersRequest") - proto.RegisterType((*ContainersReply)(nil), "proto.ContainersReply") proto.RegisterType((*Container)(nil), "proto.Container") - proto.RegisterType((*StatsRequest)(nil), "proto.StatsRequest") - proto.RegisterType((*StatsReply)(nil), "proto.StatsReply") - proto.RegisterType((*Stat)(nil), "proto.Stat") - proto.RegisterType((*RestartRequest)(nil), "proto.RestartRequest") - proto.RegisterType((*RestartReply)(nil), "proto.RestartReply") - proto.RegisterType((*LogsRequest)(nil), "proto.LogsRequest") + proto.RegisterType((*ContainerResponse)(nil), "proto.ContainerResponse") + proto.RegisterType((*ContainersReply)(nil), "proto.ContainersReply") proto.RegisterType((*Data)(nil), "proto.Data") + proto.RegisterType((*DataResponse)(nil), "proto.DataResponse") + proto.RegisterType((*DataReply)(nil), "proto.DataReply") + proto.RegisterType((*LogsRequest)(nil), "proto.LogsRequest") proto.RegisterType((*ProcessesRequest)(nil), "proto.ProcessesRequest") proto.RegisterType((*ProcessesReply)(nil), "proto.ProcessesReply") + proto.RegisterType((*ProcessResponse)(nil), "proto.ProcessResponse") proto.RegisterType((*Process)(nil), "proto.Process") + proto.RegisterType((*RestartRequest)(nil), "proto.RestartRequest") + proto.RegisterType((*RestartResponse)(nil), "proto.RestartResponse") + proto.RegisterType((*RestartReply)(nil), "proto.RestartReply") + proto.RegisterType((*StatsRequest)(nil), "proto.StatsRequest") + proto.RegisterType((*StatsResponse)(nil), "proto.StatsResponse") + proto.RegisterType((*StatsReply)(nil), "proto.StatsReply") + proto.RegisterType((*Stat)(nil), "proto.Stat") } func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } var fileDescriptor_00212fb1f9d3bf1c = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x5f, 0x6f, 0xfb, 0x34, - 0x14, 0x25, 0x6d, 0xd2, 0x2c, 0xb7, 0x5d, 0xd6, 0x79, 0xac, 0x0a, 0xdb, 0x84, 0xba, 0x48, 0x88, - 0x32, 0x4d, 0xe9, 0x18, 0xe2, 0x85, 0x87, 0x49, 0x5b, 0xbb, 0x87, 0x09, 0xd8, 0x26, 0x6f, 0xbc, - 0x20, 0xa4, 0xca, 0x4d, 0xbc, 0x62, 0xd1, 0x34, 0x26, 0x76, 0x26, 0xfa, 0x4d, 0x78, 0xe3, 0x85, - 0x8f, 0xc8, 0x07, 0x40, 0x76, 0x9c, 0xf4, 0x8f, 0x40, 0x6c, 0x0f, 0xfc, 0x9e, 0xea, 0x7b, 0xee, - 0xb1, 0xef, 0xcd, 0xf1, 0xf1, 0x2d, 0x78, 0x84, 0xb3, 0x88, 0xe7, 0x99, 0xcc, 0x90, 0xa3, 0x7f, - 0x8e, 0x8e, 0x67, 0x59, 0x36, 0x9b, 0xd3, 0xa1, 0x8e, 0xa6, 0xc5, 0xcb, 0x90, 0xa6, 0x5c, 0x2e, - 0x4b, 0x4e, 0x48, 0x60, 0x7f, 0x94, 0x2d, 0x24, 0x61, 0x0b, 0x9a, 0x0b, 0x4c, 0x7f, 0x2d, 0xa8, - 0x90, 0xe8, 0x04, 0xbc, 0x05, 0x49, 0xa9, 0xe0, 0x24, 0xa6, 0x81, 0xd5, 0xb7, 0x06, 0x1e, 0x5e, - 0x01, 0x28, 0x82, 0x56, 0x92, 0xb3, 0x57, 0x9a, 0x07, 0x8d, 0xbe, 0x35, 0xf0, 0x2f, 0x7b, 0xe5, - 0x51, 0x51, 0x7d, 0xce, 0x58, 0x67, 0xb1, 0x61, 0x85, 0x23, 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xbf, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x38, 0xf1, 0xb7, 0x21, 0xf2, 0x06, 0x00, 0x00, + // 886 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6f, 0xe3, 0x44, + 0x10, 0xc7, 0x49, 0x9c, 0xc4, 0x93, 0x34, 0xcd, 0x6d, 0x3f, 0x64, 0x72, 0x15, 0xea, 0x59, 0x42, + 0x94, 0x0a, 0xa5, 0x25, 0x7c, 0x3c, 0x20, 0x74, 0xd2, 0xb5, 0x39, 0xa1, 0x0a, 0xae, 0x3d, 0xed, + 0x1d, 0x2f, 0x08, 0xa9, 0xda, 0xd8, 0x7b, 0xb9, 0x15, 0xb1, 0x77, 0xf1, 0xae, 0x2b, 0xf2, 0x9f, + 0xf0, 0xc6, 0x0b, 0x7f, 0x27, 0x42, 0xfb, 0x61, 0xd7, 0x49, 0x0a, 0xb4, 0x87, 0xe0, 0xc9, 0x3b, + 0x33, 0xbf, 0x9d, 0xd9, 0x99, 0xfd, 0xcd, 0xac, 0x21, 0x20, 0x82, 0x8d, 0x45, 0xce, 0x15, 0x47, + 0xbe, 0xf9, 0x8c, 0x1e, 0xcf, 0x39, 0x9f, 0x2f, 0xe8, 0x89, 0x91, 0x66, 0xc5, 0x9b, 0x13, 0x9a, + 0x0a, 0xb5, 0xb4, 0x98, 0xe8, 0x18, 0xfa, 0x97, 0x3c, 0xa1, 0x2f, 0xa8, 0x22, 0x09, 0x51, 0x04, + 0x8d, 0xa0, 0xfb, 0x96, 0x4b, 0x95, 0x91, 0x94, 0x86, 0xde, 0xa1, 0x77, 0x14, 0xe0, 0x4a, 0x8e, + 0x08, 0x3c, 0x3a, 0xe7, 0x99, 0x22, 0x2c, 0xa3, 0xb9, 0xc4, 0xf4, 0xe7, 0x82, 0x4a, 0x85, 0x0e, + 0x20, 0xd0, 0x46, 0x29, 0x48, 0x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 0xf1, 0x74, 0xf8, 0x1e, 0xea, 0x40, 0xf3, + 0x1c, 0x5f, 0x0c, 0xbd, 0xc9, 0x1f, 0x0d, 0x68, 0x5c, 0xbd, 0x42, 0x4f, 0x01, 0x6e, 0x1f, 0x0b, + 0xb4, 0xf1, 0x2a, 0x94, 0xf7, 0x3d, 0xda, 0xbf, 0xc3, 0xa2, 0xcb, 0xf8, 0x29, 0xf8, 0xd3, 0x94, + 0xca, 0x39, 0xda, 0x1f, 0xdb, 0x3f, 0x88, 0x71, 0xf9, 0x07, 0x31, 0x7e, 0xae, 0xff, 0x20, 0x46, + 0xc3, 0x95, 0x19, 0xad, 0xb7, 0x7c, 0x09, 0xf0, 0x6d, 0x31, 0xa3, 0x31, 0xcf, 0xde, 0xb0, 0x87, + 0xec, 0xfb, 0x18, 0x5a, 0x7a, 0x9c, 0x23, 0xe4, 0x2c, 0xb5, 0xd9, 0x3e, 0xaa, 0x3f, 0x1e, 0xa7, + 0x1e, 0xfa, 0x0a, 0x82, 0x6a, 0xf0, 0xfe, 0x65, 0x84, 0xbd, 0xd5, 0x01, 0x58, 0x8e, 0xe8, 0x2f, + 0xa0, 0xe3, 0xda, 0x00, 0xed, 0xad, 0xb7, 0x85, 0x0d, 0xb6, 0xb3, 0xae, 0xb6, 0xaf, 0x93, 0x6f, + 0x88, 0x83, 0x76, 0x56, 0x69, 0x64, 0xb7, 0x3c, 0x5a, 0x55, 0x8a, 0xc5, 0xf2, 0xec, 0x40, 0x3f, + 0xec, 0xe9, 0x98, 0xcb, 0x31, 0x11, 0xec, 0xcc, 0xbf, 0x92, 0xcf, 0x04, 0x7b, 0xe9, 0xfd, 0xe0, + 0x73, 0x49, 0x04, 0x9b, 0xb5, 0x0d, 0xfe, 0xb3, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x04, 0x9c, + 0xcc, 0xe8, 0xaa, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -895,13 +1265,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type OSClient interface { - Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Data, error) - Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Data, error) - Logs(ctx context.Context, in *LogsRequest, opts ...grpc.CallOption) (OS_LogsClient, error) Containers(ctx context.Context, in *ContainersRequest, opts ...grpc.CallOption) (*ContainersReply, error) + Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) + Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) + Logs(ctx context.Context, in *LogsRequest, opts ...grpc.CallOption) (OS_LogsClient, error) + Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ProcessesReply, error) Restart(ctx context.Context, in *RestartRequest, opts ...grpc.CallOption) (*RestartReply, error) Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsReply, error) - Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ProcessesReply, error) } type oSClient struct { @@ -912,8 +1282,17 @@ func NewOSClient(cc *grpc.ClientConn) OSClient { return &oSClient{cc} } -func (c *oSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Data, error) { - out := new(Data) +func (c *oSClient) Containers(ctx context.Context, in *ContainersRequest, opts ...grpc.CallOption) (*ContainersReply, error) { + out := new(ContainersReply) + err := c.cc.Invoke(ctx, "/proto.OS/Containers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *oSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) { + out := new(DataReply) err := c.cc.Invoke(ctx, "/proto.OS/Dmesg", in, out, opts...) if err != nil { return nil, err @@ -921,8 +1300,8 @@ func (c *oSClient) Dmesg(ctx context.Context, in *empty.Empty, opts ...grpc.Call return out, nil } -func (c *oSClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Data, error) { - out := new(Data) +func (c *oSClient) Kubeconfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DataReply, error) { + out := new(DataReply) err := c.cc.Invoke(ctx, "/proto.OS/Kubeconfig", in, out, opts...) if err != nil { return nil, err @@ -962,9 +1341,9 @@ func (x *oSLogsClient) Recv() (*Data, error) { return m, nil } -func (c *oSClient) Containers(ctx context.Context, in *ContainersRequest, opts ...grpc.CallOption) (*ContainersReply, error) { - out := new(ContainersReply) - err := c.cc.Invoke(ctx, "/proto.OS/Containers", in, out, opts...) +func (c *oSClient) Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ProcessesReply, error) { + out := new(ProcessesReply) + err := c.cc.Invoke(ctx, "/proto.OS/Processes", in, out, opts...) if err != nil { return nil, err } @@ -989,30 +1368,71 @@ func (c *oSClient) Stats(ctx context.Context, in *StatsRequest, opts ...grpc.Cal return out, nil } -func (c *oSClient) Processes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ProcessesReply, error) { - out := new(ProcessesReply) - err := c.cc.Invoke(ctx, "/proto.OS/Processes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // OSServer is the server API for OS service. type OSServer interface { - Dmesg(context.Context, *empty.Empty) (*Data, error) - Kubeconfig(context.Context, *empty.Empty) (*Data, error) - Logs(*LogsRequest, OS_LogsServer) error Containers(context.Context, *ContainersRequest) (*ContainersReply, error) + Dmesg(context.Context, *empty.Empty) (*DataReply, error) + Kubeconfig(context.Context, *empty.Empty) (*DataReply, error) + Logs(*LogsRequest, OS_LogsServer) error + Processes(context.Context, *empty.Empty) (*ProcessesReply, error) Restart(context.Context, *RestartRequest) (*RestartReply, error) Stats(context.Context, *StatsRequest) (*StatsReply, error) - Processes(context.Context, *empty.Empty) (*ProcessesReply, 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) } +func _OS_Containers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ContainersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OSServer).Containers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.OS/Containers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OSServer).Containers(ctx, req.(*ContainersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _OS_Dmesg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(empty.Empty) if err := dec(in); err != nil { @@ -1070,20 +1490,20 @@ func (x *oSLogsServer) Send(m *Data) error { return x.ServerStream.SendMsg(m) } -func _OS_Containers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ContainersRequest) +func _OS_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(empty.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(OSServer).Containers(ctx, in) + return srv.(OSServer).Processes(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/proto.OS/Containers", + FullMethod: "/proto.OS/Processes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OSServer).Containers(ctx, req.(*ContainersRequest)) + return srv.(OSServer).Processes(ctx, req.(*empty.Empty)) } return interceptor(ctx, in, info, handler) } @@ -1124,28 +1544,14 @@ func _OS_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{ return interceptor(ctx, in, info, handler) } -func _OS_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OSServer).Processes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.OS/Processes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OSServer).Processes(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - var _OS_serviceDesc = grpc.ServiceDesc{ ServiceName: "proto.OS", HandlerType: (*OSServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Containers", + Handler: _OS_Containers_Handler, + }, { MethodName: "Dmesg", Handler: _OS_Dmesg_Handler, @@ -1155,8 +1561,8 @@ var _OS_serviceDesc = grpc.ServiceDesc{ Handler: _OS_Kubeconfig_Handler, }, { - MethodName: "Containers", - Handler: _OS_Containers_Handler, + MethodName: "Processes", + Handler: _OS_Processes_Handler, }, { MethodName: "Restart", @@ -1166,10 +1572,6 @@ var _OS_serviceDesc = grpc.ServiceDesc{ MethodName: "Stats", Handler: _OS_Stats_Handler, }, - { - MethodName: "Processes", - Handler: _OS_Processes_Handler, - }, }, Streams: []grpc.StreamDesc{ { @@ -1180,3 +1582,221 @@ var _OS_serviceDesc = grpc.ServiceDesc{ }, Metadata: "api.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 != "proto.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 "/proto.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 "/proto.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 "/proto.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 "/proto.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 "/proto.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 "/proto.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/api.proto b/api/os/api.proto index 82234460b..8a844369b 100644 --- a/api/os/api.proto +++ b/api/os/api.proto @@ -13,30 +13,34 @@ import "google/protobuf/empty.proto"; // // OS Service also implements all the API of Init Service service OS { - rpc Dmesg(google.protobuf.Empty) returns (Data); - rpc Kubeconfig(google.protobuf.Empty) returns (Data); - rpc Logs(LogsRequest) returns (stream Data); rpc Containers(ContainersRequest) returns (ContainersReply); + rpc Dmesg(google.protobuf.Empty) returns (DataReply); + rpc Kubeconfig(google.protobuf.Empty) returns (DataReply); + rpc Logs(LogsRequest) returns (stream Data); + rpc Processes(google.protobuf.Empty) returns (ProcessesReply); rpc Restart(RestartRequest) returns (RestartReply); rpc Stats(StatsRequest) returns (StatsReply); - rpc Processes(google.protobuf.Empty) returns (ProcessesReply); } +// Common metadata message nested in all reply message types +message NodeMetadata { + string hostname = 1; +} + +// rpc Containers + +// The request message containing the containerd namespace. enum ContainerDriver { CONTAINERD = 0; CRI = 1; } -// The request message containing the containerd namespace. message ContainersRequest { string namespace = 1; // driver might be default "containerd" or "cri" ContainerDriver driver = 2; } -// The response message containing the requested containers. -message ContainersReply { repeated Container containers = 1; } - // The response message containing the requested containers. message Container { string namespace = 1; @@ -48,36 +52,34 @@ message Container { string name = 7; } -// The request message containing the containerd namespace. -message StatsRequest { - string namespace = 1; - // driver might be default "containerd" or "cri" - ContainerDriver driver = 2; +// The response message containing the requested containers. +message ContainerResponse { + NodeMetadata metadata = 1; + repeated Container containers = 2; } -// The response message containing the requested stats. -message StatsReply { repeated Stat stats = 1; } - -// The response message containing the requested stat. -message Stat { - string namespace = 1; - string id = 2; - uint64 memory_usage = 4; - uint64 cpu_usage = 5; - string pod_id = 6; - string name = 7; +message ContainersReply { + repeated ContainerResponse response = 1; } -// The request message containing the process to restart. -message RestartRequest { - string namespace = 1; - string id = 2; - // driver might be default "containerd" or "cri" - ContainerDriver driver = 3; +// rpc dmesg +// rpc kubeconfig + +// The response message containing the requested logs. +message Data { + bytes bytes = 1; } -// The response message containing the restart status. -message RestartReply {} +message DataResponse { + NodeMetadata metadata = 1; + Data bytes = 2; +} + +message DataReply { + repeated DataResponse response = 1; +} + +// rpc logs // The request message containing the process name. message LogsRequest { @@ -87,12 +89,17 @@ message LogsRequest { ContainerDriver driver = 3; } -// The response message containing the requested logs. -message Data { bytes bytes = 1; } - +// rpc processes message ProcessesRequest {} -message ProcessesReply { repeated Process processes = 1; } +message ProcessesReply { + repeated ProcessResponse response = 1; +} + +message ProcessResponse { + NodeMetadata metadata = 1; + repeated Process processes = 2; +} message Process { int32 pid = 1; @@ -106,3 +113,51 @@ message Process { string executable = 9; string args = 10; } + +// rpc restart +// The request message containing the process to restart. +message RestartRequest { + string namespace = 1; + string id = 2; + // driver might be default "containerd" or "cri" + ContainerDriver driver = 3; +} + +message RestartResponse { + NodeMetadata metadata = 1; +} + +// The response message containing the restart status. +message RestartReply { + repeated RestartResponse response = 1; +} + +// rpc stats + +// The request message containing the containerd namespace. +message StatsRequest { + string namespace = 1; + // driver might be default "containerd" or "cri" + ContainerDriver driver = 2; +} + +// The response message containing the requested stats. +message StatsResponse { + NodeMetadata metadata = 1; + repeated Stat stats = 2; +} + +message StatsReply { + repeated StatsResponse response = 1; +} + +// The response message containing the requested stat. +message Stat { + string namespace = 1; + string id = 2; + uint64 memory_usage = 4; + uint64 cpu_usage = 5; + string pod_id = 6; + string name = 7; +} + diff --git a/cmd/osctl/cmd/config.go b/cmd/osctl/cmd/config.go index 7438cf691..54b873cfb 100644 --- a/cmd/osctl/cmd/config.go +++ b/cmd/osctl/cmd/config.go @@ -42,11 +42,6 @@ var configTargetCmd = &cobra.Command{ Short: "Set the target for the current context", Long: ``, Run: func(cmd *cobra.Command, args []string) { - if len(args) != 1 { - helpers.Should(cmd.Usage()) - os.Exit(1) - } - target = args[0] c, err := config.Open(talosconfig) if err != nil { helpers.Fatalf("error reading config: %s", err) @@ -54,7 +49,8 @@ var configTargetCmd = &cobra.Command{ if c.Context == "" { helpers.Fatalf("no context is set") } - c.Contexts[c.Context].Target = target + + c.Contexts[c.Context].Target = args[0] if err := c.Save(talosconfig); err != nil { helpers.Fatalf("error writing config: %s", err) } diff --git a/cmd/osctl/cmd/containers.go b/cmd/osctl/cmd/containers.go index 40623944c..0740a1d03 100644 --- a/cmd/osctl/cmd/containers.go +++ b/cmd/osctl/cmd/containers.go @@ -14,6 +14,7 @@ import ( criconstants "github.com/containerd/cri/pkg/constants" "github.com/spf13/cobra" + "google.golang.org/grpc/metadata" osapi "github.com/talos-systems/talos/api/os" "github.com/talos-systems/talos/cmd/osctl/pkg/client" @@ -44,7 +45,11 @@ var containersCmd = &cobra.Command{ if useCRI { driver = osapi.ContainerDriver_CRI } - reply, err := c.Containers(globalCtx, namespace, driver) + + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + + reply, err := c.Containers(metadata.NewOutgoingContext(globalCtx, md), namespace, driver) if err != nil { helpers.Fatalf("error getting process list: %s", err) } @@ -55,22 +60,25 @@ var containersCmd = &cobra.Command{ } func containerRender(reply *osapi.ContainersReply) { - sort.Slice(reply.Containers, - func(i, j int) bool { - return strings.Compare(reply.Containers[i].Id, reply.Containers[j].Id) < 0 - }) - w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) - fmt.Fprintln(w, "NAMESPACE\tID\tIMAGE\tPID\tSTATUS") + fmt.Fprintln(w, "NODE\tNAMESPACE\tID\tIMAGE\tPID\tSTATUS") - for _, p := range reply.Containers { - display := p.Id - if p.Id != p.PodId { - // container in a sandbox - display = "└─ " + display + for _, rep := range reply.Response { + resp := rep + sort.Slice(resp.Containers, + func(i, j int) bool { + return strings.Compare(resp.Containers[i].Id, resp.Containers[j].Id) < 0 + }) + + for _, p := range resp.Containers { + display := p.Id + if p.Id != p.PodId { + // container in a sandbox + display = "└─ " + display + } + + fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\n", resp.Metadata.Hostname, p.Namespace, display, p.Image, p.Pid, p.Status) } - - fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\n", p.Namespace, display, p.Image, p.Pid, p.Status) } helpers.Should(w.Flush()) diff --git a/cmd/osctl/cmd/dmesg.go b/cmd/osctl/cmd/dmesg.go index 397d1295c..7f429b1a5 100644 --- a/cmd/osctl/cmd/dmesg.go +++ b/cmd/osctl/cmd/dmesg.go @@ -5,9 +5,11 @@ package cmd import ( + "fmt" "os" "github.com/spf13/cobra" + "google.golang.org/grpc/metadata" "github.com/talos-systems/talos/cmd/osctl/pkg/client" "github.com/talos-systems/talos/cmd/osctl/pkg/helpers" @@ -25,13 +27,20 @@ var dmesgCmd = &cobra.Command{ } setupClient(func(c *client.Client) { - msg, err := c.Dmesg(globalCtx) + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + reply, err := c.Dmesg(metadata.NewOutgoingContext(globalCtx, md)) if err != nil { helpers.Fatalf("error getting dmesg: %s", err) } - _, err = os.Stdout.Write(msg) - helpers.Should(err) + for _, resp := range reply.Response { + if len(reply.Response) > 1 { + fmt.Println(resp.Metadata.Hostname) + } + _, err = os.Stdout.Write(resp.Bytes.Bytes) + helpers.Should(err) + } }) }, } diff --git a/cmd/osctl/cmd/kubeconfig.go b/cmd/osctl/cmd/kubeconfig.go index 855ed1bfa..a9c0808fb 100644 --- a/cmd/osctl/cmd/kubeconfig.go +++ b/cmd/osctl/cmd/kubeconfig.go @@ -6,9 +6,11 @@ package cmd import ( + "fmt" "os" "github.com/spf13/cobra" + "google.golang.org/grpc/metadata" "github.com/talos-systems/talos/cmd/osctl/pkg/client" "github.com/talos-systems/talos/cmd/osctl/pkg/helpers" @@ -26,12 +28,21 @@ var kubeconfigCmd = &cobra.Command{ } setupClient(func(c *client.Client) { - kubeconfig, err := c.Kubeconfig(globalCtx) + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + reply, err := c.Kubeconfig(metadata.NewOutgoingContext(globalCtx, md)) if err != nil { helpers.Fatalf("error fetching kubeconfig: %s", err) } - _, err = os.Stdout.Write(kubeconfig) - helpers.Should(err) + + for _, resp := range reply.Response { + if len(reply.Response) > 1 { + fmt.Println(resp.Metadata.Hostname) + } + + _, err = os.Stdout.Write(resp.Bytes.Bytes) + helpers.Should(err) + } }) }, } diff --git a/cmd/osctl/cmd/processes.go b/cmd/osctl/cmd/processes.go index 945162d69..e1b2fb7f6 100644 --- a/cmd/osctl/cmd/processes.go +++ b/cmd/osctl/cmd/processes.go @@ -20,6 +20,7 @@ import ( "github.com/ryanuber/columnize" "github.com/spf13/cobra" "golang.org/x/crypto/ssh/terminal" + "google.golang.org/grpc/metadata" osapi "github.com/talos-systems/talos/api/os" "github.com/talos-systems/talos/cmd/osctl/pkg/client" @@ -44,17 +45,26 @@ var processesCmd = &cobra.Command{ setupClient(func(c *client.Client) { var err error + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + switch { case watchProcesses: + // Only allow single node view refresh.. + // No hard limitiation that I can think of to prevent aggregating all nodes + if len(target) > 1 { + md.Set("targets", target[0]) + } + if err = ui.Init(); err != nil { log.Fatalf("failed to initialize termui: %v", err) } defer ui.Close() - processesUI(globalCtx, c) + processesUI(metadata.NewOutgoingContext(globalCtx, md), c) default: var output string - output, err = processesOutput(globalCtx, c) + output, err = processesOutput(metadata.NewOutgoingContext(globalCtx, md), c) helpers.Should(err) // Note this is unlimited output of process lines // we arent artificially limited by the box we would otherwise draw @@ -178,33 +188,36 @@ func processesOutput(ctx context.Context, c *client.Client) (output string, err return output, nil } - procs := reply.Processes + s := []string{} - switch sortMethod { - case "cpu": - by(cpu).sort(procs) - default: - by(rss).sort(procs) - } + s = append(s, "NODE | PID | STATE | THREADS | CPU-TIME | VIRTMEM | RESMEM | COMMAND") - s := make([]string, 0, len(procs)) - s = append(s, "PID | STATE | THREADS | CPU-TIME | VIRTMEM | RESMEM | COMMAND") + for _, resp := range reply.Response { + procs := resp.Processes - var args string - - for _, p := range procs { - switch { - case p.Executable == "": - args = p.Command - case p.Args != "" && strings.Fields(p.Args)[0] == filepath.Base(strings.Fields(p.Executable)[0]): - args = strings.Replace(p.Args, strings.Fields(p.Args)[0], p.Executable, 1) + switch sortMethod { + case "cpu": + by(cpu).sort(procs) default: - args = p.Args + by(rss).sort(procs) } - s = append(s, - fmt.Sprintf("%6d | %1s | %4d | %8.2f | %7s | %7s | %s", - p.Pid, p.State, p.Threads, p.CpuTime, bytefmt.ByteSize(p.VirtualMemory), bytefmt.ByteSize(p.ResidentMemory), args)) + var args string + + for _, p := range procs { + switch { + case p.Executable == "": + args = p.Command + case p.Args != "" && strings.Fields(p.Args)[0] == filepath.Base(strings.Fields(p.Executable)[0]): + args = strings.Replace(p.Args, strings.Fields(p.Args)[0], p.Executable, 1) + default: + args = p.Args + } + + s = append(s, + fmt.Sprintf("%12s | %6d | %1s | %4d | %8.2f | %7s | %7s | %s", + resp.Metadata.Hostname, p.Pid, p.State, p.Threads, p.CpuTime, bytefmt.ByteSize(p.VirtualMemory), bytefmt.ByteSize(p.ResidentMemory), args)) + } } return columnize.SimpleFormat(s), err diff --git a/cmd/osctl/cmd/root.go b/cmd/osctl/cmd/root.go index 0142bb10a..b81ba9b0b 100644 --- a/cmd/osctl/cmd/root.go +++ b/cmd/osctl/cmd/root.go @@ -34,7 +34,7 @@ var ( organization string rsa bool talosconfig string - target string + target []string ) // rootCmd represents the base command when called without any subcommands @@ -96,7 +96,7 @@ func Execute() { } rootCmd.PersistentFlags().StringVar(&talosconfig, "talosconfig", defaultTalosConfig, "The path to the Talos configuration file") - rootCmd.PersistentFlags().StringVarP(&target, "target", "t", "", "target the specificed node") + rootCmd.PersistentFlags().StringSliceVarP(&target, "target", "t", []string{}, "target the specificed node") if err := rootCmd.Execute(); err != nil { helpers.Fatalf("%s", err) @@ -110,10 +110,6 @@ func setupClient(action func(*client.Client)) { helpers.Fatalf("error getting client credentials: %s", err) } - if target != "" { - t = target - } - c, err := client.NewClient(creds, t, constants.OsdPort) if err != nil { helpers.Fatalf("error constructing client: %s", err) diff --git a/cmd/osctl/cmd/stats.go b/cmd/osctl/cmd/stats.go index edbae8851..ae9d29328 100644 --- a/cmd/osctl/cmd/stats.go +++ b/cmd/osctl/cmd/stats.go @@ -14,6 +14,7 @@ import ( criconstants "github.com/containerd/cri/pkg/constants" "github.com/spf13/cobra" + "google.golang.org/grpc/metadata" osapi "github.com/talos-systems/talos/api/os" "github.com/talos-systems/talos/cmd/osctl/pkg/client" @@ -43,7 +44,9 @@ var statsCmd = &cobra.Command{ if useCRI { driver = osapi.ContainerDriver_CRI } - reply, err := c.Stats(globalCtx, namespace, driver) + md := metadata.New(make(map[string]string)) + md.Set("targets", target...) + reply, err := c.Stats(metadata.NewOutgoingContext(globalCtx, md), namespace, driver) if err != nil { helpers.Fatalf("error getting stats: %s", err) } @@ -54,22 +57,26 @@ var statsCmd = &cobra.Command{ } func statsRender(reply *osapi.StatsReply) { - sort.Slice(reply.Stats, - func(i, j int) bool { - return strings.Compare(reply.Stats[i].Id, reply.Stats[j].Id) < 0 - }) - w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) - fmt.Fprintln(w, "NAMESPACE\tID\tMEMORY(MB)\tCPU") - for _, s := range reply.Stats { - display := s.Id - if s.Id != s.PodId { - // container in a sandbox - display = "└─ " + display + fmt.Fprintln(w, "NODE\tNAMESPACE\tID\tMEMORY(MB)\tCPU") + + for _, rep := range reply.Response { + resp := rep + sort.Slice(resp.Stats, + func(i, j int) bool { + return strings.Compare(resp.Stats[i].Id, resp.Stats[j].Id) < 0 + }) + + for _, s := range resp.Stats { + display := s.Id + if s.Id != s.PodId { + // container in a sandbox + display = "└─ " + display + } + + fmt.Fprintf(w, "%s\t%s\t%s\t%.2f\t%d\n", resp.Metadata.Hostname, s.Namespace, display, float64(s.MemoryUsage)*1e-6, s.CpuUsage) } - - fmt.Fprintf(w, "%s\t%s\t%.2f\t%d\n", s.Namespace, display, float64(s.MemoryUsage)*1e-6, s.CpuUsage) } helpers.Should(w.Flush()) diff --git a/cmd/osctl/pkg/client/client.go b/cmd/osctl/pkg/client/client.go index 123881526..9f36e091e 100644 --- a/cmd/osctl/pkg/client/client.go +++ b/cmd/osctl/pkg/client/client.go @@ -145,13 +145,8 @@ func (c *Client) Close() error { } // Kubeconfig implements the proto.OSClient interface. -func (c *Client) Kubeconfig(ctx context.Context) ([]byte, error) { - r, err := c.client.Kubeconfig(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - - return r.Bytes, nil +func (c *Client) Kubeconfig(ctx context.Context) (*osapi.DataReply, error) { + return c.client.Kubeconfig(ctx, &empty.Empty{}) } // Stats implements the proto.OSClient interface. @@ -204,13 +199,8 @@ func (c *Client) Shutdown(ctx context.Context) (err error) { } // Dmesg implements the proto.OSClient interface. -func (c *Client) Dmesg(ctx context.Context) ([]byte, error) { - data, err := c.client.Dmesg(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - - return data.Bytes, nil +func (c *Client) Dmesg(ctx context.Context) (*osapi.DataReply, error) { + return c.client.Dmesg(ctx, &empty.Empty{}) } // Logs implements the proto.OSClient interface. diff --git a/hack/test/basic-integration.sh b/hack/test/basic-integration.sh index ee24a41c3..c6cdec210 100755 --- a/hack/test/basic-integration.sh +++ b/hack/test/basic-integration.sh @@ -91,6 +91,7 @@ run "kubectl wait --timeout=${TIMEOUT}s --for=condition=ready=true pod -l k8s-ap # Wait for DNS addon to report ready run "kubectl wait --timeout=${TIMEOUT}s --for=condition=ready=true pod -l k8s-app=kube-dns -n kube-system" -run "osctl -t 10.5.0.2 service etcd | grep Running" -run "osctl -t 10.5.0.3 service etcd | grep Running" -run "osctl -t 10.5.0.4 service etcd | grep Running" +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" diff --git a/internal/app/osd/internal/reg/reg.go b/internal/app/osd/internal/reg/reg.go index 6216a0a0c..5aa84d629 100644 --- a/internal/app/osd/internal/reg/reg.go +++ b/internal/app/osd/internal/reg/reg.go @@ -52,14 +52,18 @@ func (r *Registrator) Register(s *grpc.Server) { } // Kubeconfig implements the osapi.OSDServer interface. -func (r *Registrator) Kubeconfig(ctx context.Context, in *empty.Empty) (data *osapi.Data, err error) { +func (r *Registrator) Kubeconfig(ctx context.Context, in *empty.Empty) (data *osapi.DataReply, err error) { fileBytes, err := ioutil.ReadFile(constants.AdminKubeconfig) if err != nil { return } - data = &osapi.Data{ - Bytes: fileBytes, + data = &osapi.DataReply{ + Response: []*osapi.DataResponse{ + { + Bytes: &osapi.Data{Bytes: fileBytes}, + }, + }, } return data, err @@ -101,7 +105,15 @@ func (r *Registrator) Containers(ctx context.Context, in *osapi.ContainersReques } } - return &osapi.ContainersReply{Containers: containers}, nil + reply = &osapi.ContainersReply{ + Response: []*osapi.ContainerResponse{ + { + Containers: containers, + }, + }, + } + + return reply, nil } // Stats implements the osapi.OSDServer interface. @@ -145,7 +157,13 @@ func (r *Registrator) Stats(ctx context.Context, in *osapi.StatsRequest) (reply } } - reply = &osapi.StatsReply{Stats: stats} + reply = &osapi.StatsReply{ + Response: []*osapi.StatsResponse{ + { + Stats: stats, + }, + }, + } return reply, nil } @@ -180,7 +198,7 @@ func (r *Registrator) Restart(ctx context.Context, in *osapi.RestartRequest) (*o // to read from the ring buffer at /proc/kmsg by taking the // SYSLOG_ACTION_READ_ALL action. This action reads all messages remaining in // the ring buffer non-destructively. -func (r *Registrator) Dmesg(ctx context.Context, in *empty.Empty) (data *osapi.Data, err error) { +func (r *Registrator) Dmesg(ctx context.Context, in *empty.Empty) (data *osapi.DataReply, err error) { // Return the size of the kernel ring buffer size, err := unix.Klogctl(constants.SYSLOG_ACTION_SIZE_BUFFER, nil) if err != nil { @@ -194,7 +212,13 @@ func (r *Registrator) Dmesg(ctx context.Context, in *empty.Empty) (data *osapi.D return } - data = &osapi.Data{Bytes: buf[:n]} + data = &osapi.DataReply{ + Response: []*osapi.DataResponse{ + { + Bytes: &osapi.Data{Bytes: buf[:n]}, + }, + }, + } return data, err } @@ -296,7 +320,13 @@ func (r *Registrator) Processes(ctx context.Context, in *empty.Empty) (reply *os processes = append(processes, p) } - reply = &osapi.ProcessesReply{Processes: processes} + reply = &osapi.ProcessesReply{ + Response: []*osapi.ProcessResponse{ + { + Processes: processes, + }, + }, + } return reply, nil } diff --git a/internal/app/osd/main.go b/internal/app/osd/main.go index 213d022a9..58a284a19 100644 --- a/internal/app/osd/main.go +++ b/internal/app/osd/main.go @@ -14,6 +14,7 @@ import ( "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" @@ -43,35 +44,7 @@ func main() { log.Fatalf("failed to seed RNG: %v", err) } - 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) - } - - var provider tls.CertificateProvider - - provider, err = tls.NewRemoteRenewingFileCertificateProvider(config.Machine().Security().Token(), strings.Split(*endpoints, ","), constants.TrustdPort, hostname, ips) + provider, err := createProvider() if err != nil { log.Fatalf("failed to create remote certificate provider: %+v", err) } @@ -105,6 +78,13 @@ func main() { 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, @@ -116,9 +96,40 @@ func main() { 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) +}