diff --git a/go/vt/proto/vtadmin/vtadmin.pb.go b/go/vt/proto/vtadmin/vtadmin.pb.go index 43248ccc06e..03ff0f561f3 100644 --- a/go/vt/proto/vtadmin/vtadmin.pb.go +++ b/go/vt/proto/vtadmin/vtadmin.pb.go @@ -336,6 +336,77 @@ func (m *VTGate) GetKeyspaces() []string { return nil } +// Request/Response types +type GetClustersRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetClustersRequest) Reset() { *m = GetClustersRequest{} } +func (m *GetClustersRequest) String() string { return proto.CompactTextString(m) } +func (*GetClustersRequest) ProtoMessage() {} +func (*GetClustersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{5} +} + +func (m *GetClustersRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetClustersRequest.Unmarshal(m, b) +} +func (m *GetClustersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetClustersRequest.Marshal(b, m, deterministic) +} +func (m *GetClustersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetClustersRequest.Merge(m, src) +} +func (m *GetClustersRequest) XXX_Size() int { + return xxx_messageInfo_GetClustersRequest.Size(m) +} +func (m *GetClustersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetClustersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetClustersRequest proto.InternalMessageInfo + +type GetClustersResponse struct { + Clusters []*Cluster `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetClustersResponse) Reset() { *m = GetClustersResponse{} } +func (m *GetClustersResponse) String() string { return proto.CompactTextString(m) } +func (*GetClustersResponse) ProtoMessage() {} +func (*GetClustersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{6} +} + +func (m *GetClustersResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetClustersResponse.Unmarshal(m, b) +} +func (m *GetClustersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetClustersResponse.Marshal(b, m, deterministic) +} +func (m *GetClustersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetClustersResponse.Merge(m, src) +} +func (m *GetClustersResponse) XXX_Size() int { + return xxx_messageInfo_GetClustersResponse.Size(m) +} +func (m *GetClustersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetClustersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetClustersResponse proto.InternalMessageInfo + +func (m *GetClustersResponse) GetClusters() []*Cluster { + if m != nil { + return m.Clusters + } + return nil +} + type GetGatesRequest struct { ClusterIds []string `protobuf:"bytes,1,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -347,7 +418,7 @@ func (m *GetGatesRequest) Reset() { *m = GetGatesRequest{} } func (m *GetGatesRequest) String() string { return proto.CompactTextString(m) } func (*GetGatesRequest) ProtoMessage() {} func (*GetGatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{5} + return fileDescriptor_609739e22a0a50b3, []int{7} } func (m *GetGatesRequest) XXX_Unmarshal(b []byte) error { @@ -386,7 +457,7 @@ func (m *GetGatesResponse) Reset() { *m = GetGatesResponse{} } func (m *GetGatesResponse) String() string { return proto.CompactTextString(m) } func (*GetGatesResponse) ProtoMessage() {} func (*GetGatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{6} + return fileDescriptor_609739e22a0a50b3, []int{8} } func (m *GetGatesResponse) XXX_Unmarshal(b []byte) error { @@ -425,7 +496,7 @@ func (m *GetKeyspacesRequest) Reset() { *m = GetKeyspacesRequest{} } func (m *GetKeyspacesRequest) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesRequest) ProtoMessage() {} func (*GetKeyspacesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{7} + return fileDescriptor_609739e22a0a50b3, []int{9} } func (m *GetKeyspacesRequest) XXX_Unmarshal(b []byte) error { @@ -464,7 +535,7 @@ func (m *GetKeyspacesResponse) Reset() { *m = GetKeyspacesResponse{} } func (m *GetKeyspacesResponse) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesResponse) ProtoMessage() {} func (*GetKeyspacesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{8} + return fileDescriptor_609739e22a0a50b3, []int{10} } func (m *GetKeyspacesResponse) XXX_Unmarshal(b []byte) error { @@ -507,7 +578,7 @@ func (m *GetTabletRequest) Reset() { *m = GetTabletRequest{} } func (m *GetTabletRequest) String() string { return proto.CompactTextString(m) } func (*GetTabletRequest) ProtoMessage() {} func (*GetTabletRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{9} + return fileDescriptor_609739e22a0a50b3, []int{11} } func (m *GetTabletRequest) XXX_Unmarshal(b []byte) error { @@ -553,7 +624,7 @@ func (m *GetTabletsRequest) Reset() { *m = GetTabletsRequest{} } func (m *GetTabletsRequest) String() string { return proto.CompactTextString(m) } func (*GetTabletsRequest) ProtoMessage() {} func (*GetTabletsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{10} + return fileDescriptor_609739e22a0a50b3, []int{12} } func (m *GetTabletsRequest) XXX_Unmarshal(b []byte) error { @@ -592,7 +663,7 @@ func (m *GetTabletsResponse) Reset() { *m = GetTabletsResponse{} } func (m *GetTabletsResponse) String() string { return proto.CompactTextString(m) } func (*GetTabletsResponse) ProtoMessage() {} func (*GetTabletsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{11} + return fileDescriptor_609739e22a0a50b3, []int{13} } func (m *GetTabletsResponse) XXX_Unmarshal(b []byte) error { @@ -627,6 +698,8 @@ func init() { proto.RegisterType((*Tablet)(nil), "vtadmin.Tablet") proto.RegisterType((*Vtctld)(nil), "vtadmin.Vtctld") proto.RegisterType((*VTGate)(nil), "vtadmin.VTGate") + proto.RegisterType((*GetClustersRequest)(nil), "vtadmin.GetClustersRequest") + proto.RegisterType((*GetClustersResponse)(nil), "vtadmin.GetClustersResponse") proto.RegisterType((*GetGatesRequest)(nil), "vtadmin.GetGatesRequest") proto.RegisterType((*GetGatesResponse)(nil), "vtadmin.GetGatesResponse") proto.RegisterType((*GetKeyspacesRequest)(nil), "vtadmin.GetKeyspacesRequest") @@ -639,43 +712,46 @@ func init() { func init() { proto.RegisterFile("vtadmin.proto", fileDescriptor_609739e22a0a50b3) } var fileDescriptor_609739e22a0a50b3 = []byte{ - // 568 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x8f, 0xd2, 0x40, - 0x10, 0xa6, 0x3d, 0xa0, 0x30, 0x3d, 0x81, 0x9b, 0xf3, 0xa1, 0x56, 0x8c, 0xa4, 0x51, 0x83, 0x26, - 0xb6, 0x49, 0x35, 0x26, 0x3c, 0x99, 0xd3, 0x98, 0xe6, 0x72, 0x11, 0x4c, 0x41, 0x4c, 0x7c, 0xb9, - 0xf4, 0xe8, 0x06, 0x1b, 0x7b, 0x14, 0xd9, 0x3d, 0x12, 0xff, 0x88, 0xaf, 0xfe, 0x22, 0xff, 0x93, - 0xe9, 0xee, 0x76, 0x29, 0x70, 0xde, 0x9d, 0x6f, 0xbb, 0x33, 0xf3, 0xcd, 0xf7, 0x7d, 0x33, 0x9b, - 0x85, 0x7b, 0x6b, 0x16, 0xc5, 0x97, 0xc9, 0xc2, 0x5d, 0xae, 0x32, 0x96, 0xa1, 0x21, 0xaf, 0x76, - 0x8b, 0x65, 0xcb, 0x2c, 0x8e, 0x58, 0x24, 0x12, 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3e, 0xd0, 0x52, 0x88, 0x9d, 0xb5, 0xda, 0x0f, 0xae, 0xc9, 0x08, 0x5e, - 0xa7, 0x82, 0x1f, 0xe1, 0xb0, 0x3c, 0x5f, 0xec, 0x96, 0x8b, 0x77, 0xd7, 0x65, 0x3f, 0xfa, 0x47, - 0x56, 0xb5, 0x1b, 0x40, 0x53, 0xd9, 0xc3, 0x2d, 0xe2, 0xad, 0xc9, 0xdb, 0xbb, 0xfe, 0x9c, 0x0a, - 0x06, 0x00, 0x9b, 0xc9, 0xa0, 0xbd, 0x8f, 0x55, 0x2a, 0x1e, 0x5e, 0x9b, 0x2b, 0x34, 0xbc, 0x7b, - 0xf6, 0xf5, 0xc9, 0x3a, 0x61, 0x84, 0x52, 0x37, 0xc9, 0x3c, 0x71, 0xf2, 0xe6, 0x99, 0xb7, 0x66, - 0x1e, 0xff, 0x4c, 0x3d, 0x09, 0xbe, 0xa8, 0xf3, 0xeb, 0xab, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x9a, 0xe6, 0x88, 0x48, 0x96, 0x05, 0x00, 0x00, + // 611 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdf, 0x6e, 0xd3, 0x3e, + 0x14, 0x5e, 0xb2, 0xb6, 0x69, 0x4e, 0xf6, 0x6b, 0x3b, 0x6f, 0x17, 0xf9, 0x65, 0x45, 0x54, 0x16, + 0xa0, 0x82, 0x20, 0x91, 0x02, 0x42, 0xea, 0x15, 0x1a, 0x13, 0x8a, 0xc6, 0x44, 0x8b, 0xd2, 0x52, + 0x24, 0x6e, 0xa6, 0xac, 0xb1, 0x4a, 0x44, 0xd6, 0x94, 0xda, 0xab, 0xc4, 0x8b, 0xf0, 0x56, 0x3c, + 0x09, 0x2f, 0x81, 0x62, 0x3b, 0x6e, 0xfa, 0x87, 0x6d, 0xdc, 0xd9, 0xe7, 0xcf, 0xf7, 0x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82, 0x92, 0x95, 0x03, 0xae, 0x5d, 0xbe, + 0x5c, 0xc9, 0x7e, 0xdb, 0xb2, 0x37, 0x94, 0xe9, 0x5b, 0xca, 0x5e, 0xc1, 0xa1, 0x02, 0xbc, 0xff, + 0x3c, 0x6f, 0xf8, 0x46, 0x55, 0x97, 0x9c, 0xe6, 0x29, 0x18, 0xe2, 0x5b, 0xda, 0xb6, 0x51, 0x2a, + 0x2e, 0xf2, 0xfe, 0x6f, 0x1d, 0x8c, 0xf1, 0xe8, 0x34, 0xcf, 0xa1, 0xf7, 0x60, 0x95, 0x1e, 0x02, + 0x3a, 0x51, 0x4d, 0xdb, 0x8f, 0xc6, 0x69, 0xef, 0x4e, 0x0a, 0x01, 0x78, 0x0f, 0x9d, 0x42, 0xbd, + 0xd8, 0x2d, 0xb2, 0xcb, 0xb5, 0xe5, 0x27, 0xe2, 0xfc, 0xbf, 0x23, 0xa3, 0x20, 0x3e, 0xc0, 0x41, + 0x79, 0x57, 0x68, 0x8d, 0x72, 0x73, 0xf5, 0xce, 0x83, 0xbf, 0x64, 0x15, 0x5c, 0x0f, 0x4c, 0x65, + 0x15, 0x5a, 0x23, 0x5e, 0xdb, 0xa2, 0xb3, 0xe9, 0x15, 0xde, 0x43, 0x01, 0xc0, 0xca, 0x65, 0xe4, + 0x6c, 0xf7, 0x2a, 0x15, 0x27, 0x3b, 0x73, 0x85, 0x86, 0xb7, 0x4f, 0xbe, 0x3c, 0x5a, 0x26, 0x8c, + 0x50, 0xea, 0x26, 0x99, 0x27, 0x4e, 0xde, 0x34, 0xf3, 0x96, 0xcc, 0xe3, 0xff, 0x7c, 0x4f, 0x36, + 0x5f, 0xd5, 0xf8, 0xf5, 0xe5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x56, 0xa5, 0x48, 0x3d, + 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -690,6 +766,8 @@ 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 VTAdminClient interface { + // GetClusters returns all configured clusters. + GetClusters(ctx context.Context, in *GetClustersRequest, opts ...grpc.CallOption) (*GetClustersResponse, error) // GetGates returns all gates across all the specified clusters. GetGates(ctx context.Context, in *GetGatesRequest, opts ...grpc.CallOption) (*GetGatesResponse, error) // GetKeyspaces returns all keyspaces across the specified clusters. @@ -709,6 +787,15 @@ func NewVTAdminClient(cc *grpc.ClientConn) VTAdminClient { return &vTAdminClient{cc} } +func (c *vTAdminClient) GetClusters(ctx context.Context, in *GetClustersRequest, opts ...grpc.CallOption) (*GetClustersResponse, error) { + out := new(GetClustersResponse) + err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/GetClusters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *vTAdminClient) GetGates(ctx context.Context, in *GetGatesRequest, opts ...grpc.CallOption) (*GetGatesResponse, error) { out := new(GetGatesResponse) err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/GetGates", in, out, opts...) @@ -747,6 +834,8 @@ func (c *vTAdminClient) GetTablets(ctx context.Context, in *GetTabletsRequest, o // VTAdminServer is the server API for VTAdmin service. type VTAdminServer interface { + // GetClusters returns all configured clusters. + GetClusters(context.Context, *GetClustersRequest) (*GetClustersResponse, error) // GetGates returns all gates across all the specified clusters. GetGates(context.Context, *GetGatesRequest) (*GetGatesResponse, error) // GetKeyspaces returns all keyspaces across the specified clusters. @@ -762,6 +851,9 @@ type VTAdminServer interface { type UnimplementedVTAdminServer struct { } +func (*UnimplementedVTAdminServer) GetClusters(ctx context.Context, req *GetClustersRequest) (*GetClustersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetClusters not implemented") +} func (*UnimplementedVTAdminServer) GetGates(ctx context.Context, req *GetGatesRequest) (*GetGatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetGates not implemented") } @@ -779,6 +871,24 @@ func RegisterVTAdminServer(s *grpc.Server, srv VTAdminServer) { s.RegisterService(&_VTAdmin_serviceDesc, srv) } +func _VTAdmin_GetClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetClustersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VTAdminServer).GetClusters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtadmin.VTAdmin/GetClusters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VTAdminServer).GetClusters(ctx, req.(*GetClustersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _VTAdmin_GetGates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetGatesRequest) if err := dec(in); err != nil { @@ -855,6 +965,10 @@ var _VTAdmin_serviceDesc = grpc.ServiceDesc{ ServiceName: "vtadmin.VTAdmin", HandlerType: (*VTAdminServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "GetClusters", + Handler: _VTAdmin_GetClusters_Handler, + }, { MethodName: "GetGates", Handler: _VTAdmin_GetGates_Handler, diff --git a/go/vt/vtadmin/api.go b/go/vt/vtadmin/api.go index 9ee6790c13c..fb9cae5c5d9 100644 --- a/go/vt/vtadmin/api.go +++ b/go/vt/vtadmin/api.go @@ -77,6 +77,7 @@ func NewAPI(clusters []*cluster.Cluster, opts grpcserver.Options, httpOpts vtadm httpAPI := vtadminhttp.NewAPI(api) + router.HandleFunc("/clusters", httpAPI.Adapt(vtadminhttp.GetClusters)).Name("API.GetClusters") router.HandleFunc("/gates", httpAPI.Adapt(vtadminhttp.GetGates)).Name("API.GetGates") router.HandleFunc("/keyspaces", httpAPI.Adapt(vtadminhttp.GetKeyspaces)).Name("API.GetKeyspaces") router.HandleFunc("/tablets", httpAPI.Adapt(vtadminhttp.GetTablets)).Name("API.GetTablets") @@ -113,6 +114,25 @@ func (api *API) ListenAndServe() error { return api.serv.ListenAndServe() } +// GetClusters is part of the vtadminpb.VTAdminServer interface. +func (api *API) GetClusters(ctx context.Context, req *vtadminpb.GetClustersRequest) (*vtadminpb.GetClustersResponse, error) { + span, _ := trace.NewSpan(ctx, "API.GetClusters") + defer span.Finish() + + vcs := make([]*vtadminpb.Cluster, 0, len(api.clusters)) + + for _, c := range api.clusters { + vcs = append(vcs, &vtadminpb.Cluster{ + Id: c.ID, + Name: c.Name, + }) + } + + return &vtadminpb.GetClustersResponse{ + Clusters: vcs, + }, nil +} + // GetGates is part of the vtadminpb.VTAdminServer interface. func (api *API) GetGates(ctx context.Context, req *vtadminpb.GetGatesRequest) (*vtadminpb.GetGatesResponse, error) { span, ctx := trace.NewSpan(ctx, "API.GetGates") diff --git a/go/vt/vtadmin/api_test.go b/go/vt/vtadmin/api_test.go index 64ac898a489..8a234010c65 100644 --- a/go/vt/vtadmin/api_test.go +++ b/go/vt/vtadmin/api_test.go @@ -51,6 +51,56 @@ func init() { *tmclient.TabletManagerProtocol = testutil.TabletManagerClientProtocol } +func TestGetClusters(t *testing.T) { + tests := []struct { + name string + clusters []*cluster.Cluster + expected []*vtadminpb.Cluster + }{ + { + name: "multiple clusters", + clusters: []*cluster.Cluster{ + { + ID: "c1", + Name: "cluster1", + Discovery: fakediscovery.New(), + }, + { + ID: "c2", + Name: "cluster2", + Discovery: fakediscovery.New(), + }, + }, + expected: []*vtadminpb.Cluster{ + { + Id: "c1", + Name: "cluster1", + }, + { + Id: "c2", + Name: "cluster2", + }, + }, + }, + { + name: "no clusters", + clusters: []*cluster.Cluster{}, + expected: []*vtadminpb.Cluster{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + api := NewAPI(tt.clusters, grpcserver.Options{}, http.Options{}) + ctx := context.Background() + + resp, err := api.GetClusters(ctx, &vtadminpb.GetClustersRequest{}) + assert.NoError(t, err) + assert.ElementsMatch(t, tt.expected, resp.Clusters) + }) + } +} + func TestGetGates(t *testing.T) { fakedisco1 := fakediscovery.New() cluster1 := &cluster.Cluster{ diff --git a/go/vt/vtadmin/http/clusters.go b/go/vt/vtadmin/http/clusters.go new file mode 100644 index 00000000000..ff02719679a --- /dev/null +++ b/go/vt/vtadmin/http/clusters.go @@ -0,0 +1,29 @@ +/* +Copyright 2021 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package http + +import ( + "context" + + vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" +) + +// GetClusters implements the http wrapper for /clusters +func GetClusters(ctx context.Context, r Request, api *API) *JSONResponse { + clusters, err := api.server.GetClusters(ctx, &vtadminpb.GetClustersRequest{}) + return NewJSONResponse(clusters, err) +} diff --git a/proto/vtadmin.proto b/proto/vtadmin.proto index dfd5fed38ad..f209881dddb 100644 --- a/proto/vtadmin.proto +++ b/proto/vtadmin.proto @@ -29,6 +29,8 @@ import "vtctldata.proto"; // VTAdmin is the Vitess Admin API service. It provides RPCs that operate on // across a range of Vitess clusters. service VTAdmin { + // GetClusters returns all configured clusters. + rpc GetClusters(GetClustersRequest) returns (GetClustersResponse) {}; // GetGates returns all gates across all the specified clusters. rpc GetGates(GetGatesRequest) returns (GetGatesResponse) {}; // GetKeyspaces returns all keyspaces across the specified clusters. @@ -93,6 +95,11 @@ message VTGate { } /* Request/Response types */ +message GetClustersRequest {} + +message GetClustersResponse { + repeated Cluster clusters = 1; +} message GetGatesRequest { repeated string cluster_ids = 1;