From 8179df3324aa292d890811099761a716d4094b1d Mon Sep 17 00:00:00 2001 From: ykadowak Date: Thu, 7 Dec 2023 06:23:54 +0000 Subject: [PATCH 01/27] Add svc discoverer for readreplica svc --- apis/docs/v1/docs.md | 299 +++----- apis/grpc/v1/discoverer/discoverer.pb.go | 10 +- .../v1/discoverer/discoverer_vtproto.pb.go | 38 + apis/grpc/v1/payload/payload.pb.go | 215 +++++- apis/grpc/v1/payload/payload_vtproto.pb.go | 683 +++++++++++++++++- apis/proto/v1/discoverer/discoverer.proto | 8 + apis/proto/v1/payload/payload.proto | 24 + .../v1/discoverer/discoverer.swagger.json | 77 ++ .../client/v1/client/discoverer/discover.go | 26 +- internal/config/discoverer.go | 34 +- internal/errors/discoverer.go | 5 + internal/k8s/readreplica/svc/option.go | 84 +++ internal/k8s/readreplica/svc/svc.go | 168 +++++ pkg/discoverer/k8s/handler/grpc/handler.go | 91 ++- pkg/discoverer/k8s/service/discover.go | 71 ++ pkg/discoverer/k8s/service/option.go | 9 + pkg/discoverer/k8s/usecase/discovered.go | 1 + pkg/gateway/lb/service/gateway.go | 1 + 18 files changed, 1594 insertions(+), 250 deletions(-) create mode 100644 internal/k8s/readreplica/svc/option.go create mode 100644 internal/k8s/readreplica/svc/svc.go diff --git a/apis/docs/v1/docs.md b/apis/docs/v1/docs.md index 243a35d5f0..f17fb88015 100644 --- a/apis/docs/v1/docs.md +++ b/apis/docs/v1/docs.md @@ -9,6 +9,7 @@ - [Control](#payload-v1-Control) - [Control.CreateIndexRequest](#payload-v1-Control-CreateIndexRequest) - [Discoverer](#payload-v1-Discoverer) + - [Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) - [Discoverer.Request](#payload-v1-Discoverer-Request) - [Empty](#payload-v1-Empty) - [Filter](#payload-v1-Filter) @@ -27,6 +28,8 @@ - [Info.Nodes](#payload-v1-Info-Nodes) - [Info.Pod](#payload-v1-Info-Pod) - [Info.Pods](#payload-v1-Info-Pods) + - [Info.ReadReplicaSvc](#payload-v1-Info-ReadReplicaSvc) + - [Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) - [Insert](#payload-v1-Insert) - [Insert.Config](#payload-v1-Insert-Config) - [Insert.MultiObjectRequest](#payload-v1-Insert-MultiObjectRequest) @@ -157,6 +160,17 @@ Represent the create index request. Discoverer related messages. + + +### Discoverer.ReadReplicaSvcsRequest + +Represent the dicoverer svc request. + +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ------------------------------- | +| name | [string](#string) | | The svc name to be discovered. | +| namespace | [string](#string) | | The namespace to be discovered. | + ### Discoverer.Request @@ -338,6 +352,28 @@ Represent the multiple pod information message. | ----- | -------------------------------- | -------- | ----------------------------- | | pods | [Info.Pod](#payload-v1-Info-Pod) | repeated | The multiple pod information. | + + +### Info.ReadReplicaSvc + +Represent the svc information message. + +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ------------------------------------- | +| name | [string](#string) | | The name of the svc. | +| addr | [string](#string) | | The IP address of the svc. | +| replicaid | [uint64](#uint64) | | The replicaid of the readreplica svc. | + + + +### Info.ReadReplicaSvcs + +Represent the multiple svc information message. + +| Field | Type | Label | Description | +| ----- | ------------------------------------------------------ | -------- | ------------------------------ | +| svcs | [Info.ReadReplicaSvc](#payload-v1-Info-ReadReplicaSvc) | repeated | The multiple node information. | + ### Insert @@ -1037,246 +1073,91 @@ Represent the index manager service. ## v1/rpc/errdetails/error_details.proto - - -### BadRequest - -Describes violations in a client request. This error type focuses on the -syntactic aspects of the request. - -| Field | Type | Label | Description | -| ---------------- | -------------------------------------------------------------- | -------- | --------------------------------------------- | -| field_violations | [BadRequest.FieldViolation](#rpc-v1-BadRequest-FieldViolation) | repeated | Describes all violations in a client request. | - - - -### BadRequest.FieldViolation - -A message type used to describe a single bad request field. - -| Field | Type | Label | Description | -| ----- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| field | [string](#string) | | A path that leads to a field in the request body. The value will be a sequence of dot-separated identifiers that identify a protocol buffer field. | - -Consider the following: - -message CreateContactRequest { message EmailAddress { enum Type { TYPE_UNSPECIFIED = 0; HOME = 1; WORK = 2; } - -optional string email = 1; repeated EmailType type = 2; } - -string full_name = 1; repeated EmailAddress email_addresses = 2; } - -In this example, in proto `field` could take one of the following values: - -- `full_name` for a violation in the `full_name` value _ `email_addresses[1].email` for a violation in the `email` field of the first `email_addresses` message _ `email_addresses[3].type[2]` for a violation in the second `type` value in the third `email_addresses` message. - -In JSON, the same values are represented as: - -- `fullName` for a violation in the `fullName` value _ `emailAddresses[1].email` for a violation in the `email` field of the first `emailAddresses` message _ `emailAddresses[3].type[2]` for a violation in the second `type` value in the third `emailAddresses` message. | - | description | [string](#string) | | A description of why the request element is bad. | - - - -### DebugInfo - -Describes additional debugging info. - -| Field | Type | Label | Description | -| ------------- | ----------------- | -------- | ------------------------------------------------------------ | -| stack_entries | [string](#string) | repeated | The stack trace entries indicating where the error occurred. | -| detail | [string](#string) | | Additional debugging information provided by the server. | - - - -### ErrorInfo - -Describes the cause of the error with structured details. - -Example of an error when contacting the "pubsub.googleapis.com" API when it -is not enabled: - - { "reason": "API_DISABLED" - "domain": "googleapis.com" - "metadata": { - "resource": "projects/123", - "service": "pubsub.googleapis.com" - } - } - -This response indicates that the pubsub.googleapis.com API is not enabled. - -Example of an error that is returned when attempting to create a Spanner -instance in a region that is out of stock: - - { "reason": "STOCKOUT" - "domain": "spanner.googleapis.com", - "metadata": { - "availableRegions": "us-central1,us-east2" - } - } - -| Field | Type | Label | Description | -| -------- | ---------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| reason | [string](#string) | | The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE. | -| domain | [string](#string) | | The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com". | -| metadata | [ErrorInfo.MetadataEntry](#rpc-v1-ErrorInfo-MetadataEntry) | repeated | Additional structured details about this error. | - -Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than {"instanceLimit": "100/request"}, should be returned as, {"instanceLimitPerRequest": "100"}, if the client exceeds the number of instances that can be created in a single (batch) request. | - - - -### ErrorInfo.MetadataEntry - -| Field | Type | Label | Description | -| ----- | ----------------- | ----- | ----------- | -| key | [string](#string) | | | -| value | [string](#string) | | | - - - -### Help - -Provides links to documentation or for performing an out of band action. - -For example, if a quota check failed with an error indicating the calling -project hasn't enabled the accessed service, this can contain a URL pointing -directly to the right place in the developer console to flip the bit. - -| Field | Type | Label | Description | -| ----- | ------------------------------ | -------- | ------------------------------------------------------------------------ | -| links | [Help.Link](#rpc-v1-Help-Link) | repeated | URL(s) pointing to additional information on handling the current error. | - - - -### Help.Link - -Describes a URL link. - -| Field | Type | Label | Description | -| ----------- | ----------------- | ----- | ------------------------------- | -| description | [string](#string) | | Describes what the link offers. | -| url | [string](#string) | | The URL of the link. | - - - -### LocalizedMessage - -Provides a localized error message that is safe to return to the user -which can be attached to an RPC error. - -| Field | Type | Label | Description | -| ------- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| locale | [string](#string) | | The locale used following the specification defined at https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Examples are: "en-US", "fr-CH", "es-MX" | -| message | [string](#string) | | The localized error message in the above locale. | - - - -### PreconditionFailure - -Describes what preconditions have failed. - -For example, if an RPC failed because it required the Terms of Service to be -acknowledged, it could list the terms of service violation in the -PreconditionFailure message. + -| Field | Type | Label | Description | -| ---------- | ---------------------------------------------------------------------- | -------- | -------------------------------------- | -| violations | [PreconditionFailure.Violation](#rpc-v1-PreconditionFailure-Violation) | repeated | Describes all precondition violations. | +### Discoverer - +Represent the discoverer service. -### PreconditionFailure.Violation +| Method Name | Request Type | Response Type | Description | +| --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | +| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | +| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | +| ReadReplicaSvcs | [.payload.v1.Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) | [.payload.v1.Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) | Represent the RPC to get the readreplica svc information. | -A message type used to describe a single precondition failure. + -| Field | Type | Label | Description | -| ----------- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | [string](#string) | | The type of PreconditionFailure. We recommend using a service-specific enum type to define the supported precondition violation subjects. For example, "TOS" for "Terms of Service violation". | -| subject | [string](#string) | | The subject, relative to the type, that failed. For example, "google.com/cloud" relative to the "TOS" type would indicate which terms of service is being referenced. | -| description | [string](#string) | | A description of how the precondition failed. Developers can use this description to understand how to fix the failure. | +

Top

-For example: "Terms of service not accepted". | +## apis/proto/v1/vald/remove.proto - + -### QuotaFailure +### Remove -Describes how a quota check failed. +Remove service provides ways to remove indexed vectors. -For example if a daily limit was exceeded for the calling project, -a service could respond with a QuotaFailure detail containing the project -id and the description of the quota limit that was exceeded. If the -calling project hasn't enabled the service in the developer console, then -a service could respond with the project id and set `service_disabled` -to true. +| Method Name | Request Type | Response Type | Description | +| ----------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| Remove | [.payload.v1.Remove.Request](#payload-v1-Remove-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to remove an indexed vector. | +| RemoveByTimestamp | [.payload.v1.Remove.TimestampRequest](#payload-v1-Remove-TimestampRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to remove an indexed vector based on timestamp. | +| StreamRemove | [.payload.v1.Remove.Request](#payload-v1-Remove-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to remove multiple indexed vectors by bidirectional streaming. | +| MultiRemove | [.payload.v1.Remove.MultiRequest](#payload-v1-Remove-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to remove multiple indexed vectors in a single request. | -Also see RetryInfo and Help types for other details about handling a -quota failure. + -| Field | Type | Label | Description | -| ---------- | -------------------------------------------------------- | -------- | ------------------------------- | -| violations | [QuotaFailure.Violation](#rpc-v1-QuotaFailure-Violation) | repeated | Describes all quota violations. | +

Top

- +## apis/proto/v1/vald/insert.proto -### QuotaFailure.Violation + -A message type used to describe a single quota violation. For example, a -daily quota or a custom quota that was exceeded. +### Insert -| Field | Type | Label | Description | -| ----------- | ----------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| subject | [string](#string) | | The subject on which the quota check failed. For example, "clientip:<ip address of client>" or "project:<Google developer project id>". | -| description | [string](#string) | | A description of how the quota check failed. Clients can use this description to find more about the quota configuration in the service's public documentation, or find the relevant quota limit to adjust through developer console. | +Insert service provides ways to add new vectors. -For example: "Service disabled" or "Daily Limit for read operations exceeded". | +| Method Name | Request Type | Response Type | Description | +| ------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| Insert | [.payload.v1.Insert.Request](#payload-v1-Insert-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to add a new single vector. | +| StreamInsert | [.payload.v1.Insert.Request](#payload-v1-Insert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to add new multiple vectors by bidirectional streaming. | +| MultiInsert | [.payload.v1.Insert.MultiRequest](#payload-v1-Insert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to add new multiple vectors in a single request. | - + -### RequestInfo +

Top

-Contains metadata about the request that clients can attach when filing a bug -or providing other forms of feedback. +## apis/proto/v1/vald/upsert.proto -| Field | Type | Label | Description | -| ------------ | ----------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| request_id | [string](#string) | | An opaque string that should only be interpreted by the service generating it. For example, it can be used to identify requests in the service's logs. | -| serving_data | [string](#string) | | Any data that was used to serve this request. For example, an encrypted stack trace that can be sent back to the service provider for debugging. | + - +### Upsert -### ResourceInfo +Upsert service provides ways to insert/update vectors. -Describes the resource that is being accessed. +| Method Name | Request Type | Response Type | Description | +| ------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| Upsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to insert/update a vector. | +| StreamUpsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to insert/update multiple vectors by bidirectional streaming. | +| MultiUpsert | [.payload.v1.Upsert.MultiRequest](#payload-v1-Upsert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to insert/update multiple vectors in a single request. | -| Field | Type | Label | Description | -| ------------- | ----------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| resource_type | [string](#string) | | A name for the type of resource being accessed, e.g. "sql table", "cloud storage bucket", "file", "Google calendar"; or the type URL of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". | -| resource_name | [string](#string) | | The name of the resource being accessed. For example, a shared calendar name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. | -| owner | [string](#string) | | The owner of the resource (optional). For example, "user:<owner email>" or "project:<Google developer project id>". | -| description | [string](#string) | | Describes what error is encountered when accessing this resource. For example, updating a cloud project may require the `writer` permission on the developer console project. | + - +

Top

-### RetryInfo +## apis/proto/v1/vald/object.proto -Describes when the clients can retry a failed request. Clients could ignore -the recommendation here or retry when this information is missing from error -responses. + -It's always recommended that clients should use exponential backoff when -retrying. +### Object -Clients should wait until `retry_delay` amount of time has passed since -receiving the error response before retrying. If retrying requests also -fail, clients should use an exponential backoff scheme to gradually increase -the delay between retries based on `retry_delay`, until either a maximum -number of retries have been reached or a maximum retry delay cap has been -reached. +Object service provides ways to fetch indexed vectors. -| Field | Type | Label | Description | -| ----------- | ----------------------------------------------------- | ----- | ------------------------------------------------------------------------- | -| retry_delay | [google.protobuf.Duration](#google-protobuf-Duration) | | Clients should wait at least this long between retrying the same request. | +| Method Name | Request Type | Response Type | Description | +| ---------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------- | +| Exists | [.payload.v1.Object.ID](#payload-v1-Object-ID) | [.payload.v1.Object.ID](#payload-v1-Object-ID) | A method to check whether a specified ID is indexed or not. | +| GetObject | [.payload.v1.Object.VectorRequest](#payload-v1-Object-VectorRequest) | [.payload.v1.Object.Vector](#payload-v1-Object-Vector) | A method to fetch a vector. | +| StreamGetObject | [.payload.v1.Object.VectorRequest](#payload-v1-Object-VectorRequest) stream | [.payload.v1.Object.StreamVector](#payload-v1-Object-StreamVector) stream | A method to fetch vectors by bidirectional streaming. | +| StreamListObject | [.payload.v1.Object.List.Request](#payload-v1-Object-List-Request) | [.payload.v1.Object.List.Response](#payload-v1-Object-List-Response) stream | A method to get all the vectors with server streaming | diff --git a/apis/grpc/v1/discoverer/discoverer.pb.go b/apis/grpc/v1/discoverer/discoverer.pb.go index cf278b91c7..0be32301b0 100644 --- a/apis/grpc/v1/discoverer/discoverer.pb.go +++ b/apis/grpc/v1/discoverer/discoverer.pb.go @@ -77,10 +77,12 @@ var file_v1_discoverer_discoverer_proto_goTypes = []interface{}{ var file_v1_discoverer_discoverer_proto_depIdxs = []int32{ 0, // 0: discoverer.v1.Discoverer.Pods:input_type -> payload.v1.Discoverer.Request 0, // 1: discoverer.v1.Discoverer.Nodes:input_type -> payload.v1.Discoverer.Request - 1, // 2: discoverer.v1.Discoverer.Pods:output_type -> payload.v1.Info.Pods - 2, // 3: discoverer.v1.Discoverer.Nodes:output_type -> payload.v1.Info.Nodes - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type + 1, // 2: discoverer.v1.Discoverer.ReadReplicaSvcs:input_type -> payload.v1.Discoverer.ReadReplicaSvcsRequest + 2, // 3: discoverer.v1.Discoverer.Pods:output_type -> payload.v1.Info.Pods + 3, // 4: discoverer.v1.Discoverer.Nodes:output_type -> payload.v1.Info.Nodes + 4, // 5: discoverer.v1.Discoverer.ReadReplicaSvcs:output_type -> payload.v1.Info.ReadReplicaSvcs + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go b/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go index 1217a02000..ef3e521690 100644 --- a/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go +++ b/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go @@ -46,6 +46,8 @@ type DiscovererClient interface { Pods(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Pods, error) // Represent the RPC to get the node information. Nodes(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Nodes, error) + // Represent the RPC to get the readreplica svc information. + ReadReplicaSvcs(ctx context.Context, in *payload.Discoverer_ReadReplicaSvcsRequest, opts ...grpc.CallOption) (*payload.Info_ReadReplicaSvcs, error) } type discovererClient struct { @@ -74,6 +76,15 @@ func (c *discovererClient) Nodes(ctx context.Context, in *payload.Discoverer_Req return out, nil } +func (c *discovererClient) ReadReplicaSvcs(ctx context.Context, in *payload.Discoverer_ReadReplicaSvcsRequest, opts ...grpc.CallOption) (*payload.Info_ReadReplicaSvcs, error) { + out := new(payload.Info_ReadReplicaSvcs) + err := c.cc.Invoke(ctx, "/discoverer.v1.Discoverer/ReadReplicaSvcs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // DiscovererServer is the server API for Discoverer service. // All implementations must embed UnimplementedDiscovererServer // for forward compatibility @@ -82,6 +93,8 @@ type DiscovererServer interface { Pods(context.Context, *payload.Discoverer_Request) (*payload.Info_Pods, error) // Represent the RPC to get the node information. Nodes(context.Context, *payload.Discoverer_Request) (*payload.Info_Nodes, error) + // Represent the RPC to get the readreplica svc information. + ReadReplicaSvcs(context.Context, *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) mustEmbedUnimplementedDiscovererServer() } @@ -95,6 +108,9 @@ func (UnimplementedDiscovererServer) Pods(context.Context, *payload.Discoverer_R func (UnimplementedDiscovererServer) Nodes(context.Context, *payload.Discoverer_Request) (*payload.Info_Nodes, error) { return nil, status.Errorf(codes.Unimplemented, "method Nodes not implemented") } +func (UnimplementedDiscovererServer) ReadReplicaSvcs(context.Context, *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadReplicaSvcs not implemented") +} func (UnimplementedDiscovererServer) mustEmbedUnimplementedDiscovererServer() {} // UnsafeDiscovererServer may be embedded to opt out of forward compatibility for this service. @@ -144,6 +160,24 @@ func _Discoverer_Nodes_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Discoverer_ReadReplicaSvcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.Discoverer_ReadReplicaSvcsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiscovererServer).ReadReplicaSvcs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/discoverer.v1.Discoverer/ReadReplicaSvcs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiscovererServer).ReadReplicaSvcs(ctx, req.(*payload.Discoverer_ReadReplicaSvcsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Discoverer_ServiceDesc is the grpc.ServiceDesc for Discoverer service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -159,6 +193,10 @@ var Discoverer_ServiceDesc = grpc.ServiceDesc{ MethodName: "Nodes", Handler: _Discoverer_Nodes_Handler, }, + { + MethodName: "ReadReplicaSvcs", + Handler: _Discoverer_ReadReplicaSvcs_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "v1/discoverer/discoverer.proto", diff --git a/apis/grpc/v1/payload/payload.pb.go b/apis/grpc/v1/payload/payload.pb.go index 8ee0d9b00b..cd47f52af5 100644 --- a/apis/grpc/v1/payload/payload.pb.go +++ b/apis/grpc/v1/payload/payload.pb.go @@ -3777,6 +3777,64 @@ func (x *Discoverer_Request) GetNode() string { return "" } +// Represent the dicoverer svc request. +type Discoverer_ReadReplicaSvcsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The svc name to be discovered. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The namespace to be discovered. + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` +} + +func (x *Discoverer_ReadReplicaSvcsRequest) Reset() { + *x = Discoverer_ReadReplicaSvcsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Discoverer_ReadReplicaSvcsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Discoverer_ReadReplicaSvcsRequest) ProtoMessage() {} + +func (x *Discoverer_ReadReplicaSvcsRequest) ProtoReflect() protoreflect.Message { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[64] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Discoverer_ReadReplicaSvcsRequest.ProtoReflect.Descriptor instead. +func (*Discoverer_ReadReplicaSvcsRequest) Descriptor() ([]byte, []int) { + return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{8, 1} +} + +func (x *Discoverer_ReadReplicaSvcsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Discoverer_ReadReplicaSvcsRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + // Represent the index information messages. type Info_Index struct { state protoimpl.MessageState @@ -4013,6 +4071,73 @@ func (x *Info_Node) GetPods() *Info_Pods { return nil } +// Represent the svc information message. +type Info_ReadReplicaSvc struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the svc. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The IP address of the svc. + Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` + // The replicaid of the readreplica svc. + Replicaid uint64 `protobuf:"varint,3,opt,name=replicaid,proto3" json:"replicaid,omitempty"` +} + +func (x *Info_ReadReplicaSvc) Reset() { + *x = Info_ReadReplicaSvc{} + if protoimpl.UnsafeEnabled { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[68] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info_ReadReplicaSvc) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info_ReadReplicaSvc) ProtoMessage() {} + +func (x *Info_ReadReplicaSvc) ProtoReflect() protoreflect.Message { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[68] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info_ReadReplicaSvc.ProtoReflect.Descriptor instead. +func (*Info_ReadReplicaSvc) Descriptor() ([]byte, []int) { + return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{9, 3} +} + +func (x *Info_ReadReplicaSvc) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Info_ReadReplicaSvc) GetAddr() string { + if x != nil { + return x.Addr + } + return "" +} + +func (x *Info_ReadReplicaSvc) GetReplicaid() uint64 { + if x != nil { + return x.Replicaid + } + return 0 +} + // Represent the CPU information message. type Info_CPU struct { state protoimpl.MessageState @@ -4245,6 +4370,55 @@ func (x *Info_Nodes) GetNodes() []*Info_Node { return nil } +// Represent the multiple svc information message. +type Info_ReadReplicaSvcs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The multiple node information. + Svcs []*Info_ReadReplicaSvc `protobuf:"bytes,1,rep,name=svcs,proto3" json:"svcs,omitempty"` +} + +func (x *Info_ReadReplicaSvcs) Reset() { + *x = Info_ReadReplicaSvcs{} + if protoimpl.UnsafeEnabled { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[73] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info_ReadReplicaSvcs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info_ReadReplicaSvcs) ProtoMessage() {} + +func (x *Info_ReadReplicaSvcs) ProtoReflect() protoreflect.Message { + mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[73] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info_ReadReplicaSvcs.ProtoReflect.Descriptor instead. +func (*Info_ReadReplicaSvcs) Descriptor() ([]byte, []int) { + return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} +} + +func (x *Info_ReadReplicaSvcs) GetSvcs() []*Info_ReadReplicaSvc { + if x != nil { + return x.Svcs + } + return nil +} + // Represent the multiple IP message. type Info_IPs struct { state protoimpl.MessageState @@ -5047,7 +5221,7 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 46, // 10: payload.v1.Search.Response.results:type_name -> payload.v1.Object.Distance 20, // 11: payload.v1.Search.Responses.responses:type_name -> payload.v1.Search.Response 20, // 12: payload.v1.Search.StreamResponse.response:type_name -> payload.v1.Search.Response - 78, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status + 81, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status 23, // 14: payload.v1.Filter.Config.targets:type_name -> payload.v1.Filter.Target 50, // 15: payload.v1.Insert.Request.vector:type_name -> payload.v1.Object.Vector 29, // 16: payload.v1.Insert.Request.config:type_name -> payload.v1.Insert.Config @@ -5081,31 +5255,32 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 48, // 44: payload.v1.Object.VectorRequest.id:type_name -> payload.v1.Object.ID 24, // 45: payload.v1.Object.VectorRequest.filters:type_name -> payload.v1.Filter.Config 46, // 46: payload.v1.Object.StreamDistance.distance:type_name -> payload.v1.Object.Distance - 78, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status + 81, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status 48, // 48: payload.v1.Object.GetTimestampRequest.id:type_name -> payload.v1.Object.ID 50, // 49: payload.v1.Object.Vectors.vectors:type_name -> payload.v1.Object.Vector 50, // 50: payload.v1.Object.StreamVector.vector:type_name -> payload.v1.Object.Vector - 78, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status + 81, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status 56, // 52: payload.v1.Object.StreamBlob.blob:type_name -> payload.v1.Object.Blob - 78, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status + 81, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status 58, // 54: payload.v1.Object.StreamLocation.location:type_name -> payload.v1.Object.Location - 78, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status + 81, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status 58, // 56: payload.v1.Object.Locations.locations:type_name -> payload.v1.Object.Location 50, // 57: payload.v1.Object.List.Response.vector:type_name -> payload.v1.Object.Vector - 78, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status - 69, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU - 70, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory - 68, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node - 69, // 62: payload.v1.Info.Node.cpu:type_name -> payload.v1.Info.CPU - 70, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory - 71, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods - 67, // 65: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod - 68, // 66: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node - 67, // [67:67] is the sub-list for method output_type - 67, // [67:67] is the sub-list for method input_type - 67, // [67:67] is the sub-list for extension type_name - 67, // [67:67] is the sub-list for extension extendee - 0, // [0:67] is the sub-list for field type_name + 81, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status + 71, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU + 72, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory + 69, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node + 71, // 62: payload.v1.Info.Node.cpu:type_name -> payload.v1.Info.CPU + 72, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory + 73, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods + 68, // 65: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod + 69, // 66: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node + 70, // 67: payload.v1.Info.ReadReplicaSvcs.svcs:type_name -> payload.v1.Info.ReadReplicaSvc + 68, // [68:68] is the sub-list for method output_type + 68, // [68:68] is the sub-list for method input_type + 68, // [68:68] is the sub-list for extension type_name + 68, // [68:68] is the sub-list for extension extendee + 0, // [0:68] is the sub-list for field type_name } func init() { file_v1_payload_payload_proto_init() } @@ -6057,7 +6232,7 @@ func file_v1_payload_payload_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v1_payload_payload_proto_rawDesc, NumEnums: 2, - NumMessages: 76, + NumMessages: 79, NumExtensions: 0, NumServices: 0, }, diff --git a/apis/grpc/v1/payload/payload_vtproto.pb.go b/apis/grpc/v1/payload/payload_vtproto.pb.go index eba52b547b..0e5502722f 100644 --- a/apis/grpc/v1/payload/payload_vtproto.pb.go +++ b/apis/grpc/v1/payload/payload_vtproto.pb.go @@ -1437,6 +1437,25 @@ func (m *Discoverer_Request) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Discoverer_ReadReplicaSvcsRequest) CloneVT() *Discoverer_ReadReplicaSvcsRequest { + if m == nil { + return (*Discoverer_ReadReplicaSvcsRequest)(nil) + } + r := &Discoverer_ReadReplicaSvcsRequest{ + Name: m.Name, + Namespace: m.Namespace, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Discoverer_ReadReplicaSvcsRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *Discoverer) CloneVT() *Discoverer { if m == nil { return (*Discoverer)(nil) @@ -1589,6 +1608,26 @@ func (m *Info_Node) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Info_ReadReplicaSvc) CloneVT() *Info_ReadReplicaSvc { + if m == nil { + return (*Info_ReadReplicaSvc)(nil) + } + r := &Info_ReadReplicaSvc{ + Name: m.Name, + Addr: m.Addr, + Replicaid: m.Replicaid, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Info_ReadReplicaSvc) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *Info_CPU) CloneVT() *Info_CPU { if m == nil { return (*Info_CPU)(nil) @@ -1675,6 +1714,29 @@ func (m *Info_Nodes) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Info_ReadReplicaSvcs) CloneVT() *Info_ReadReplicaSvcs { + if m == nil { + return (*Info_ReadReplicaSvcs)(nil) + } + r := &Info_ReadReplicaSvcs{} + if rhs := m.Svcs; rhs != nil { + tmpContainer := make([]*Info_ReadReplicaSvc, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Svcs = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Info_ReadReplicaSvcs) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *Info_IPs) CloneVT() *Info_IPs { if m == nil { return (*Info_IPs)(nil) @@ -3624,6 +3686,28 @@ func (this *Discoverer_Request) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Discoverer_ReadReplicaSvcsRequest) EqualVT(that *Discoverer_ReadReplicaSvcsRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.Namespace != that.Namespace { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Discoverer_ReadReplicaSvcsRequest) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Discoverer_ReadReplicaSvcsRequest) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *Discoverer) EqualVT(that *Discoverer) bool { if this == that { return true @@ -3809,6 +3893,31 @@ func (this *Info_Node) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Info_ReadReplicaSvc) EqualVT(that *Info_ReadReplicaSvc) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.Addr != that.Addr { + return false + } + if this.Replicaid != that.Replicaid { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Info_ReadReplicaSvc) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_ReadReplicaSvc) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *Info_CPU) EqualVT(that *Info_CPU) bool { if this == that { return true @@ -3925,6 +4034,39 @@ func (this *Info_Nodes) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Info_ReadReplicaSvcs) EqualVT(that *Info_ReadReplicaSvcs) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Svcs) != len(that.Svcs) { + return false + } + for i, vx := range this.Svcs { + vy := that.Svcs[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Info_ReadReplicaSvc{} + } + if q == nil { + q = &Info_ReadReplicaSvc{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Info_ReadReplicaSvcs) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_ReadReplicaSvcs) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *Info_IPs) EqualVT(that *Info_IPs) bool { if this == that { return true @@ -7157,6 +7299,53 @@ func (m *Discoverer_Request) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Discoverer_ReadReplicaSvcsRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Discoverer_ReadReplicaSvcsRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Discoverer_ReadReplicaSvcsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarint(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Discoverer) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -7574,6 +7763,58 @@ func (m *Info_Node) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Info_ReadReplicaSvc) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info_ReadReplicaSvc) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Info_ReadReplicaSvc) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Replicaid != 0 { + i = encodeVarint(dAtA, i, uint64(m.Replicaid)) + i-- + dAtA[i] = 0x18 + } + if len(m.Addr) > 0 { + i -= len(m.Addr) + copy(dAtA[i:], m.Addr) + i = encodeVarint(dAtA, i, uint64(len(m.Addr))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Info_CPU) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -7766,6 +8007,51 @@ func (m *Info_Nodes) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Info_ReadReplicaSvcs) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info_ReadReplicaSvcs) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Info_ReadReplicaSvcs) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Svcs) > 0 { + for iNdEx := len(m.Svcs) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Svcs[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *Info_IPs) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -9067,6 +9353,24 @@ func (m *Discoverer_Request) SizeVT() (n int) { return n } +func (m *Discoverer_ReadReplicaSvcsRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *Discoverer) SizeVT() (n int) { if m == nil { return 0 @@ -9219,15 +9523,36 @@ func (m *Info_Node) SizeVT() (n int) { return n } -func (m *Info_CPU) SizeVT() (n int) { +func (m *Info_ReadReplicaSvc) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l - if m.Limit != 0 { - n += 9 - } + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Addr) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Replicaid != 0 { + n += 1 + sov(uint64(m.Replicaid)) + } + n += len(m.unknownFields) + return n +} + +func (m *Info_CPU) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Limit != 0 { + n += 9 + } if m.Request != 0 { n += 9 } @@ -9289,6 +9614,22 @@ func (m *Info_Nodes) SizeVT() (n int) { return n } +func (m *Info_ReadReplicaSvcs) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Svcs) > 0 { + for _, e := range m.Svcs { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + func (m *Info_IPs) SizeVT() (n int) { if m == nil { return 0 @@ -15835,6 +16176,121 @@ func (m *Discoverer_Request) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Discoverer_ReadReplicaSvcsRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Discoverer_ReadReplicaSvcsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Discoverer_ReadReplicaSvcsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Discoverer) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -16825,6 +17281,140 @@ func (m *Info_Node) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info_ReadReplicaSvc: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info_ReadReplicaSvc: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Replicaid", wireType) + } + m.Replicaid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Replicaid |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Info_CPU) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -17163,6 +17753,91 @@ func (m *Info_Nodes) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Info_ReadReplicaSvcs) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info_ReadReplicaSvcs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info_ReadReplicaSvcs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Svcs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Svcs = append(m.Svcs, &Info_ReadReplicaSvc{}) + if err := m.Svcs[len(m.Svcs)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Info_IPs) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/apis/proto/v1/discoverer/discoverer.proto b/apis/proto/v1/discoverer/discoverer.proto index 4cff64b9fd..6500099a88 100644 --- a/apis/proto/v1/discoverer/discoverer.proto +++ b/apis/proto/v1/discoverer/discoverer.proto @@ -43,4 +43,12 @@ service Discoverer { body: "*" }; } + + // Represent the RPC to get the readreplica svc information. + rpc ReadReplicaSvcs(payload.v1.Discoverer.ReadReplicaSvcsRequest) returns (payload.v1.Info.ReadReplicaSvcs) { + option (google.api.http) = { + post: "/discover/svcs" + body: "*" + }; + } } diff --git a/apis/proto/v1/payload/payload.proto b/apis/proto/v1/payload/payload.proto index 4b2d7e9dde..db9ef69cbb 100644 --- a/apis/proto/v1/payload/payload.proto +++ b/apis/proto/v1/payload/payload.proto @@ -498,6 +498,14 @@ message Discoverer { // The node to be discovered. string node = 3; } + + // Represent the dicoverer svc request. + message ReadReplicaSvcsRequest { + // The svc name to be discovered. + string name = 1 [(validate.rules).string.min_len = 1]; + // The namespace to be discovered. + string namespace = 2; + } } // Info related messages. @@ -563,6 +571,16 @@ message Info { Pods Pods = 6; } + // Represent the svc information message. + message ReadReplicaSvc { + // The name of the svc. + string name = 1; + // The IP address of the svc. + string addr = 2; + // The replicaid of the readreplica svc. + uint64 replicaid = 3; + } + // Represent the CPU information message. message CPU { // The CPU resource limit. @@ -595,6 +613,12 @@ message Info { repeated Node nodes = 1 [(buf.validate.field).repeated.min_items = 1]; } + // Represent the multiple svc information message. + message ReadReplicaSvcs { + // The multiple node information. + repeated ReadReplicaSvc svcs = 1 [(validate.rules).repeated.min_items = 1]; + } + // Represent the multiple IP message. message IPs { repeated string ip = 1; diff --git a/apis/swagger/v1/discoverer/discoverer.swagger.json b/apis/swagger/v1/discoverer/discoverer.swagger.json index a187737dea..ce72492805 100644 --- a/apis/swagger/v1/discoverer/discoverer.swagger.json +++ b/apis/swagger/v1/discoverer/discoverer.swagger.json @@ -75,9 +75,54 @@ ], "tags": ["Discoverer"] } + }, + "/discover/svcs": { + "post": { + "summary": "Represent the RPC to get the readreplica svc information.", + "operationId": "Discoverer_ReadReplicaSvcs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/InfoReadReplicaSvcs" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DiscovererReadReplicaSvcsRequest" + } + } + ], + "tags": ["Discoverer"] + } } }, "definitions": { + "DiscovererReadReplicaSvcsRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The svc name to be discovered." + }, + "namespace": { + "type": "string", + "description": "The namespace to be discovered." + } + }, + "description": "Represent the dicoverer svc request." + }, "InfoCPU": { "type": "object", "properties": { @@ -212,6 +257,38 @@ }, "description": "Represent the multiple pod information message." }, + "InfoReadReplicaSvc": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the svc." + }, + "addr": { + "type": "string", + "description": "The IP address of the svc." + }, + "replicaid": { + "type": "string", + "format": "uint64", + "description": "The replicaid of the readreplica svc." + } + }, + "description": "Represent the svc information message." + }, + "InfoReadReplicaSvcs": { + "type": "object", + "properties": { + "svcs": { + "type": "array", + "items": { + "$ref": "#/definitions/InfoReadReplicaSvc" + }, + "description": "The multiple node information." + } + }, + "description": "Represent the multiple svc information message." + }, "protobufAny": { "type": "object", "properties": { diff --git a/internal/client/v1/client/discoverer/discover.go b/internal/client/v1/client/discoverer/discover.go index 89a43f2a8c..347ba03207 100644 --- a/internal/client/v1/client/discoverer/discover.go +++ b/internal/client/v1/client/discoverer/discover.go @@ -75,7 +75,9 @@ func (c *client) Start(ctx context.Context) (<-chan error, error) { } ech := make(chan error, 100) - addrs, err := c.dnsDiscovery(ctx, ech) + addrs, err := c.dnsDiscovery(ctx, ech) // ひとまずのagent addrsを取得 + // FIXME: readreplica svcのaddrsを取得する + // 起動時にclientから取得できるかわからないのでひとまず推測で取得する if err != nil { close(ech) return nil, err @@ -83,7 +85,24 @@ func (c *client) Start(ctx context.Context) (<-chan error, error) { c.addrs.Store(&addrs) var aech <-chan error - if c.autoconn { + if c.autoconn { // jidousetuzokusurubaai + // FIXME: + // clientをreadreplicaについても作成する? + // そもそもdiscoverer側にreadreplicaの情報がないので、clientを作成できるのか? + + // その場合どういうグループでgrpc.Newするか。repcalica idごとか? + // そうなると問題なのはreadreplicaについてはidごとのsvcとなっているから + // 全svcのipを集約して、適切にgrpc.Newする必要がある。 + // gatewayはg.client.GetClient().RangeConcurrentでbroadcastするので、 + // broadcastしたい単位でclientを持っておくのが良い すなわち + // 従来のclient, replica id 0のclient, replica id 1のclient, ... という感じで + // それをするためには + // svc -> replica idごとのipaddrsを取得 -> replicaidごとのaddrsに変換 + // + // それのラウンドロビンは誰が管理する? + // それかsvcのラウンドロビンをうまく利用できる? + // + // あとreadreplicaが再起動した後の再接続はどうする? c.client = grpc.New( append( c.opts, @@ -242,6 +261,9 @@ func (c *client) discover(ctx context.Context, ech chan<- error) (err error) { } else { connected, err = c.updateDiscoveryInfo(ctx, ech) } + // FIXME: ここでk8s APIからの取得に失敗した場合に初めてdnsDiscoveryする + // これをreadreplicaに関しては常に行い、しかもagent groupを管理できる形の構造体へ格納する。 + // 普通に考えると connectedを二次元にするか if err != nil { log.Warnf("failed to discover addrs from discoverer API, error: %v,\ttrying to dns discovery from %s...", err, c.dns) connected, err = c.dnsDiscovery(ctx, ech) diff --git a/internal/config/discoverer.go b/internal/config/discoverer.go index 12fa8b06fc..ed8575d2a0 100644 --- a/internal/config/discoverer.go +++ b/internal/config/discoverer.go @@ -19,18 +19,20 @@ package config // Discoverer represents the Discoverer configurations. type Discoverer struct { - Name string `json:"name,omitempty" yaml:"name"` - Namespace string `json:"namespace,omitempty" yaml:"namespace"` - DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` - Net *Net `json:"net,omitempty" yaml:"net"` - Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` + Name string `json:"name,omitempty" yaml:"name"` + Namespace string `json:"namespace,omitempty" yaml:"namespace"` + DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` + Net *Net `json:"net,omitempty" yaml:"net"` + Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` + ReadReplicaIdKey string `json:"read_replica_id_key,omitempty" yaml:"read_replica_id_key"` } type Selectors struct { - Pod *Selector `json:"pod,omitempty" yaml:"pod"` - Node *Selector `json:"node,omitempty" yaml:"node"` - NodeMetrics *Selector `json:"node_metrics,omitempty" yaml:"node_metrics"` - PodMetrics *Selector `json:"pod_metrics,omitempty" yaml:"pod_metrics"` + Pod *Selector `json:"pod,omitempty" yaml:"pod"` + Node *Selector `json:"node,omitempty" yaml:"node"` + NodeMetrics *Selector `json:"node_metrics,omitempty" yaml:"node_metrics"` + PodMetrics *Selector `json:"pod_metrics,omitempty" yaml:"pod_metrics"` + ReadReplicaSvc *Selector `json:"readreplica_svc,omitempty" yaml:"readreplica_svc"` } func (s *Selectors) GetPodFields() map[string]string { @@ -89,6 +91,20 @@ func (s *Selectors) GetNodeMetricsLabels() map[string]string { return s.NodeMetrics.GetLabels() } +func (s *Selectors) GetReadReplicaSvcFields() map[string]string { + if s == nil { + return nil + } + return s.ReadReplicaSvc.GetFields() +} + +func (s *Selectors) GetReadReplicaSvcLabels() map[string]string { + if s == nil { + return nil + } + return s.ReadReplicaSvc.GetLabels() +} + type Selector struct { Labels map[string]string `json:"labels,omitempty" yaml:"labels"` Fields map[string]string `json:"fields,omitempty" yaml:"fields"` diff --git a/internal/errors/discoverer.go b/internal/errors/discoverer.go index 14a4682306..a01f016c3e 100644 --- a/internal/errors/discoverer.go +++ b/internal/errors/discoverer.go @@ -38,6 +38,11 @@ var ( return Errorf("discover pod %s not found", name) } + // ErrSvcNameNotFound represents a function to generate an error of discover svc not found. + ErrSvcNameNotFound = func(name string) error { + return Errorf("discover svc %s not found", name) + } + // ErrInvalidDiscoveryCache represents an error that type conversion of discovery cache failed. ErrInvalidDiscoveryCache = New("cache type cast failed") ) diff --git a/internal/k8s/readreplica/svc/option.go b/internal/k8s/readreplica/svc/option.go new file mode 100644 index 0000000000..4a73404685 --- /dev/null +++ b/internal/k8s/readreplica/svc/option.go @@ -0,0 +1,84 @@ +// +// Copyright (C) 2019-2023 vdaas.org vald team +// +// 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 +// +// https://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 node provides kubernetes node information and preriodically update +package svc + +import ( + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +type Option func(*reconciler) error + +var defaultOptions = []Option{} + +func WithControllerName(name string) Option { + return func(r *reconciler) error { + r.name = name + return nil + } +} + +func WithManager(mgr manager.Manager) Option { + return func(r *reconciler) error { + r.mgr = mgr + return nil + } +} + +func WithOnErrorFunc(f func(err error)) Option { + return func(r *reconciler) error { + r.onError = f + return nil + } +} + +func WithOnReconcileFunc(f func(nodes []Svc)) Option { + return func(r *reconciler) error { + r.onReconcile = f + return nil + } +} + +func WithNamespace(ns string) Option { + return func(r *reconciler) error { + if ns == "" { + return nil + } + r.namespace = ns + r.addListOpts(client.InNamespace(ns)) + return nil + } +} + +func WithLabels(ls map[string]string) Option { + return func(r *reconciler) error { + if len(ls) > 0 { + r.addListOpts(client.MatchingLabels(ls)) + } + return nil + } +} + +func WithFields(fs map[string]string) Option { + return func(r *reconciler) error { + if len(fs) > 0 { + r.addListOpts(client.MatchingFields(fs)) + } + return nil + } +} diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go new file mode 100644 index 0000000000..6abfb439b1 --- /dev/null +++ b/internal/k8s/readreplica/svc/svc.go @@ -0,0 +1,168 @@ +// +// Copyright (C) 2019-2023 vdaas.org vald team +// +// 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 +// +// https://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 svc provides kubernetes svc information and preriodically update +package svc + +import ( + "context" + "fmt" + "strconv" + "time" + + "github.com/vdaas/vald/internal/k8s" + "github.com/vdaas/vald/internal/log" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "sigs.k8s.io/controller-runtime/pkg/builder" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +type SvcWatcher k8s.ResourceController + +type reconciler struct { + mgr manager.Manager + name string + namespace string + idKey string // readreplica.label_key + onError func(err error) + onReconcile func(svcs []Svc) + lopts []client.ListOption +} + +type Svc struct { + Name string + Addr string + ReplicaId uint64 +} + +func New(readreplicaLabel map[string]string, idKey string, opts ...Option) SvcWatcher { + r := new(reconciler) + + opts = append(opts, WithLabels(readreplicaLabel)) + for _, opt := range append(defaultOptions, opts...) { + opt(r) + } + + r.idKey = idKey + return r +} + +func (r *reconciler) addListOpts(opt client.ListOption) { + if opt == nil { + return + } + if r.lopts == nil { + r.lopts = make([]client.ListOption, 0, 1) + } + r.lopts = append(r.lopts, opt) +} + +func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res reconcile.Result, err error) { + svcList := &corev1.ServiceList{} + + if r.lopts != nil { + err = r.mgr.GetClient().List(ctx, svcList, r.lopts...) + } else { + err = r.mgr.GetClient().List(ctx, svcList) + } + + if err != nil { + if r.onError != nil { + r.onError(err) + } + res = reconcile.Result{ + Requeue: true, + RequeueAfter: time.Millisecond * 100, + } + if errors.IsNotFound(err) { + res = reconcile.Result{ + Requeue: true, + RequeueAfter: time.Second, + } + } + return + } + + svcs := make([]Svc, 0, len(svcList.Items)) + for _, svc := range svcList.Items { + if svc.GetDeletionTimestamp() != nil { + log.Debugf("reconcile process will be skipped for node: %s, status: %v, deletion timestamp: %s", + svc.GetName(), + svc.Status, + svc.GetDeletionTimestamp()) + continue + } + labels := svc.GetLabels() + v, ok := labels[r.idKey] + if !ok { + log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), r.idKey) + return reconcile.Result{}, fmt.Errorf("no valid label is put in the svc") + } + id, err := strconv.ParseUint(v, 10, 32) + if err != nil { + log.Error(err) + return reconcile.Result{}, err + } + svcs = append(svcs, Svc{ + Name: svc.GetName(), + Addr: svc.Spec.ClusterIP, + ReplicaId: id, + }) + } + if r.onReconcile != nil { + r.onReconcile(svcs) + } + + return +} + +func (r *reconciler) GetName() string { + return r.name +} + +func (r *reconciler) NewReconciler(_ context.Context, mgr manager.Manager) reconcile.Reconciler { + if r.mgr == nil && mgr != nil { + r.mgr = mgr + } + corev1.AddToScheme(r.mgr.GetScheme()) + if err := r.mgr.GetFieldIndexer().IndexField(context.Background(), &corev1.Service{}, "status.phase", func(obj client.Object) []string { + node, ok := obj.(*corev1.Node) + if !ok || node.GetDeletionTimestamp() != nil { + return nil + } + return []string{string(node.Status.Phase)} + }); err != nil { + log.Error(err) + } + return r +} + +func (*reconciler) For() (client.Object, []builder.ForOption) { + return new(corev1.Service), nil +} + +func (*reconciler) Owns() (client.Object, []builder.OwnsOption) { + return nil, nil +} + +func (*reconciler) Watches() (client.Object, handler.EventHandler, []builder.WatchesOption) { + return nil, nil, nil +} diff --git a/pkg/discoverer/k8s/handler/grpc/handler.go b/pkg/discoverer/k8s/handler/grpc/handler.go index 1ebf1d0497..246b1b0b18 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler.go +++ b/pkg/discoverer/k8s/handler/grpc/handler.go @@ -40,8 +40,9 @@ type DiscovererServer interface { type server struct { dsc service.Discoverer - pgroup singleflight.Group[*payload.Info_Pods] // pod singleflight group - ngroup singleflight.Group[*payload.Info_Nodes] // node singleflight group + pgroup singleflight.Group[*payload.Info_Pods] // pod singleflight group + ngroup singleflight.Group[*payload.Info_Nodes] // node singleflight group + sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] // svc singleflight group ip string name string discoverer.UnimplementedDiscovererServer @@ -51,6 +52,7 @@ const ( apiName = "vald/discoverer/k8s" podPrefix = "pods" nodePrefix = "nodes" + svcPrefix = "svcs" keyDelim = "-" ) @@ -66,6 +68,7 @@ func New(opts ...Option) (ds DiscovererServer, err error) { s.pgroup = singleflight.New[*payload.Info_Pods]() s.ngroup = singleflight.New[*payload.Info_Nodes]() + s.sgroup = singleflight.New[*payload.Info_ReadReplicaSvcs]() return s, nil } @@ -221,6 +224,82 @@ func (s *server) Nodes(ctx context.Context, req *payload.Discoverer_Request) (*p return cn, nil } +func (s *server) ReadReplicaSvcs(ctx context.Context, req *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) { + ctx, span := trace.StartSpan(ctx, apiName+".Svcs") + defer func() { + if span != nil { + span.End() + } + }() + + key := singleflightKeyForSvcs(svcPrefix, req) + res, _, err := s.sgroup.Do(ctx, key, func(context.Context) (*payload.Info_ReadReplicaSvcs, error) { + return s.dsc.GetReadReplicaSvcs(req) + }) + if err != nil { + err = status.WrapWithInternal(fmt.Sprintf("Svcs API request (name: %s, namespace: %s) failed", req.GetName(), req.GetNamespace()), err, + &errdetails.RequestInfo{ + RequestId: key, + ServingData: errdetails.Serialize(req), + }, + &errdetails.ResourceInfo{ + ResourceType: errdetails.ValdGRPCResourceTypePrefix + "/discoverer.v1.Svcs", + ResourceName: fmt.Sprintf("%s(%s)", s.name, s.ip), + }, + info.Get()) + if span != nil { + span.RecordError(err) + span.SetAttributes(trace.StatusCodeInternal(err.Error())...) + span.SetStatus(trace.StatusError, err.Error()) + } + log.Warnf("GetSvcs returned error: %v", err) + return nil, err + } + if res == nil { + err = status.WrapWithNotFound(fmt.Sprintf("Svcs API request (name: %s, namespace: %s) svcs not found", req.GetName(), req.GetNamespace()), err, + &errdetails.RequestInfo{ + RequestId: key, + ServingData: errdetails.Serialize(req), + }, + &errdetails.ResourceInfo{ + ResourceType: errdetails.ValdGRPCResourceTypePrefix + "/discoverer.v1.Svcs", + ResourceName: fmt.Sprintf("%s(%s)", s.name, s.ip), + }, + info.Get()) + if span != nil { + span.RecordError(err) + span.SetAttributes(trace.StatusCodeNotFound(err.Error())...) + span.SetStatus(trace.StatusError, err.Error()) + } + log.Warnf("Nodes not found: %#v, error: %v", res, err) + return nil, err + } + cn := res.CloneVT() + if cn == nil { + err = status.WrapWithNotFound( + fmt.Sprintf("Svcs API request (name: %s, namespace: %s) svcs not found, cloned response is nil", req.GetName(), req.GetNamespace()), + err, + &errdetails.RequestInfo{ + RequestId: key, + ServingData: errdetails.Serialize(req), + }, + &errdetails.ResourceInfo{ + ResourceType: errdetails.ValdGRPCResourceTypePrefix + "/discoverer.v1.Svcs", + ResourceName: fmt.Sprintf("%s(%s)", s.name, s.ip), + }, + info.Get(), + ) + if span != nil { + span.RecordError(err) + span.SetAttributes(trace.StatusCodeNotFound(err.Error())...) + span.SetStatus(trace.StatusError, err.Error()) + } + log.Warnf("Svcs not found: %#v, error: %v", res, err) + return nil, err + } + return cn, nil +} + func singleflightKey(pref string, req *payload.Discoverer_Request) string { return strings.Join([]string{ pref, @@ -229,3 +308,11 @@ func singleflightKey(pref string, req *payload.Discoverer_Request) string { req.GetName(), }, keyDelim) } + +func singleflightKeyForSvcs(pref string, req *payload.Discoverer_ReadReplicaSvcsRequest) string { + return strings.Join([]string{ + pref, + req.GetNamespace(), + req.GetName(), + }, keyDelim) +} diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 9a2773c431..c3a8ae582c 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -33,6 +33,7 @@ import ( mpod "github.com/vdaas/vald/internal/k8s/metrics/pod" "github.com/vdaas/vald/internal/k8s/node" "github.com/vdaas/vald/internal/k8s/pod" + "github.com/vdaas/vald/internal/k8s/readreplica/svc" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" "github.com/vdaas/vald/internal/safety" @@ -44,6 +45,7 @@ type Discoverer interface { Start(context.Context) (<-chan error, error) GetPods(*payload.Discoverer_Request) (*payload.Info_Pods, error) GetNodes(*payload.Discoverer_Request) (*payload.Info_Nodes, error) + GetReadReplicaSvcs(*payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) } type discoverer struct { @@ -52,16 +54,19 @@ type discoverer struct { nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] + svcs sync.Map[string, svc.Svc] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value nodeByName atomic.Value + svcsByName atomic.Value ctrl k8s.Controller namespace string name string csd time.Duration der net.Dialer eg errgroup.Group + replicaIdKey string } func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) { @@ -71,6 +76,7 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) return nil, errors.ErrOptionFailed(err, reflect.ValueOf(opt)) } } + d.podsByNode.Store(make(map[string]map[string]map[string][]*payload.Info_Pod)) d.podsByNamespace.Store(make(map[string]map[string][]*payload.Info_Pod)) d.podsByName.Store(make(map[string][]*payload.Info_Pod)) @@ -172,6 +178,32 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithFields(selector.GetNodeFields()), node.WithLabels(selector.GetNodeLabels()), )), + k8s.WithResourceController(svc.New( + selector.GetReadReplicaSvcLabels(), + d.replicaIdKey, + svc.WithControllerName("readreplica svc discoverer"), + svc.WithOnErrorFunc(func(err error) { + log.Error("failed to reconcile:", err) + }), + svc.WithOnReconcileFunc(func(svcs []svc.Svc) { + log.Debugf("svc resource reconciled\t%#v", svcs) + svcsmap := make(map[string]struct{}, len(svcs)) + for _, svc := range svcs { + svcsmap[svc.Name] = struct{}{} + d.svcs.Store(svc.Name, svc) + } + d.svcs.Range(func(name string, _ svc.Svc) bool { + _, ok := svcsmap[name] + if !ok { + d.svcs.Delete(name) + } + return true + }) + }), + svc.WithNamespace(d.namespace), + svc.WithFields(selector.GetReadReplicaSvcFields()), + svc.WithLabels(selector.GetReadReplicaSvcLabels()), + )), ) if err != nil { return nil, err @@ -200,6 +232,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { podsByNamespace = make(map[string]map[string][]*payload.Info_Pod) // map[namespace][name][]pod podsByName = make(map[string][]*payload.Info_Pod) // map[name][]pod nodeByName = make(map[string]*payload.Info_Node) // map[name]node + svcsByName = make(map[string]*payload.Info_ReadReplicaSvc) // map[name]svc ) d.nodes.Range(func(nodeName string, n *node.Node) bool { @@ -297,6 +330,22 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) + d.svcs.Range(func(key string, svc svc.Svc) bool { + select { + case <-ctx.Done(): + return false + default: + ni := &payload.Info_ReadReplicaSvc{ + Name: svc.Name, + Addr: svc.Addr, + Replicaid: svc.ReplicaId, + } + svcsByName[svc.Name] = ni + return true + } + }) + d.svcsByName.Store(svcsByName) + var wg sync.WaitGroup wg.Add(1) d.eg.Go(safety.RecoverFunc(func() error { @@ -483,3 +532,25 @@ func (d *discoverer) GetNodes(req *payload.Discoverer_Request) (nodes *payload.I nodes.Nodes = ns return nodes, nil } + +func (d *discoverer) GetReadReplicaSvcs(req *payload.Discoverer_ReadReplicaSvcsRequest) (svcs *payload.Info_ReadReplicaSvcs, err error) { + svcs = new(payload.Info_ReadReplicaSvcs) + sbn, ok := d.svcsByName.Load().(map[string]*payload.Info_ReadReplicaSvc) + if !ok { + return nil, errors.ErrInvalidDiscoveryCache + } + + if req.GetName() != "" && req.GetName() != "*" { + v, ok := sbn[req.GetName()] + if !ok { + return nil, errors.ErrSvcNameNotFound(req.GetName()) + } + svcs.Svcs = append(svcs.Svcs, v) + } else { + for _, svc := range sbn { + svcs.Svcs = append(svcs.Svcs, svc) + } + } + + return svcs, nil +} diff --git a/pkg/discoverer/k8s/service/option.go b/pkg/discoverer/k8s/service/option.go index 426d112348..6bc584c62c 100644 --- a/pkg/discoverer/k8s/service/option.go +++ b/pkg/discoverer/k8s/service/option.go @@ -81,3 +81,12 @@ func WithErrGroup(eg errgroup.Group) Option { return nil } } + +func WithReadReplicaIdKey(key string) Option { + return func(d *discoverer) error { + if key != "" { + d.replicaIdKey = key + } + return nil + } +} diff --git a/pkg/discoverer/k8s/usecase/discovered.go b/pkg/discoverer/k8s/usecase/discovered.go index 35b42eaef9..be35265a80 100644 --- a/pkg/discoverer/k8s/usecase/discovered.go +++ b/pkg/discoverer/k8s/usecase/discovered.go @@ -67,6 +67,7 @@ func New(cfg *config.Data) (r runner.Runner, err error) { service.WithName(cfg.Discoverer.Name), service.WithNamespace(cfg.Discoverer.Namespace), service.WithDialer(der), + service.WithReadReplicaIdKey(cfg.Discoverer.ReadReplicaIdKey), ) if err != nil { return nil, err diff --git a/pkg/gateway/lb/service/gateway.go b/pkg/gateway/lb/service/gateway.go index 7d32364df0..96cb31119d 100644 --- a/pkg/gateway/lb/service/gateway.go +++ b/pkg/gateway/lb/service/gateway.go @@ -69,6 +69,7 @@ func (g *gateway) BroadCast(ctx context.Context, span.End() } }() + // TODO: ここで自然とreadreplicaにもリクエストが送られるようにする? return g.client.GetClient().RangeConcurrent(fctx, -1, func(ictx context.Context, addr string, conn *grpc.ClientConn, copts ...grpc.CallOption, ) (err error) { From 9ead67165abec8567c82261f9eabaa8728b8db64 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Thu, 7 Dec 2023 08:58:51 +0000 Subject: [PATCH 02/27] Build with buf --- apis/docs/v1/docs.md | 272 ++++++++--- apis/grpc/v1/discoverer/discoverer.pb.go | 34 +- apis/grpc/v1/payload/payload.pb.go | 447 ++++++++++-------- apis/proto/v1/payload/payload.proto | 4 +- .../v1/discoverer/discoverer.swagger.json | 4 +- 5 files changed, 492 insertions(+), 269 deletions(-) diff --git a/apis/docs/v1/docs.md b/apis/docs/v1/docs.md index f17fb88015..bd1a81f45e 100644 --- a/apis/docs/v1/docs.md +++ b/apis/docs/v1/docs.md @@ -1012,10 +1012,11 @@ Represent the agent sidecar service. Represent the discoverer service. -| Method Name | Request Type | Response Type | Description | -| ----------- | ---------------------------------------------------------------- | ------------------------------------------------ | ---------------------------------------------------- | -| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | -| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | +| Method Name | Request Type | Response Type | Description | +| --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | +| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | +| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | +| ReadReplicaSvcs | [.payload.v1.Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) | [.payload.v1.Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) | Represent the RPC to get the readreplica svc information. | @@ -1073,91 +1074,246 @@ Represent the index manager service. ## v1/rpc/errdetails/error_details.proto - + -### Discoverer +### BadRequest -Represent the discoverer service. +Describes violations in a client request. This error type focuses on the +syntactic aspects of the request. -| Method Name | Request Type | Response Type | Description | -| --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | -| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | -| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | -| ReadReplicaSvcs | [.payload.v1.Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) | [.payload.v1.Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) | Represent the RPC to get the readreplica svc information. | +| Field | Type | Label | Description | +| ---------------- | -------------------------------------------------------------- | -------- | --------------------------------------------- | +| field_violations | [BadRequest.FieldViolation](#rpc-v1-BadRequest-FieldViolation) | repeated | Describes all violations in a client request. | - + -

Top

+### BadRequest.FieldViolation -## apis/proto/v1/vald/remove.proto +A message type used to describe a single bad request field. - +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| field | [string](#string) | | A path that leads to a field in the request body. The value will be a sequence of dot-separated identifiers that identify a protocol buffer field. | -### Remove +Consider the following: -Remove service provides ways to remove indexed vectors. +message CreateContactRequest { message EmailAddress { enum Type { TYPE_UNSPECIFIED = 0; HOME = 1; WORK = 2; } -| Method Name | Request Type | Response Type | Description | -| ----------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| Remove | [.payload.v1.Remove.Request](#payload-v1-Remove-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to remove an indexed vector. | -| RemoveByTimestamp | [.payload.v1.Remove.TimestampRequest](#payload-v1-Remove-TimestampRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to remove an indexed vector based on timestamp. | -| StreamRemove | [.payload.v1.Remove.Request](#payload-v1-Remove-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to remove multiple indexed vectors by bidirectional streaming. | -| MultiRemove | [.payload.v1.Remove.MultiRequest](#payload-v1-Remove-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to remove multiple indexed vectors in a single request. | +optional string email = 1; repeated EmailType type = 2; } - +string full_name = 1; repeated EmailAddress email_addresses = 2; } -

Top

+In this example, in proto `field` could take one of the following values: -## apis/proto/v1/vald/insert.proto +- `full_name` for a violation in the `full_name` value _ `email_addresses[1].email` for a violation in the `email` field of the first `email_addresses` message _ `email_addresses[3].type[2]` for a violation in the second `type` value in the third `email_addresses` message. - +In JSON, the same values are represented as: -### Insert +- `fullName` for a violation in the `fullName` value _ `emailAddresses[1].email` for a violation in the `email` field of the first `emailAddresses` message _ `emailAddresses[3].type[2]` for a violation in the second `type` value in the third `emailAddresses` message. | + | description | [string](#string) | | A description of why the request element is bad. | -Insert service provides ways to add new vectors. + -| Method Name | Request Type | Response Type | Description | -| ------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------- | -| Insert | [.payload.v1.Insert.Request](#payload-v1-Insert-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to add a new single vector. | -| StreamInsert | [.payload.v1.Insert.Request](#payload-v1-Insert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to add new multiple vectors by bidirectional streaming. | -| MultiInsert | [.payload.v1.Insert.MultiRequest](#payload-v1-Insert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to add new multiple vectors in a single request. | +### DebugInfo - +Describes additional debugging info. -

Top

+| Field | Type | Label | Description | +| ------------- | ----------------- | -------- | ------------------------------------------------------------ | +| stack_entries | [string](#string) | repeated | The stack trace entries indicating where the error occurred. | +| detail | [string](#string) | | Additional debugging information provided by the server. | -## apis/proto/v1/vald/upsert.proto + - +### ErrorInfo -### Upsert +Describes the cause of the error with structured details. -Upsert service provides ways to insert/update vectors. +Example of an error when contacting the "pubsub.googleapis.com" API when it +is not enabled: -| Method Name | Request Type | Response Type | Description | -| ------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| Upsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to insert/update a vector. | -| StreamUpsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to insert/update multiple vectors by bidirectional streaming. | -| MultiUpsert | [.payload.v1.Upsert.MultiRequest](#payload-v1-Upsert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to insert/update multiple vectors in a single request. | + { "reason": "API_DISABLED" + "domain": "googleapis.com" + "metadata": { + "resource": "projects/123", + "service": "pubsub.googleapis.com" + } + } - +This response indicates that the pubsub.googleapis.com API is not enabled. -

Top

+Example of an error that is returned when attempting to create a Spanner +instance in a region that is out of stock: -## apis/proto/v1/vald/object.proto + { "reason": "STOCKOUT" + "domain": "spanner.googleapis.com", + "metadata": { + "availableRegions": "us-central1,us-east2" + } + } - +| Field | Type | Label | Description | +| -------- | ---------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| reason | [string](#string) | | The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE. | +| domain | [string](#string) | | The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com". | +| metadata | [ErrorInfo.MetadataEntry](#rpc-v1-ErrorInfo-MetadataEntry) | repeated | Additional structured details about this error. | -### Object +Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than {"instanceLimit": "100/request"}, should be returned as, {"instanceLimitPerRequest": "100"}, if the client exceeds the number of instances that can be created in a single (batch) request. | -Object service provides ways to fetch indexed vectors. + -| Method Name | Request Type | Response Type | Description | -| ---------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------- | -| Exists | [.payload.v1.Object.ID](#payload-v1-Object-ID) | [.payload.v1.Object.ID](#payload-v1-Object-ID) | A method to check whether a specified ID is indexed or not. | -| GetObject | [.payload.v1.Object.VectorRequest](#payload-v1-Object-VectorRequest) | [.payload.v1.Object.Vector](#payload-v1-Object-Vector) | A method to fetch a vector. | -| StreamGetObject | [.payload.v1.Object.VectorRequest](#payload-v1-Object-VectorRequest) stream | [.payload.v1.Object.StreamVector](#payload-v1-Object-StreamVector) stream | A method to fetch vectors by bidirectional streaming. | -| StreamListObject | [.payload.v1.Object.List.Request](#payload-v1-Object-List-Request) | [.payload.v1.Object.List.Response](#payload-v1-Object-List-Response) stream | A method to get all the vectors with server streaming | +### ErrorInfo.MetadataEntry + +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| key | [string](#string) | | | +| value | [string](#string) | | | + + + +### Help + +Provides links to documentation or for performing an out of band action. + +For example, if a quota check failed with an error indicating the calling +project hasn't enabled the accessed service, this can contain a URL pointing +directly to the right place in the developer console to flip the bit. + +| Field | Type | Label | Description | +| ----- | ------------------------------ | -------- | ------------------------------------------------------------------------ | +| links | [Help.Link](#rpc-v1-Help-Link) | repeated | URL(s) pointing to additional information on handling the current error. | + + + +### Help.Link + +Describes a URL link. + +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ------------------------------- | +| description | [string](#string) | | Describes what the link offers. | +| url | [string](#string) | | The URL of the link. | + + + +### LocalizedMessage + +Provides a localized error message that is safe to return to the user +which can be attached to an RPC error. + +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| locale | [string](#string) | | The locale used following the specification defined at https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Examples are: "en-US", "fr-CH", "es-MX" | +| message | [string](#string) | | The localized error message in the above locale. | + + + +### PreconditionFailure + +Describes what preconditions have failed. + +For example, if an RPC failed because it required the Terms of Service to be +acknowledged, it could list the terms of service violation in the +PreconditionFailure message. + +| Field | Type | Label | Description | +| ---------- | ---------------------------------------------------------------------- | -------- | -------------------------------------- | +| violations | [PreconditionFailure.Violation](#rpc-v1-PreconditionFailure-Violation) | repeated | Describes all precondition violations. | + + + +### PreconditionFailure.Violation + +A message type used to describe a single precondition failure. + +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | [string](#string) | | The type of PreconditionFailure. We recommend using a service-specific enum type to define the supported precondition violation subjects. For example, "TOS" for "Terms of Service violation". | +| subject | [string](#string) | | The subject, relative to the type, that failed. For example, "google.com/cloud" relative to the "TOS" type would indicate which terms of service is being referenced. | +| description | [string](#string) | | A description of how the precondition failed. Developers can use this description to understand how to fix the failure. | + +For example: "Terms of service not accepted". | + + + +### QuotaFailure + +Describes how a quota check failed. + +For example if a daily limit was exceeded for the calling project, +a service could respond with a QuotaFailure detail containing the project +id and the description of the quota limit that was exceeded. If the +calling project hasn't enabled the service in the developer console, then +a service could respond with the project id and set `service_disabled` +to true. + +Also see RetryInfo and Help types for other details about handling a +quota failure. + +| Field | Type | Label | Description | +| ---------- | -------------------------------------------------------- | -------- | ------------------------------- | +| violations | [QuotaFailure.Violation](#rpc-v1-QuotaFailure-Violation) | repeated | Describes all quota violations. | + + + +### QuotaFailure.Violation + +A message type used to describe a single quota violation. For example, a +daily quota or a custom quota that was exceeded. + +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| subject | [string](#string) | | The subject on which the quota check failed. For example, "clientip:<ip address of client>" or "project:<Google developer project id>". | +| description | [string](#string) | | A description of how the quota check failed. Clients can use this description to find more about the quota configuration in the service's public documentation, or find the relevant quota limit to adjust through developer console. | + +For example: "Service disabled" or "Daily Limit for read operations exceeded". | + + + +### RequestInfo + +Contains metadata about the request that clients can attach when filing a bug +or providing other forms of feedback. + +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| request_id | [string](#string) | | An opaque string that should only be interpreted by the service generating it. For example, it can be used to identify requests in the service's logs. | +| serving_data | [string](#string) | | Any data that was used to serve this request. For example, an encrypted stack trace that can be sent back to the service provider for debugging. | + + + +### ResourceInfo + +Describes the resource that is being accessed. + +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| resource_type | [string](#string) | | A name for the type of resource being accessed, e.g. "sql table", "cloud storage bucket", "file", "Google calendar"; or the type URL of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". | +| resource_name | [string](#string) | | The name of the resource being accessed. For example, a shared calendar name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. | +| owner | [string](#string) | | The owner of the resource (optional). For example, "user:<owner email>" or "project:<Google developer project id>". | +| description | [string](#string) | | Describes what error is encountered when accessing this resource. For example, updating a cloud project may require the `writer` permission on the developer console project. | + + + +### RetryInfo + +Describes when the clients can retry a failed request. Clients could ignore +the recommendation here or retry when this information is missing from error +responses. + +It's always recommended that clients should use exponential backoff when +retrying. + +Clients should wait until `retry_delay` amount of time has passed since +receiving the error response before retrying. If retrying requests also +fail, clients should use an exponential backoff scheme to gradually increase +the delay between retries based on `retry_delay`, until either a maximum +number of retries have been reached or a maximum retry delay cap has been +reached. + +| Field | Type | Label | Description | +| ----------- | ----------------------------------------------------- | ----- | ------------------------------------------------------------------------- | +| retry_delay | [google.protobuf.Duration](#google-protobuf-Duration) | | Clients should wait at least this long between retrying the same request. | diff --git a/apis/grpc/v1/discoverer/discoverer.pb.go b/apis/grpc/v1/discoverer/discoverer.pb.go index 0be32301b0..6607475104 100644 --- a/apis/grpc/v1/discoverer/discoverer.pb.go +++ b/apis/grpc/v1/discoverer/discoverer.pb.go @@ -47,7 +47,7 @@ var file_v1_discoverer_discoverer_proto_rawDesc = []byte{ 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc3, 0x01, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc2, 0x02, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, @@ -59,20 +59,30 @@ var file_v1_discoverer_discoverer_proto_rawDesc = []byte{ 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x63, 0x0a, - 0x20, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, - 0x72, 0x42, 0x0e, 0x56, 0x61, 0x6c, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, - 0x72, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x76, 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x7d, 0x0a, + 0x0f, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, + 0x12, 0x2d, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, + 0x73, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x76, 0x63, 0x73, 0x42, 0x63, 0x0a, 0x20, + 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, + 0x42, 0x0e, 0x56, 0x61, 0x6c, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, + 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, + 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_v1_discoverer_discoverer_proto_goTypes = []interface{}{ - (*payload.Discoverer_Request)(nil), // 0: payload.v1.Discoverer.Request - (*payload.Info_Pods)(nil), // 1: payload.v1.Info.Pods - (*payload.Info_Nodes)(nil), // 2: payload.v1.Info.Nodes + (*payload.Discoverer_Request)(nil), // 0: payload.v1.Discoverer.Request + (*payload.Discoverer_ReadReplicaSvcsRequest)(nil), // 1: payload.v1.Discoverer.ReadReplicaSvcsRequest + (*payload.Info_Pods)(nil), // 2: payload.v1.Info.Pods + (*payload.Info_Nodes)(nil), // 3: payload.v1.Info.Nodes + (*payload.Info_ReadReplicaSvcs)(nil), // 4: payload.v1.Info.ReadReplicaSvcs } var file_v1_discoverer_discoverer_proto_depIdxs = []int32{ 0, // 0: discoverer.v1.Discoverer.Pods:input_type -> payload.v1.Discoverer.Request diff --git a/apis/grpc/v1/payload/payload.pb.go b/apis/grpc/v1/payload/payload.pb.go index cd47f52af5..fc325a2f11 100644 --- a/apis/grpc/v1/payload/payload.pb.go +++ b/apis/grpc/v1/payload/payload.pb.go @@ -3792,7 +3792,7 @@ type Discoverer_ReadReplicaSvcsRequest struct { func (x *Discoverer_ReadReplicaSvcsRequest) Reset() { *x = Discoverer_ReadReplicaSvcsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[64] + mi := &file_v1_payload_payload_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3805,7 +3805,7 @@ func (x *Discoverer_ReadReplicaSvcsRequest) String() string { func (*Discoverer_ReadReplicaSvcsRequest) ProtoMessage() {} func (x *Discoverer_ReadReplicaSvcsRequest) ProtoReflect() protoreflect.Message { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[64] + mi := &file_v1_payload_payload_proto_msgTypes[64] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3818,7 +3818,7 @@ func (x *Discoverer_ReadReplicaSvcsRequest) ProtoReflect() protoreflect.Message // Deprecated: Use Discoverer_ReadReplicaSvcsRequest.ProtoReflect.Descriptor instead. func (*Discoverer_ReadReplicaSvcsRequest) Descriptor() ([]byte, []int) { - return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{8, 1} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{8, 1} } func (x *Discoverer_ReadReplicaSvcsRequest) GetName() string { @@ -3845,7 +3845,7 @@ type Info_Index struct { func (x *Info_Index) Reset() { *x = Info_Index{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[64] + mi := &file_v1_payload_payload_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3858,7 +3858,7 @@ func (x *Info_Index) String() string { func (*Info_Index) ProtoMessage() {} func (x *Info_Index) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[64] + mi := &file_v1_payload_payload_proto_msgTypes[65] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3899,7 +3899,7 @@ type Info_Pod struct { func (x *Info_Pod) Reset() { *x = Info_Pod{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[65] + mi := &file_v1_payload_payload_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3912,7 +3912,7 @@ func (x *Info_Pod) String() string { func (*Info_Pod) ProtoMessage() {} func (x *Info_Pod) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[65] + mi := &file_v1_payload_payload_proto_msgTypes[66] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4000,7 +4000,7 @@ type Info_Node struct { func (x *Info_Node) Reset() { *x = Info_Node{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[66] + mi := &file_v1_payload_payload_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4013,7 +4013,7 @@ func (x *Info_Node) String() string { func (*Info_Node) ProtoMessage() {} func (x *Info_Node) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[66] + mi := &file_v1_payload_payload_proto_msgTypes[67] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4088,7 +4088,7 @@ type Info_ReadReplicaSvc struct { func (x *Info_ReadReplicaSvc) Reset() { *x = Info_ReadReplicaSvc{} if protoimpl.UnsafeEnabled { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[68] + mi := &file_v1_payload_payload_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4101,7 +4101,7 @@ func (x *Info_ReadReplicaSvc) String() string { func (*Info_ReadReplicaSvc) ProtoMessage() {} func (x *Info_ReadReplicaSvc) ProtoReflect() protoreflect.Message { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[68] + mi := &file_v1_payload_payload_proto_msgTypes[68] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4114,7 +4114,7 @@ func (x *Info_ReadReplicaSvc) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_ReadReplicaSvc.ProtoReflect.Descriptor instead. func (*Info_ReadReplicaSvc) Descriptor() ([]byte, []int) { - return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{9, 3} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 3} } func (x *Info_ReadReplicaSvc) GetName() string { @@ -4155,7 +4155,7 @@ type Info_CPU struct { func (x *Info_CPU) Reset() { *x = Info_CPU{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[67] + mi := &file_v1_payload_payload_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4168,7 +4168,7 @@ func (x *Info_CPU) String() string { func (*Info_CPU) ProtoMessage() {} func (x *Info_CPU) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[67] + mi := &file_v1_payload_payload_proto_msgTypes[69] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4181,7 +4181,7 @@ func (x *Info_CPU) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_CPU.ProtoReflect.Descriptor instead. func (*Info_CPU) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 3} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 4} } func (x *Info_CPU) GetLimit() float64 { @@ -4222,7 +4222,7 @@ type Info_Memory struct { func (x *Info_Memory) Reset() { *x = Info_Memory{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[68] + mi := &file_v1_payload_payload_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4235,7 +4235,7 @@ func (x *Info_Memory) String() string { func (*Info_Memory) ProtoMessage() {} func (x *Info_Memory) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[68] + mi := &file_v1_payload_payload_proto_msgTypes[70] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4248,7 +4248,7 @@ func (x *Info_Memory) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Memory.ProtoReflect.Descriptor instead. func (*Info_Memory) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 4} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} } func (x *Info_Memory) GetLimit() float64 { @@ -4285,7 +4285,7 @@ type Info_Pods struct { func (x *Info_Pods) Reset() { *x = Info_Pods{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[69] + mi := &file_v1_payload_payload_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4298,7 +4298,7 @@ func (x *Info_Pods) String() string { func (*Info_Pods) ProtoMessage() {} func (x *Info_Pods) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[69] + mi := &file_v1_payload_payload_proto_msgTypes[71] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4311,7 +4311,7 @@ func (x *Info_Pods) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Pods.ProtoReflect.Descriptor instead. func (*Info_Pods) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} } func (x *Info_Pods) GetPods() []*Info_Pod { @@ -4334,7 +4334,7 @@ type Info_Nodes struct { func (x *Info_Nodes) Reset() { *x = Info_Nodes{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[70] + mi := &file_v1_payload_payload_proto_msgTypes[72] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4347,7 +4347,7 @@ func (x *Info_Nodes) String() string { func (*Info_Nodes) ProtoMessage() {} func (x *Info_Nodes) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[70] + mi := &file_v1_payload_payload_proto_msgTypes[72] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4360,7 +4360,7 @@ func (x *Info_Nodes) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Nodes.ProtoReflect.Descriptor instead. func (*Info_Nodes) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} } func (x *Info_Nodes) GetNodes() []*Info_Node { @@ -4383,7 +4383,7 @@ type Info_ReadReplicaSvcs struct { func (x *Info_ReadReplicaSvcs) Reset() { *x = Info_ReadReplicaSvcs{} if protoimpl.UnsafeEnabled { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[73] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4396,7 +4396,7 @@ func (x *Info_ReadReplicaSvcs) String() string { func (*Info_ReadReplicaSvcs) ProtoMessage() {} func (x *Info_ReadReplicaSvcs) ProtoReflect() protoreflect.Message { - mi := &file_apis_proto_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[73] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4409,7 +4409,7 @@ func (x *Info_ReadReplicaSvcs) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_ReadReplicaSvcs.ProtoReflect.Descriptor instead. func (*Info_ReadReplicaSvcs) Descriptor() ([]byte, []int) { - return file_apis_proto_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} } func (x *Info_ReadReplicaSvcs) GetSvcs() []*Info_ReadReplicaSvc { @@ -4431,7 +4431,7 @@ type Info_IPs struct { func (x *Info_IPs) Reset() { *x = Info_IPs{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[71] + mi := &file_v1_payload_payload_proto_msgTypes[74] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4444,7 +4444,7 @@ func (x *Info_IPs) String() string { func (*Info_IPs) ProtoMessage() {} func (x *Info_IPs) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[71] + mi := &file_v1_payload_payload_proto_msgTypes[74] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4457,7 +4457,7 @@ func (x *Info_IPs) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_IPs.ProtoReflect.Descriptor instead. func (*Info_IPs) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 9} } func (x *Info_IPs) GetIp() []string { @@ -4486,7 +4486,7 @@ type Info_Index_Count struct { func (x *Info_Index_Count) Reset() { *x = Info_Index_Count{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[72] + mi := &file_v1_payload_payload_proto_msgTypes[75] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4499,7 +4499,7 @@ func (x *Info_Index_Count) String() string { func (*Info_Index_Count) ProtoMessage() {} func (x *Info_Index_Count) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[72] + mi := &file_v1_payload_payload_proto_msgTypes[75] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4553,7 +4553,7 @@ type Info_Index_UUID struct { func (x *Info_Index_UUID) Reset() { *x = Info_Index_UUID{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4566,7 +4566,7 @@ func (x *Info_Index_UUID) String() string { func (*Info_Index_UUID) ProtoMessage() {} func (x *Info_Index_UUID) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[76] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4594,7 +4594,7 @@ type Info_Index_UUID_Committed struct { func (x *Info_Index_UUID_Committed) Reset() { *x = Info_Index_UUID_Committed{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[74] + mi := &file_v1_payload_payload_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4607,7 +4607,7 @@ func (x *Info_Index_UUID_Committed) String() string { func (*Info_Index_UUID_Committed) ProtoMessage() {} func (x *Info_Index_UUID_Committed) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[74] + mi := &file_v1_payload_payload_proto_msgTypes[77] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4642,7 +4642,7 @@ type Info_Index_UUID_Uncommitted struct { func (x *Info_Index_UUID_Uncommitted) Reset() { *x = Info_Index_UUID_Uncommitted{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[75] + mi := &file_v1_payload_payload_proto_msgTypes[78] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4655,7 +4655,7 @@ func (x *Info_Index_UUID_Uncommitted) String() string { func (*Info_Index_UUID_Uncommitted) ProtoMessage() {} func (x *Info_Index_UUID_Uncommitted) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[75] + mi := &file_v1_payload_payload_proto_msgTypes[78] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5033,74 +5033,90 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x09, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xba, 0x48, 0x04, 0x2a, 0x02, 0x28, 0x00, 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, - 0x65, 0x22, 0x66, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x1a, - 0x58, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0xe0, 0x07, 0x0a, 0x04, 0x49, 0x6e, - 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, - 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x61, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x61, 0x76, - 0x69, 0x6e, 0x67, 0x1a, 0x4a, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x1a, 0x1f, 0x0a, 0x09, 0x43, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, 0x21, 0x0a, 0x0b, - 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, - 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, - 0xef, 0x01, 0x0a, 0x03, 0x50, 0x6f, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x78, 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, 0x26, 0x0a, - 0x03, 0x63, 0x70, 0x75, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, - 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, - 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, - 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, - 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, - 0x65, 0x1a, 0xe8, 0x01, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, - 0x64, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x26, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, - 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, - 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, - 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x4b, 0x0a, 0x03, - 0x43, 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, - 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, - 0x73, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, - 0x04, 0x70, 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, - 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, + 0x1a, 0x58, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x1a, 0x53, 0x0a, 0x16, 0x52, 0x65, + 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, + 0x8a, 0x09, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, + 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, + 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, + 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x73, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x1a, 0x4a, 0x0a, 0x04, 0x55, 0x55, 0x49, + 0x44, 0x1a, 0x1f, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, + 0x69, 0x64, 0x1a, 0x21, 0x0a, 0x0b, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, 0xef, 0x01, 0x0a, 0x03, 0x50, 0x6f, 0x64, 0x12, 0x19, 0x0a, + 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x78, 0x01, 0x52, + 0x02, 0x69, 0x70, 0x12, 0x26, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, + 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x1a, 0xe8, 0x01, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x26, + 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, + 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, + 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, + 0x64, 0x73, 0x1a, 0x56, 0x0a, 0x0e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x53, 0x76, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, + 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x09, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x69, 0x64, 0x1a, 0x4b, 0x0a, 0x03, 0x43, 0x50, + 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, + 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, - 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, - 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, + 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, + 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x05, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x6e, 0x6f, + 0x64, 0x65, 0x73, 0x1a, 0x50, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x76, 0x63, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, + 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x53, 0x76, 0x63, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, + 0x04, 0x73, 0x76, 0x63, 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, @@ -5125,87 +5141,90 @@ func file_v1_payload_payload_proto_rawDescGZIP() []byte { } var file_v1_payload_payload_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 76) +var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 79) var file_v1_payload_payload_proto_goTypes = []interface{}{ - (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm - (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator - (*Search)(nil), // 2: payload.v1.Search - (*Filter)(nil), // 3: payload.v1.Filter - (*Insert)(nil), // 4: payload.v1.Insert - (*Update)(nil), // 5: payload.v1.Update - (*Upsert)(nil), // 6: payload.v1.Upsert - (*Remove)(nil), // 7: payload.v1.Remove - (*Object)(nil), // 8: payload.v1.Object - (*Control)(nil), // 9: payload.v1.Control - (*Discoverer)(nil), // 10: payload.v1.Discoverer - (*Info)(nil), // 11: payload.v1.Info - (*Empty)(nil), // 12: payload.v1.Empty - (*Search_Request)(nil), // 13: payload.v1.Search.Request - (*Search_MultiRequest)(nil), // 14: payload.v1.Search.MultiRequest - (*Search_IDRequest)(nil), // 15: payload.v1.Search.IDRequest - (*Search_MultiIDRequest)(nil), // 16: payload.v1.Search.MultiIDRequest - (*Search_ObjectRequest)(nil), // 17: payload.v1.Search.ObjectRequest - (*Search_MultiObjectRequest)(nil), // 18: payload.v1.Search.MultiObjectRequest - (*Search_Config)(nil), // 19: payload.v1.Search.Config - (*Search_Response)(nil), // 20: payload.v1.Search.Response - (*Search_Responses)(nil), // 21: payload.v1.Search.Responses - (*Search_StreamResponse)(nil), // 22: payload.v1.Search.StreamResponse - (*Filter_Target)(nil), // 23: payload.v1.Filter.Target - (*Filter_Config)(nil), // 24: payload.v1.Filter.Config - (*Insert_Request)(nil), // 25: payload.v1.Insert.Request - (*Insert_MultiRequest)(nil), // 26: payload.v1.Insert.MultiRequest - (*Insert_ObjectRequest)(nil), // 27: payload.v1.Insert.ObjectRequest - (*Insert_MultiObjectRequest)(nil), // 28: payload.v1.Insert.MultiObjectRequest - (*Insert_Config)(nil), // 29: payload.v1.Insert.Config - (*Update_Request)(nil), // 30: payload.v1.Update.Request - (*Update_MultiRequest)(nil), // 31: payload.v1.Update.MultiRequest - (*Update_ObjectRequest)(nil), // 32: payload.v1.Update.ObjectRequest - (*Update_MultiObjectRequest)(nil), // 33: payload.v1.Update.MultiObjectRequest - (*Update_Config)(nil), // 34: payload.v1.Update.Config - (*Upsert_Request)(nil), // 35: payload.v1.Upsert.Request - (*Upsert_MultiRequest)(nil), // 36: payload.v1.Upsert.MultiRequest - (*Upsert_ObjectRequest)(nil), // 37: payload.v1.Upsert.ObjectRequest - (*Upsert_MultiObjectRequest)(nil), // 38: payload.v1.Upsert.MultiObjectRequest - (*Upsert_Config)(nil), // 39: payload.v1.Upsert.Config - (*Remove_Request)(nil), // 40: payload.v1.Remove.Request - (*Remove_MultiRequest)(nil), // 41: payload.v1.Remove.MultiRequest - (*Remove_TimestampRequest)(nil), // 42: payload.v1.Remove.TimestampRequest - (*Remove_Timestamp)(nil), // 43: payload.v1.Remove.Timestamp - (*Remove_Config)(nil), // 44: payload.v1.Remove.Config - (*Object_VectorRequest)(nil), // 45: payload.v1.Object.VectorRequest - (*Object_Distance)(nil), // 46: payload.v1.Object.Distance - (*Object_StreamDistance)(nil), // 47: payload.v1.Object.StreamDistance - (*Object_ID)(nil), // 48: payload.v1.Object.ID - (*Object_IDs)(nil), // 49: payload.v1.Object.IDs - (*Object_Vector)(nil), // 50: payload.v1.Object.Vector - (*Object_GetTimestampRequest)(nil), // 51: payload.v1.Object.GetTimestampRequest - (*Object_Timestamp)(nil), // 52: payload.v1.Object.Timestamp - (*Object_Vectors)(nil), // 53: payload.v1.Object.Vectors - (*Object_StreamVector)(nil), // 54: payload.v1.Object.StreamVector - (*Object_ReshapeVector)(nil), // 55: payload.v1.Object.ReshapeVector - (*Object_Blob)(nil), // 56: payload.v1.Object.Blob - (*Object_StreamBlob)(nil), // 57: payload.v1.Object.StreamBlob - (*Object_Location)(nil), // 58: payload.v1.Object.Location - (*Object_StreamLocation)(nil), // 59: payload.v1.Object.StreamLocation - (*Object_Locations)(nil), // 60: payload.v1.Object.Locations - (*Object_List)(nil), // 61: payload.v1.Object.List - (*Object_List_Request)(nil), // 62: payload.v1.Object.List.Request - (*Object_List_Response)(nil), // 63: payload.v1.Object.List.Response - (*Control_CreateIndexRequest)(nil), // 64: payload.v1.Control.CreateIndexRequest - (*Discoverer_Request)(nil), // 65: payload.v1.Discoverer.Request - (*Info_Index)(nil), // 66: payload.v1.Info.Index - (*Info_Pod)(nil), // 67: payload.v1.Info.Pod - (*Info_Node)(nil), // 68: payload.v1.Info.Node - (*Info_CPU)(nil), // 69: payload.v1.Info.CPU - (*Info_Memory)(nil), // 70: payload.v1.Info.Memory - (*Info_Pods)(nil), // 71: payload.v1.Info.Pods - (*Info_Nodes)(nil), // 72: payload.v1.Info.Nodes - (*Info_IPs)(nil), // 73: payload.v1.Info.IPs - (*Info_Index_Count)(nil), // 74: payload.v1.Info.Index.Count - (*Info_Index_UUID)(nil), // 75: payload.v1.Info.Index.UUID - (*Info_Index_UUID_Committed)(nil), // 76: payload.v1.Info.Index.UUID.Committed - (*Info_Index_UUID_Uncommitted)(nil), // 77: payload.v1.Info.Index.UUID.Uncommitted - (*status.Status)(nil), // 78: google.rpc.Status + (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm + (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator + (*Search)(nil), // 2: payload.v1.Search + (*Filter)(nil), // 3: payload.v1.Filter + (*Insert)(nil), // 4: payload.v1.Insert + (*Update)(nil), // 5: payload.v1.Update + (*Upsert)(nil), // 6: payload.v1.Upsert + (*Remove)(nil), // 7: payload.v1.Remove + (*Object)(nil), // 8: payload.v1.Object + (*Control)(nil), // 9: payload.v1.Control + (*Discoverer)(nil), // 10: payload.v1.Discoverer + (*Info)(nil), // 11: payload.v1.Info + (*Empty)(nil), // 12: payload.v1.Empty + (*Search_Request)(nil), // 13: payload.v1.Search.Request + (*Search_MultiRequest)(nil), // 14: payload.v1.Search.MultiRequest + (*Search_IDRequest)(nil), // 15: payload.v1.Search.IDRequest + (*Search_MultiIDRequest)(nil), // 16: payload.v1.Search.MultiIDRequest + (*Search_ObjectRequest)(nil), // 17: payload.v1.Search.ObjectRequest + (*Search_MultiObjectRequest)(nil), // 18: payload.v1.Search.MultiObjectRequest + (*Search_Config)(nil), // 19: payload.v1.Search.Config + (*Search_Response)(nil), // 20: payload.v1.Search.Response + (*Search_Responses)(nil), // 21: payload.v1.Search.Responses + (*Search_StreamResponse)(nil), // 22: payload.v1.Search.StreamResponse + (*Filter_Target)(nil), // 23: payload.v1.Filter.Target + (*Filter_Config)(nil), // 24: payload.v1.Filter.Config + (*Insert_Request)(nil), // 25: payload.v1.Insert.Request + (*Insert_MultiRequest)(nil), // 26: payload.v1.Insert.MultiRequest + (*Insert_ObjectRequest)(nil), // 27: payload.v1.Insert.ObjectRequest + (*Insert_MultiObjectRequest)(nil), // 28: payload.v1.Insert.MultiObjectRequest + (*Insert_Config)(nil), // 29: payload.v1.Insert.Config + (*Update_Request)(nil), // 30: payload.v1.Update.Request + (*Update_MultiRequest)(nil), // 31: payload.v1.Update.MultiRequest + (*Update_ObjectRequest)(nil), // 32: payload.v1.Update.ObjectRequest + (*Update_MultiObjectRequest)(nil), // 33: payload.v1.Update.MultiObjectRequest + (*Update_Config)(nil), // 34: payload.v1.Update.Config + (*Upsert_Request)(nil), // 35: payload.v1.Upsert.Request + (*Upsert_MultiRequest)(nil), // 36: payload.v1.Upsert.MultiRequest + (*Upsert_ObjectRequest)(nil), // 37: payload.v1.Upsert.ObjectRequest + (*Upsert_MultiObjectRequest)(nil), // 38: payload.v1.Upsert.MultiObjectRequest + (*Upsert_Config)(nil), // 39: payload.v1.Upsert.Config + (*Remove_Request)(nil), // 40: payload.v1.Remove.Request + (*Remove_MultiRequest)(nil), // 41: payload.v1.Remove.MultiRequest + (*Remove_TimestampRequest)(nil), // 42: payload.v1.Remove.TimestampRequest + (*Remove_Timestamp)(nil), // 43: payload.v1.Remove.Timestamp + (*Remove_Config)(nil), // 44: payload.v1.Remove.Config + (*Object_VectorRequest)(nil), // 45: payload.v1.Object.VectorRequest + (*Object_Distance)(nil), // 46: payload.v1.Object.Distance + (*Object_StreamDistance)(nil), // 47: payload.v1.Object.StreamDistance + (*Object_ID)(nil), // 48: payload.v1.Object.ID + (*Object_IDs)(nil), // 49: payload.v1.Object.IDs + (*Object_Vector)(nil), // 50: payload.v1.Object.Vector + (*Object_GetTimestampRequest)(nil), // 51: payload.v1.Object.GetTimestampRequest + (*Object_Timestamp)(nil), // 52: payload.v1.Object.Timestamp + (*Object_Vectors)(nil), // 53: payload.v1.Object.Vectors + (*Object_StreamVector)(nil), // 54: payload.v1.Object.StreamVector + (*Object_ReshapeVector)(nil), // 55: payload.v1.Object.ReshapeVector + (*Object_Blob)(nil), // 56: payload.v1.Object.Blob + (*Object_StreamBlob)(nil), // 57: payload.v1.Object.StreamBlob + (*Object_Location)(nil), // 58: payload.v1.Object.Location + (*Object_StreamLocation)(nil), // 59: payload.v1.Object.StreamLocation + (*Object_Locations)(nil), // 60: payload.v1.Object.Locations + (*Object_List)(nil), // 61: payload.v1.Object.List + (*Object_List_Request)(nil), // 62: payload.v1.Object.List.Request + (*Object_List_Response)(nil), // 63: payload.v1.Object.List.Response + (*Control_CreateIndexRequest)(nil), // 64: payload.v1.Control.CreateIndexRequest + (*Discoverer_Request)(nil), // 65: payload.v1.Discoverer.Request + (*Discoverer_ReadReplicaSvcsRequest)(nil), // 66: payload.v1.Discoverer.ReadReplicaSvcsRequest + (*Info_Index)(nil), // 67: payload.v1.Info.Index + (*Info_Pod)(nil), // 68: payload.v1.Info.Pod + (*Info_Node)(nil), // 69: payload.v1.Info.Node + (*Info_ReadReplicaSvc)(nil), // 70: payload.v1.Info.ReadReplicaSvc + (*Info_CPU)(nil), // 71: payload.v1.Info.CPU + (*Info_Memory)(nil), // 72: payload.v1.Info.Memory + (*Info_Pods)(nil), // 73: payload.v1.Info.Pods + (*Info_Nodes)(nil), // 74: payload.v1.Info.Nodes + (*Info_ReadReplicaSvcs)(nil), // 75: payload.v1.Info.ReadReplicaSvcs + (*Info_IPs)(nil), // 76: payload.v1.Info.IPs + (*Info_Index_Count)(nil), // 77: payload.v1.Info.Index.Count + (*Info_Index_UUID)(nil), // 78: payload.v1.Info.Index.UUID + (*Info_Index_UUID_Committed)(nil), // 79: payload.v1.Info.Index.UUID.Committed + (*Info_Index_UUID_Uncommitted)(nil), // 80: payload.v1.Info.Index.UUID.Uncommitted + (*status.Status)(nil), // 81: google.rpc.Status } var file_v1_payload_payload_proto_depIdxs = []int32{ 19, // 0: payload.v1.Search.Request.config:type_name -> payload.v1.Search.Config @@ -6058,7 +6077,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index); i { + switch v := v.(*Discoverer_ReadReplicaSvcsRequest); i { case 0: return &v.state case 1: @@ -6070,7 +6089,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Pod); i { + switch v := v.(*Info_Index); i { case 0: return &v.state case 1: @@ -6082,7 +6101,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Node); i { + switch v := v.(*Info_Pod); i { case 0: return &v.state case 1: @@ -6094,7 +6113,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_CPU); i { + switch v := v.(*Info_Node); i { case 0: return &v.state case 1: @@ -6106,7 +6125,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Memory); i { + switch v := v.(*Info_ReadReplicaSvc); i { case 0: return &v.state case 1: @@ -6118,7 +6137,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Pods); i { + switch v := v.(*Info_CPU); i { case 0: return &v.state case 1: @@ -6130,7 +6149,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Nodes); i { + switch v := v.(*Info_Memory); i { case 0: return &v.state case 1: @@ -6142,7 +6161,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_IPs); i { + switch v := v.(*Info_Pods); i { case 0: return &v.state case 1: @@ -6154,7 +6173,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_Count); i { + switch v := v.(*Info_Nodes); i { case 0: return &v.state case 1: @@ -6166,7 +6185,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_UUID); i { + switch v := v.(*Info_ReadReplicaSvcs); i { case 0: return &v.state case 1: @@ -6178,7 +6197,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_UUID_Committed); i { + switch v := v.(*Info_IPs); i { case 0: return &v.state case 1: @@ -6190,6 +6209,42 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info_Index_Count); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_payload_payload_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info_Index_UUID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_payload_payload_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info_Index_UUID_Committed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_payload_payload_proto_msgTypes[78].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Info_Index_UUID_Uncommitted); i { case 0: return &v.state diff --git a/apis/proto/v1/payload/payload.proto b/apis/proto/v1/payload/payload.proto index db9ef69cbb..5984da4ad0 100644 --- a/apis/proto/v1/payload/payload.proto +++ b/apis/proto/v1/payload/payload.proto @@ -502,7 +502,7 @@ message Discoverer { // Represent the dicoverer svc request. message ReadReplicaSvcsRequest { // The svc name to be discovered. - string name = 1 [(validate.rules).string.min_len = 1]; + string name = 1 [(buf.validate.field).string.min_len = 1]; // The namespace to be discovered. string namespace = 2; } @@ -616,7 +616,7 @@ message Info { // Represent the multiple svc information message. message ReadReplicaSvcs { // The multiple node information. - repeated ReadReplicaSvc svcs = 1 [(validate.rules).repeated.min_items = 1]; + repeated ReadReplicaSvc svcs = 1 [(buf.validate.field).repeated.min_items = 1]; } // Represent the multiple IP message. diff --git a/apis/swagger/v1/discoverer/discoverer.swagger.json b/apis/swagger/v1/discoverer/discoverer.swagger.json index ce72492805..d3f47ff53d 100644 --- a/apis/swagger/v1/discoverer/discoverer.swagger.json +++ b/apis/swagger/v1/discoverer/discoverer.swagger.json @@ -90,13 +90,14 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "#/definitions/runtimeError" + "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", + "description": "Represent the dicoverer svc request.", "in": "body", "required": true, "schema": { @@ -282,6 +283,7 @@ "svcs": { "type": "array", "items": { + "type": "object", "$ref": "#/definitions/InfoReadReplicaSvc" }, "description": "The multiple node information." From f21ed68d3f2887de3a19f9f9cc175a98ffd29378 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 01:54:45 +0000 Subject: [PATCH 03/27] Rename --- internal/k8s/readreplica/svc/option.go | 2 +- internal/k8s/readreplica/svc/svc.go | 8 ++++---- pkg/discoverer/k8s/service/discover.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/k8s/readreplica/svc/option.go b/internal/k8s/readreplica/svc/option.go index 4a73404685..7282085bc4 100644 --- a/internal/k8s/readreplica/svc/option.go +++ b/internal/k8s/readreplica/svc/option.go @@ -47,7 +47,7 @@ func WithOnErrorFunc(f func(err error)) Option { } } -func WithOnReconcileFunc(f func(nodes []Svc)) Option { +func WithOnReconcileFunc(f func(nodes []ReadReplicaSvc)) Option { return func(r *reconciler) error { r.onReconcile = f return nil diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go index 6abfb439b1..fa04fead5d 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/readreplica/svc/svc.go @@ -43,11 +43,11 @@ type reconciler struct { namespace string idKey string // readreplica.label_key onError func(err error) - onReconcile func(svcs []Svc) + onReconcile func(svcs []ReadReplicaSvc) lopts []client.ListOption } -type Svc struct { +type ReadReplicaSvc struct { Name string Addr string ReplicaId uint64 @@ -101,7 +101,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return } - svcs := make([]Svc, 0, len(svcList.Items)) + svcs := make([]ReadReplicaSvc, 0, len(svcList.Items)) for _, svc := range svcList.Items { if svc.GetDeletionTimestamp() != nil { log.Debugf("reconcile process will be skipped for node: %s, status: %v, deletion timestamp: %s", @@ -121,7 +121,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re log.Error(err) return reconcile.Result{}, err } - svcs = append(svcs, Svc{ + svcs = append(svcs, ReadReplicaSvc{ Name: svc.GetName(), Addr: svc.Spec.ClusterIP, ReplicaId: id, diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index c3a8ae582c..ec2c3228ce 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -54,7 +54,7 @@ type discoverer struct { nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] - svcs sync.Map[string, svc.Svc] + svcs sync.Map[string, svc.ReadReplicaSvc] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value @@ -185,14 +185,14 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) svc.WithOnErrorFunc(func(err error) { log.Error("failed to reconcile:", err) }), - svc.WithOnReconcileFunc(func(svcs []svc.Svc) { + svc.WithOnReconcileFunc(func(svcs []svc.ReadReplicaSvc) { log.Debugf("svc resource reconciled\t%#v", svcs) svcsmap := make(map[string]struct{}, len(svcs)) for _, svc := range svcs { svcsmap[svc.Name] = struct{}{} d.svcs.Store(svc.Name, svc) } - d.svcs.Range(func(name string, _ svc.Svc) bool { + d.svcs.Range(func(name string, _ svc.ReadReplicaSvc) bool { _, ok := svcsmap[name] if !ok { d.svcs.Delete(name) @@ -330,7 +330,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.svcs.Range(func(key string, svc svc.Svc) bool { + d.svcs.Range(func(key string, svc svc.ReadReplicaSvc) bool { select { case <-ctx.Done(): return false From 73cd94af1c588aaa3bbe1bfa28f9f0d811b0b3f3 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 01:54:52 +0000 Subject: [PATCH 04/27] Update configmap --- charts/vald/templates/discoverer/configmap.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/vald/templates/discoverer/configmap.yaml b/charts/vald/templates/discoverer/configmap.yaml index 94c4551630..27eeef8c4a 100644 --- a/charts/vald/templates/discoverer/configmap.yaml +++ b/charts/vald/templates/discoverer/configmap.yaml @@ -15,6 +15,7 @@ # {{- $discoverer := .Values.discoverer -}} {{- $agent := .Values.agent -}} +{{- $readreplica := .Values.agent.readreplica -}} {{- if $discoverer.enabled }} apiVersion: v1 kind: ConfigMap @@ -48,6 +49,12 @@ data: selectors: {{- $selectors := dict "Values" $discoverer.discoverer.selectors "chart" . "agent" $agent }} {{- include "vald.discoverer.selector" $selectors | nindent 10 }} + {{- if $readreplica.enabled }} + readreplica_svc: + labels: + app.kubernetes.io/component: {{ $readreplica.component_name | quote }} + read_replica_id_key: {{ $readreplica.label_key | quote }} + {{- end }} net: {{- toYaml $discoverer.discoverer.net | nindent 8 }} {{- end }} From a3b3ba5d9a74e0504f449d6740e0d687b0a0de84 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 04:06:08 +0000 Subject: [PATCH 05/27] Removed unnecessary indexing --- internal/k8s/readreplica/svc/svc.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go index fa04fead5d..346f19728f 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/readreplica/svc/svc.go @@ -143,15 +143,6 @@ func (r *reconciler) NewReconciler(_ context.Context, mgr manager.Manager) recon r.mgr = mgr } corev1.AddToScheme(r.mgr.GetScheme()) - if err := r.mgr.GetFieldIndexer().IndexField(context.Background(), &corev1.Service{}, "status.phase", func(obj client.Object) []string { - node, ok := obj.(*corev1.Node) - if !ok || node.GetDeletionTimestamp() != nil { - return nil - } - return []string{string(node.Status.Phase)} - }); err != nil { - log.Error(err) - } return r } From 5ca7edf7d047fea233076a6e973e10b66f2aefa0 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 04:17:54 +0000 Subject: [PATCH 06/27] Lint --- internal/config/discoverer.go | 2 +- internal/k8s/readreplica/svc/svc.go | 10 +++++----- pkg/discoverer/k8s/service/discover.go | 6 +++--- pkg/discoverer/k8s/service/option.go | 4 ++-- pkg/discoverer/k8s/usecase/discovered.go | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/config/discoverer.go b/internal/config/discoverer.go index ed8575d2a0..bb3a37ab49 100644 --- a/internal/config/discoverer.go +++ b/internal/config/discoverer.go @@ -24,7 +24,7 @@ type Discoverer struct { DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` Net *Net `json:"net,omitempty" yaml:"net"` Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` - ReadReplicaIdKey string `json:"read_replica_id_key,omitempty" yaml:"read_replica_id_key"` + ReadReplicaIDKey string `json:"read_replica_id_key,omitempty" yaml:"read_replica_id_key"` } type Selectors struct { diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go index 346f19728f..2b14b13fb0 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/readreplica/svc/svc.go @@ -50,7 +50,7 @@ type reconciler struct { type ReadReplicaSvc struct { Name string Addr string - ReplicaId uint64 + ReplicaID uint64 } func New(readreplicaLabel map[string]string, idKey string, opts ...Option) SvcWatcher { @@ -90,7 +90,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re } res = reconcile.Result{ Requeue: true, - RequeueAfter: time.Millisecond * 100, + RequeueAfter: time.Millisecond * 100, //nolint:gomnd } if errors.IsNotFound(err) { res = reconcile.Result{ @@ -98,7 +98,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re RequeueAfter: time.Second, } } - return + return res, err } svcs := make([]ReadReplicaSvc, 0, len(svcList.Items)) @@ -124,14 +124,14 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re svcs = append(svcs, ReadReplicaSvc{ Name: svc.GetName(), Addr: svc.Spec.ClusterIP, - ReplicaId: id, + ReplicaID: id, }) } if r.onReconcile != nil { r.onReconcile(svcs) } - return + return res, nil } func (r *reconciler) GetName() string { diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index ec2c3228ce..e2067207f3 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -66,7 +66,7 @@ type discoverer struct { csd time.Duration der net.Dialer eg errgroup.Group - replicaIdKey string + replicaIDKey string } func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) { @@ -180,7 +180,7 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) )), k8s.WithResourceController(svc.New( selector.GetReadReplicaSvcLabels(), - d.replicaIdKey, + d.replicaIDKey, svc.WithControllerName("readreplica svc discoverer"), svc.WithOnErrorFunc(func(err error) { log.Error("failed to reconcile:", err) @@ -338,7 +338,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { ni := &payload.Info_ReadReplicaSvc{ Name: svc.Name, Addr: svc.Addr, - Replicaid: svc.ReplicaId, + Replicaid: svc.ReplicaID, } svcsByName[svc.Name] = ni return true diff --git a/pkg/discoverer/k8s/service/option.go b/pkg/discoverer/k8s/service/option.go index 6bc584c62c..b0672c3def 100644 --- a/pkg/discoverer/k8s/service/option.go +++ b/pkg/discoverer/k8s/service/option.go @@ -82,10 +82,10 @@ func WithErrGroup(eg errgroup.Group) Option { } } -func WithReadReplicaIdKey(key string) Option { +func WithReadReplicaIDKey(key string) Option { return func(d *discoverer) error { if key != "" { - d.replicaIdKey = key + d.replicaIDKey = key } return nil } diff --git a/pkg/discoverer/k8s/usecase/discovered.go b/pkg/discoverer/k8s/usecase/discovered.go index be35265a80..011a7d5386 100644 --- a/pkg/discoverer/k8s/usecase/discovered.go +++ b/pkg/discoverer/k8s/usecase/discovered.go @@ -67,7 +67,7 @@ func New(cfg *config.Data) (r runner.Runner, err error) { service.WithName(cfg.Discoverer.Name), service.WithNamespace(cfg.Discoverer.Namespace), service.WithDialer(der), - service.WithReadReplicaIdKey(cfg.Discoverer.ReadReplicaIdKey), + service.WithReadReplicaIDKey(cfg.Discoverer.ReadReplicaIDKey), ) if err != nil { return nil, err From 2e826ba48d378acde77985088e3c434be7ca1a21 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 04:22:03 +0000 Subject: [PATCH 07/27] Remove memo --- .../client/v1/client/discoverer/discover.go | 26 ++----------------- pkg/gateway/lb/service/gateway.go | 1 - 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/internal/client/v1/client/discoverer/discover.go b/internal/client/v1/client/discoverer/discover.go index 347ba03207..89a43f2a8c 100644 --- a/internal/client/v1/client/discoverer/discover.go +++ b/internal/client/v1/client/discoverer/discover.go @@ -75,9 +75,7 @@ func (c *client) Start(ctx context.Context) (<-chan error, error) { } ech := make(chan error, 100) - addrs, err := c.dnsDiscovery(ctx, ech) // ひとまずのagent addrsを取得 - // FIXME: readreplica svcのaddrsを取得する - // 起動時にclientから取得できるかわからないのでひとまず推測で取得する + addrs, err := c.dnsDiscovery(ctx, ech) if err != nil { close(ech) return nil, err @@ -85,24 +83,7 @@ func (c *client) Start(ctx context.Context) (<-chan error, error) { c.addrs.Store(&addrs) var aech <-chan error - if c.autoconn { // jidousetuzokusurubaai - // FIXME: - // clientをreadreplicaについても作成する? - // そもそもdiscoverer側にreadreplicaの情報がないので、clientを作成できるのか? - - // その場合どういうグループでgrpc.Newするか。repcalica idごとか? - // そうなると問題なのはreadreplicaについてはidごとのsvcとなっているから - // 全svcのipを集約して、適切にgrpc.Newする必要がある。 - // gatewayはg.client.GetClient().RangeConcurrentでbroadcastするので、 - // broadcastしたい単位でclientを持っておくのが良い すなわち - // 従来のclient, replica id 0のclient, replica id 1のclient, ... という感じで - // それをするためには - // svc -> replica idごとのipaddrsを取得 -> replicaidごとのaddrsに変換 - // - // それのラウンドロビンは誰が管理する? - // それかsvcのラウンドロビンをうまく利用できる? - // - // あとreadreplicaが再起動した後の再接続はどうする? + if c.autoconn { c.client = grpc.New( append( c.opts, @@ -261,9 +242,6 @@ func (c *client) discover(ctx context.Context, ech chan<- error) (err error) { } else { connected, err = c.updateDiscoveryInfo(ctx, ech) } - // FIXME: ここでk8s APIからの取得に失敗した場合に初めてdnsDiscoveryする - // これをreadreplicaに関しては常に行い、しかもagent groupを管理できる形の構造体へ格納する。 - // 普通に考えると connectedを二次元にするか if err != nil { log.Warnf("failed to discover addrs from discoverer API, error: %v,\ttrying to dns discovery from %s...", err, c.dns) connected, err = c.dnsDiscovery(ctx, ech) diff --git a/pkg/gateway/lb/service/gateway.go b/pkg/gateway/lb/service/gateway.go index 96cb31119d..7d32364df0 100644 --- a/pkg/gateway/lb/service/gateway.go +++ b/pkg/gateway/lb/service/gateway.go @@ -69,7 +69,6 @@ func (g *gateway) BroadCast(ctx context.Context, span.End() } }() - // TODO: ここで自然とreadreplicaにもリクエストが送られるようにする? return g.client.GetClient().RangeConcurrent(fctx, -1, func(ictx context.Context, addr string, conn *grpc.ClientConn, copts ...grpc.CallOption, ) (err error) { From 71b1b9cec323953b007ff4b0658fb246f199a47d Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 06:08:34 +0000 Subject: [PATCH 08/27] Allow apimachinery errors since it is currently used in internal/k8s --- .golangci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 338c8214dd..fb0f8b7563 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -185,8 +185,6 @@ linters-settings: desc: "golang.org/x/sync/semaphore is allowed only by internal/sync/semaphore" - pkg: "errors" desc: "errors is allowed only by internal/errors" - - pkg: "k8s.io/apimachinery/pkg/api/errors" - desc: "errors is allowed only by internal/errors" - pkg: "github.com/cockroachdb/errors" desc: "errors is allowed only by internal/errors" - pkg: "github.com/pkg/errors" From a82b0456431e84bddfae831f715f25b2f901342a Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 07:30:05 +0000 Subject: [PATCH 09/27] Fix copy of large value inside loop --- internal/k8s/readreplica/svc/svc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go index 2b14b13fb0..32a4d4d704 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/readreplica/svc/svc.go @@ -102,7 +102,8 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re } svcs := make([]ReadReplicaSvc, 0, len(svcList.Items)) - for _, svc := range svcList.Items { + for i := range svcList.Items { + svc := &svcList.Items[i] if svc.GetDeletionTimestamp() != nil { log.Debugf("reconcile process will be skipped for node: %s, status: %v, deletion timestamp: %s", svc.GetName(), From 432e1691872f5e439fa8692457bd3e6ba4fab192 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Fri, 8 Dec 2023 07:45:51 +0000 Subject: [PATCH 10/27] Skip unavoidable warning --- pkg/discoverer/k8s/service/discover.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index e2067207f3..1ef86df34b 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -211,6 +211,8 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) return d, nil } +// Start starts the discoverer. +// skipcq: GO-R1005 func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { dech, err := d.ctrl.Start(ctx) if err != nil { From 9ed36b64a00312e98e6eb1f83852969197d210b7 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Mon, 11 Dec 2023 05:16:07 +0000 Subject: [PATCH 11/27] fix nits --- internal/k8s/readreplica/svc/option.go | 4 ++-- internal/k8s/readreplica/svc/svc.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/k8s/readreplica/svc/option.go b/internal/k8s/readreplica/svc/option.go index 7282085bc4..6aff9ee682 100644 --- a/internal/k8s/readreplica/svc/option.go +++ b/internal/k8s/readreplica/svc/option.go @@ -14,7 +14,7 @@ // limitations under the License. // -// Package node provides kubernetes node information and preriodically update +// Package svc provides kubernetes svc information and preriodically update package svc import ( @@ -47,7 +47,7 @@ func WithOnErrorFunc(f func(err error)) Option { } } -func WithOnReconcileFunc(f func(nodes []ReadReplicaSvc)) Option { +func WithOnReconcileFunc(f func(svcs []ReadReplicaSvc)) Option { return func(r *reconciler) error { r.onReconcile = f return nil diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/readreplica/svc/svc.go index 32a4d4d704..eacb6e1bfd 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/readreplica/svc/svc.go @@ -105,7 +105,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re for i := range svcList.Items { svc := &svcList.Items[i] if svc.GetDeletionTimestamp() != nil { - log.Debugf("reconcile process will be skipped for node: %s, status: %v, deletion timestamp: %s", + log.Debugf("reconcile process will be skipped for svc: %s, status: %v, deletion timestamp: %s", svc.GetName(), svc.Status, svc.GetDeletionTimestamp()) From ee902b0aaa903a40a5544ef1ef0133b75224cdf8 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Mon, 11 Dec 2023 05:44:46 +0000 Subject: [PATCH 12/27] Validate option --- pkg/discoverer/k8s/service/option.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/discoverer/k8s/service/option.go b/pkg/discoverer/k8s/service/option.go index b0672c3def..9e95800875 100644 --- a/pkg/discoverer/k8s/service/option.go +++ b/pkg/discoverer/k8s/service/option.go @@ -20,6 +20,7 @@ package service import ( "time" + "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/net" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/internal/timeutil" @@ -84,9 +85,10 @@ func WithErrGroup(eg errgroup.Group) Option { func WithReadReplicaIDKey(key string) Option { return func(d *discoverer) error { - if key != "" { - d.replicaIDKey = key + if key == "" { + return errors.NewErrInvalidOption("readReplicaIDKey", key) } + d.replicaIDKey = key return nil } } From 6d870f1e23319056b089a5736a8e9889d71aa201 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Mon, 11 Dec 2023 05:51:03 +0000 Subject: [PATCH 13/27] Gen tests --- internal/config/discoverer_test.go | 390 +++++-- internal/k8s/readreplica/svc/option_test.go | 618 ++++++++++++ internal/k8s/readreplica/svc/svc_test.go | 954 ++++++++++++++++++ .../k8s/handler/grpc/handler_test.go | 142 +++ pkg/discoverer/k8s/service/discover_test.go | 207 ++++ pkg/discoverer/k8s/service/option_test.go | 86 ++ 6 files changed, 2325 insertions(+), 72 deletions(-) create mode 100644 internal/k8s/readreplica/svc/option_test.go create mode 100644 internal/k8s/readreplica/svc/svc_test.go diff --git a/internal/config/discoverer_test.go b/internal/config/discoverer_test.go index afee5b178c..710d97d507 100644 --- a/internal/config/discoverer_test.go +++ b/internal/config/discoverer_test.go @@ -290,10 +290,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -322,6 +323,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -344,6 +346,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -374,10 +377,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetPodFields() @@ -391,10 +395,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -423,6 +428,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -445,6 +451,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -475,10 +482,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetPodLabels() @@ -492,10 +500,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -524,6 +533,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -546,6 +556,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -576,10 +587,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetNodeFields() @@ -593,10 +605,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -625,6 +638,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -647,6 +661,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -677,10 +692,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetNodeLabels() @@ -694,10 +710,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodMetricsFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -726,6 +743,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -748,6 +766,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -778,10 +797,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetPodMetricsFields() @@ -795,10 +815,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodMetricsLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -827,6 +848,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -849,6 +871,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -879,10 +902,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetPodMetricsLabels() @@ -896,10 +920,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeMetricsFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -928,6 +953,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -950,6 +976,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -980,10 +1007,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetNodeMetricsFields() @@ -997,10 +1025,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeMetricsLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want map[string]string @@ -1029,6 +1058,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1051,6 +1081,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1081,10 +1112,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.GetNodeMetricsLabels() @@ -1096,6 +1128,216 @@ func TestDiscovererClient_Bind(t *testing.T) { // } // } // +// func TestSelectors_GetReadReplicaSvcFields(t *testing.T) { +// type fields struct { +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector +// } +// type want struct { +// want map[string]string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, map[string]string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got map[string]string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Pod:Selector{}, +// Node:Selector{}, +// NodeMetrics:Selector{}, +// PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Pod:Selector{}, +// Node:Selector{}, +// NodeMetrics:Selector{}, +// PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// s := &Selectors{ +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// } +// +// got := s.GetReadReplicaSvcFields() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestSelectors_GetReadReplicaSvcLabels(t *testing.T) { +// type fields struct { +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector +// } +// type want struct { +// want map[string]string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, map[string]string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got map[string]string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Pod:Selector{}, +// Node:Selector{}, +// NodeMetrics:Selector{}, +// PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Pod:Selector{}, +// Node:Selector{}, +// NodeMetrics:Selector{}, +// PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// s := &Selectors{ +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// } +// +// got := s.GetReadReplicaSvcLabels() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// // func TestSelector_GetLabels(t *testing.T) { // type fields struct { // Labels map[string]string @@ -1284,10 +1526,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_Bind(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// ReadReplicaSvc *Selector // } // type want struct { // want *Selectors @@ -1316,6 +1559,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1338,6 +1582,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, +// ReadReplicaSvc:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1368,10 +1613,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// ReadReplicaSvc: test.fields.ReadReplicaSvc, // } // // got := s.Bind() diff --git a/internal/k8s/readreplica/svc/option_test.go b/internal/k8s/readreplica/svc/option_test.go new file mode 100644 index 0000000000..090bde0fb0 --- /dev/null +++ b/internal/k8s/readreplica/svc/option_test.go @@ -0,0 +1,618 @@ +// Copyright (C) 2019-2023 vdaas.org vald team +// +// 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 +// +// https://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 svc + +// NOT IMPLEMENTED BELOW +// +// func TestWithControllerName(t *testing.T) { +// type args struct { +// name string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// name:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// name:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithControllerName(test.args.name) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithManager(t *testing.T) { +// type args struct { +// mgr manager.Manager +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// mgr:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// mgr:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithManager(test.args.mgr) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithOnErrorFunc(t *testing.T) { +// type args struct { +// f func(err error) +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// f:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// f:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithOnErrorFunc(test.args.f) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithOnReconcileFunc(t *testing.T) { +// type args struct { +// f func(svcs []ReadReplicaSvc) +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// f:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// f:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithOnReconcileFunc(test.args.f) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithNamespace(t *testing.T) { +// type args struct { +// ns string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ns:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ns:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithNamespace(test.args.ns) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithLabels(t *testing.T) { +// type args struct { +// ls map[string]string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ls:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ls:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithLabels(test.args.ls) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestWithFields(t *testing.T) { +// type args struct { +// fs map[string]string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// fs:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// fs:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithFields(test.args.fs) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } diff --git a/internal/k8s/readreplica/svc/svc_test.go b/internal/k8s/readreplica/svc/svc_test.go new file mode 100644 index 0000000000..96955bf1bc --- /dev/null +++ b/internal/k8s/readreplica/svc/svc_test.go @@ -0,0 +1,954 @@ +// Copyright (C) 2019-2023 vdaas.org vald team +// +// 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 +// +// https://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 svc + +import ( + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +// NOT IMPLEMENTED BELOW +// +// func TestNew(t *testing.T) { +// type args struct { +// readreplicaLabel map[string]string +// idKey string +// opts []Option +// } +// type want struct { +// want SvcWatcher +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, SvcWatcher) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got SvcWatcher) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// readreplicaLabel:nil, +// idKey:"", +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// readreplicaLabel:nil, +// idKey:"", +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := New(test.args.readreplicaLabel, test.args.idKey, test.args.opts...) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_addListOpts(t *testing.T) { +// type args struct { +// opt client.ListOption +// } +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// opt:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// opt:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// r.addListOpts(test.args.opt) +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_reconciler_Reconcile(t *testing.T) { +// type args struct { +// ctx context.Context +// in1 reconcile.Request +// } +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// wantRes reconcile.Result +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, reconcile.Result, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, gotRes reconcile.Result, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotRes, w.wantRes) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ctx:nil, +// in1:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ctx:nil, +// in1:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// gotRes, err := r.Reconcile(test.args.ctx, test.args.in1) +// if err := checkFunc(test.want, gotRes, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_GetName(t *testing.T) { +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// got := r.GetName() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_NewReconciler(t *testing.T) { +// type args struct { +// in0 context.Context +// mgr manager.Manager +// } +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// want reconcile.Reconciler +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, reconcile.Reconciler) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got reconcile.Reconciler) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// in0:nil, +// mgr:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// in0:nil, +// mgr:nil, +// }, +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// got := r.NewReconciler(test.args.in0, test.args.mgr) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_For(t *testing.T) { +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// want client.Object +// want1 []builder.ForOption +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, client.Object, []builder.ForOption) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got client.Object, got1 []builder.ForOption) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// if !reflect.DeepEqual(got1, w.want1) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got1, w.want1) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// got, got1 := r.For() +// if err := checkFunc(test.want, got, got1); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_Owns(t *testing.T) { +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// want client.Object +// want1 []builder.OwnsOption +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, client.Object, []builder.OwnsOption) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got client.Object, got1 []builder.OwnsOption) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// if !reflect.DeepEqual(got1, w.want1) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got1, w.want1) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// got, got1 := r.Owns() +// if err := checkFunc(test.want, got, got1); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func Test_reconciler_Watches(t *testing.T) { +// type fields struct { +// mgr manager.Manager +// name string +// namespace string +// idKey string +// onError func(err error) +// onReconcile func(svcs []ReadReplicaSvc) +// lopts []client.ListOption +// } +// type want struct { +// want client.Object +// want1 handler.EventHandler +// want2 []builder.WatchesOption +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, client.Object, handler.EventHandler, []builder.WatchesOption) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got client.Object, got1 handler.EventHandler, got2 []builder.WatchesOption) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// if !reflect.DeepEqual(got1, w.want1) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got1, w.want1) +// } +// if !reflect.DeepEqual(got2, w.want2) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got2, w.want2) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// mgr:nil, +// name:"", +// namespace:"", +// idKey:"", +// onError:nil, +// onReconcile:nil, +// lopts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &reconciler{ +// mgr: test.fields.mgr, +// name: test.fields.name, +// namespace: test.fields.namespace, +// idKey: test.fields.idKey, +// onError: test.fields.onError, +// onReconcile: test.fields.onReconcile, +// lopts: test.fields.lopts, +// } +// +// got, got1, got2 := r.Watches() +// if err := checkFunc(test.want, got, got1, got2); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } diff --git a/pkg/discoverer/k8s/handler/grpc/handler_test.go b/pkg/discoverer/k8s/handler/grpc/handler_test.go index 582f913ad5..705f0115c5 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler_test.go +++ b/pkg/discoverer/k8s/handler/grpc/handler_test.go @@ -117,6 +117,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] +// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -147,6 +148,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -174,6 +176,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -210,6 +213,7 @@ package grpc // dsc: test.fields.dsc, // pgroup: test.fields.pgroup, // ngroup: test.fields.ngroup, +// sgroup: test.fields.sgroup, // ip: test.fields.ip, // name: test.fields.name, // UnimplementedDiscovererServer: test.fields.UnimplementedDiscovererServer, @@ -232,6 +236,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] +// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -271,6 +276,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -299,6 +305,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -335,6 +342,7 @@ package grpc // dsc: test.fields.dsc, // pgroup: test.fields.pgroup, // ngroup: test.fields.ngroup, +// sgroup: test.fields.sgroup, // ip: test.fields.ip, // name: test.fields.name, // UnimplementedDiscovererServer: test.fields.UnimplementedDiscovererServer, @@ -358,6 +366,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] +// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -397,6 +406,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -425,6 +435,7 @@ package grpc // dsc:nil, // pgroup:nil, // ngroup:nil, +// sgroup:nil, // ip:"", // name:"", // UnimplementedDiscovererServer:nil, @@ -461,6 +472,7 @@ package grpc // dsc: test.fields.dsc, // pgroup: test.fields.pgroup, // ngroup: test.fields.ngroup, +// sgroup: test.fields.sgroup, // ip: test.fields.ip, // name: test.fields.name, // UnimplementedDiscovererServer: test.fields.UnimplementedDiscovererServer, @@ -474,3 +486,133 @@ package grpc // }) // } // } +// +// func Test_server_ReadReplicaSvcs(t *testing.T) { +// type args struct { +// ctx context.Context +// req *payload.Discoverer_ReadReplicaSvcsRequest +// } +// type fields struct { +// dsc service.Discoverer +// pgroup singleflight.Group[*payload.Info_Pods] +// ngroup singleflight.Group[*payload.Info_Nodes] +// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] +// ip string +// name string +// UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer +// } +// type want struct { +// want *payload.Info_ReadReplicaSvcs +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, *payload.Info_ReadReplicaSvcs, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got *payload.Info_ReadReplicaSvcs, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ctx:nil, +// req:nil, +// }, +// fields: fields { +// dsc:nil, +// pgroup:nil, +// ngroup:nil, +// sgroup:nil, +// ip:"", +// name:"", +// UnimplementedDiscovererServer:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ctx:nil, +// req:nil, +// }, +// fields: fields { +// dsc:nil, +// pgroup:nil, +// ngroup:nil, +// sgroup:nil, +// ip:"", +// name:"", +// UnimplementedDiscovererServer:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// s := &server{ +// dsc: test.fields.dsc, +// pgroup: test.fields.pgroup, +// ngroup: test.fields.ngroup, +// sgroup: test.fields.sgroup, +// ip: test.fields.ip, +// name: test.fields.name, +// UnimplementedDiscovererServer: test.fields.UnimplementedDiscovererServer, +// } +// +// got, err := s.ReadReplicaSvcs(test.args.ctx, test.args.req) +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } diff --git a/pkg/discoverer/k8s/service/discover_test.go b/pkg/discoverer/k8s/service/discover_test.go index 29540eb022..da91e861dd 100644 --- a/pkg/discoverer/k8s/service/discover_test.go +++ b/pkg/discoverer/k8s/service/discover_test.go @@ -122,16 +122,19 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] +// svcs sync.Map[string, svc.ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value // nodeByName atomic.Value +// svcsByName atomic.Value // ctrl k8s.Controller // namespace string // name string // csd time.Duration // der net.Dialer // eg errgroup.Group +// replicaIDKey string // } // type want struct { // want <-chan error @@ -169,16 +172,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -205,16 +211,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -250,16 +259,19 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, +// svcs: test.fields.svcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, // nodeByName: test.fields.nodeByName, +// svcsByName: test.fields.svcsByName, // ctrl: test.fields.ctrl, // namespace: test.fields.namespace, // name: test.fields.name, // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, +// replicaIDKey: test.fields.replicaIDKey, // } // // got, err := d.Start(test.args.ctx) @@ -281,16 +293,19 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] +// svcs sync.Map[string, svc.ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value // nodeByName atomic.Value +// svcsByName atomic.Value // ctrl k8s.Controller // namespace string // name string // csd time.Duration // der net.Dialer // eg errgroup.Group +// replicaIDKey string // } // type want struct { // wantPods *payload.Info_Pods @@ -328,16 +343,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -364,16 +382,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -409,16 +430,19 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, +// svcs: test.fields.svcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, // nodeByName: test.fields.nodeByName, +// svcsByName: test.fields.svcsByName, // ctrl: test.fields.ctrl, // namespace: test.fields.namespace, // name: test.fields.name, // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, +// replicaIDKey: test.fields.replicaIDKey, // } // // gotPods, err := d.GetPods(test.args.req) @@ -440,16 +464,19 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] +// svcs sync.Map[string, svc.ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value // nodeByName atomic.Value +// svcsByName atomic.Value // ctrl k8s.Controller // namespace string // name string // csd time.Duration // der net.Dialer // eg errgroup.Group +// replicaIDKey string // } // type want struct { // wantNodes *payload.Info_Nodes @@ -487,16 +514,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -523,16 +553,19 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, +// svcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, // nodeByName:nil, +// svcsByName:nil, // ctrl:nil, // namespace:"", // name:"", // csd:nil, // der:nil, // eg:nil, +// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -568,16 +601,19 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, +// svcs: test.fields.svcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, // nodeByName: test.fields.nodeByName, +// svcsByName: test.fields.svcsByName, // ctrl: test.fields.ctrl, // namespace: test.fields.namespace, // name: test.fields.name, // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, +// replicaIDKey: test.fields.replicaIDKey, // } // // gotNodes, err := d.GetNodes(test.args.req) @@ -588,3 +624,174 @@ package service // }) // } // } +// +// func Test_discoverer_GetReadReplicaSvcs(t *testing.T) { +// type args struct { +// req *payload.Discoverer_ReadReplicaSvcsRequest +// } +// type fields struct { +// maxPods int +// nodes sync.Map[string, *node.Node] +// nodeMetrics sync.Map[string, mnode.Node] +// pods sync.Map[string, *[]pod.Pod] +// podMetrics sync.Map[string, mpod.Pod] +// svcs sync.Map[string, svc.ReadReplicaSvc] +// podsByNode atomic.Value +// podsByNamespace atomic.Value +// podsByName atomic.Value +// nodeByName atomic.Value +// svcsByName atomic.Value +// ctrl k8s.Controller +// namespace string +// name string +// csd time.Duration +// der net.Dialer +// eg errgroup.Group +// replicaIDKey string +// } +// type want struct { +// wantSvcs *payload.Info_ReadReplicaSvcs +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, *payload.Info_ReadReplicaSvcs, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, gotSvcs *payload.Info_ReadReplicaSvcs, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotSvcs, w.wantSvcs) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotSvcs, w.wantSvcs) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// req:nil, +// }, +// fields: fields { +// maxPods:0, +// nodes:nil, +// nodeMetrics:nil, +// pods:nil, +// podMetrics:nil, +// svcs:nil, +// podsByNode:nil, +// podsByNamespace:nil, +// podsByName:nil, +// nodeByName:nil, +// svcsByName:nil, +// ctrl:nil, +// namespace:"", +// name:"", +// csd:nil, +// der:nil, +// eg:nil, +// replicaIDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// req:nil, +// }, +// fields: fields { +// maxPods:0, +// nodes:nil, +// nodeMetrics:nil, +// pods:nil, +// podMetrics:nil, +// svcs:nil, +// podsByNode:nil, +// podsByNamespace:nil, +// podsByName:nil, +// nodeByName:nil, +// svcsByName:nil, +// ctrl:nil, +// namespace:"", +// name:"", +// csd:nil, +// der:nil, +// eg:nil, +// replicaIDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// d := &discoverer{ +// maxPods: test.fields.maxPods, +// nodes: test.fields.nodes, +// nodeMetrics: test.fields.nodeMetrics, +// pods: test.fields.pods, +// podMetrics: test.fields.podMetrics, +// svcs: test.fields.svcs, +// podsByNode: test.fields.podsByNode, +// podsByNamespace: test.fields.podsByNamespace, +// podsByName: test.fields.podsByName, +// nodeByName: test.fields.nodeByName, +// svcsByName: test.fields.svcsByName, +// ctrl: test.fields.ctrl, +// namespace: test.fields.namespace, +// name: test.fields.name, +// csd: test.fields.csd, +// der: test.fields.der, +// eg: test.fields.eg, +// replicaIDKey: test.fields.replicaIDKey, +// } +// +// gotSvcs, err := d.GetReadReplicaSvcs(test.args.req) +// if err := checkFunc(test.want, gotSvcs, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } diff --git a/pkg/discoverer/k8s/service/option_test.go b/pkg/discoverer/k8s/service/option_test.go index 303de17430..8bf18ce231 100644 --- a/pkg/discoverer/k8s/service/option_test.go +++ b/pkg/discoverer/k8s/service/option_test.go @@ -448,3 +448,89 @@ package service // }) // } // } +// +// func TestWithReadReplicaIDKey(t *testing.T) { +// type args struct { +// key string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// key:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// key:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithReadReplicaIDKey(test.args.key) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } From 2725af5d3133bc8f0b0373864dc79d59bce64065 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 12 Dec 2023 04:50:18 +0000 Subject: [PATCH 14/27] Make read replica svc reconciler more generic --- internal/k8s/{readreplica => }/svc/option.go | 2 +- .../k8s/{readreplica => }/svc/option_test.go | 2 +- internal/k8s/{readreplica => }/svc/svc.go | 40 +++----------- .../k8s/{readreplica => }/svc/svc_test.go | 52 ++++--------------- pkg/discoverer/k8s/service/discover.go | 52 ++++++++++++++----- pkg/discoverer/k8s/service/discover_test.go | 8 +-- 6 files changed, 62 insertions(+), 94 deletions(-) rename internal/k8s/{readreplica => }/svc/option.go (96%) rename internal/k8s/{readreplica => }/svc/option_test.go (99%) rename internal/k8s/{readreplica => }/svc/svc.go (77%) rename internal/k8s/{readreplica => }/svc/svc_test.go (94%) diff --git a/internal/k8s/readreplica/svc/option.go b/internal/k8s/svc/option.go similarity index 96% rename from internal/k8s/readreplica/svc/option.go rename to internal/k8s/svc/option.go index 6aff9ee682..5ac3e644c4 100644 --- a/internal/k8s/readreplica/svc/option.go +++ b/internal/k8s/svc/option.go @@ -47,7 +47,7 @@ func WithOnErrorFunc(f func(err error)) Option { } } -func WithOnReconcileFunc(f func(svcs []ReadReplicaSvc)) Option { +func WithOnReconcileFunc(f func(svcs []Svc)) Option { return func(r *reconciler) error { r.onReconcile = f return nil diff --git a/internal/k8s/readreplica/svc/option_test.go b/internal/k8s/svc/option_test.go similarity index 99% rename from internal/k8s/readreplica/svc/option_test.go rename to internal/k8s/svc/option_test.go index 090bde0fb0..c1ac91b06a 100644 --- a/internal/k8s/readreplica/svc/option_test.go +++ b/internal/k8s/svc/option_test.go @@ -275,7 +275,7 @@ package svc // // func TestWithOnReconcileFunc(t *testing.T) { // type args struct { -// f func(svcs []ReadReplicaSvc) +// f func(svcs []Svc) // } // type want struct { // want Option diff --git a/internal/k8s/readreplica/svc/svc.go b/internal/k8s/svc/svc.go similarity index 77% rename from internal/k8s/readreplica/svc/svc.go rename to internal/k8s/svc/svc.go index eacb6e1bfd..49e7949e17 100644 --- a/internal/k8s/readreplica/svc/svc.go +++ b/internal/k8s/svc/svc.go @@ -19,8 +19,6 @@ package svc import ( "context" - "fmt" - "strconv" "time" "github.com/vdaas/vald/internal/k8s" @@ -35,33 +33,26 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -type SvcWatcher k8s.ResourceController +type ( + SvcWatcher k8s.ResourceController + Svc = corev1.Service +) type reconciler struct { mgr manager.Manager name string namespace string - idKey string // readreplica.label_key onError func(err error) - onReconcile func(svcs []ReadReplicaSvc) + onReconcile func(svcs []Svc) lopts []client.ListOption } -type ReadReplicaSvc struct { - Name string - Addr string - ReplicaID uint64 -} - -func New(readreplicaLabel map[string]string, idKey string, opts ...Option) SvcWatcher { +func New(opts ...Option) SvcWatcher { r := new(reconciler) - - opts = append(opts, WithLabels(readreplicaLabel)) for _, opt := range append(defaultOptions, opts...) { opt(r) } - r.idKey = idKey return r } @@ -101,7 +92,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return res, err } - svcs := make([]ReadReplicaSvc, 0, len(svcList.Items)) + svcs := make([]Svc, 0, len(svcList.Items)) for i := range svcList.Items { svc := &svcList.Items[i] if svc.GetDeletionTimestamp() != nil { @@ -111,22 +102,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re svc.GetDeletionTimestamp()) continue } - labels := svc.GetLabels() - v, ok := labels[r.idKey] - if !ok { - log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), r.idKey) - return reconcile.Result{}, fmt.Errorf("no valid label is put in the svc") - } - id, err := strconv.ParseUint(v, 10, 32) - if err != nil { - log.Error(err) - return reconcile.Result{}, err - } - svcs = append(svcs, ReadReplicaSvc{ - Name: svc.GetName(), - Addr: svc.Spec.ClusterIP, - ReplicaID: id, - }) + svcs = append(svcs, *svc) } if r.onReconcile != nil { r.onReconcile(svcs) diff --git a/internal/k8s/readreplica/svc/svc_test.go b/internal/k8s/svc/svc_test.go similarity index 94% rename from internal/k8s/readreplica/svc/svc_test.go rename to internal/k8s/svc/svc_test.go index 96955bf1bc..687560d02b 100644 --- a/internal/k8s/readreplica/svc/svc_test.go +++ b/internal/k8s/svc/svc_test.go @@ -21,9 +21,7 @@ import ( // // func TestNew(t *testing.T) { // type args struct { -// readreplicaLabel map[string]string -// idKey string -// opts []Option +// opts []Option // } // type want struct { // want SvcWatcher @@ -48,8 +46,6 @@ import ( // { // name: "test_case_1", // args: args { -// readreplicaLabel:nil, -// idKey:"", // opts:nil, // }, // want: want{}, @@ -69,8 +65,6 @@ import ( // return test { // name: "test_case_2", // args: args { -// readreplicaLabel:nil, -// idKey:"", // opts:nil, // }, // want: want{}, @@ -102,7 +96,7 @@ import ( // checkFunc = defaultCheckFunc // } // -// got := New(test.args.readreplicaLabel, test.args.idKey, test.args.opts...) +// got := New(test.args.opts...) // if err := checkFunc(test.want, got); err != nil { // tt.Errorf("error = %v", err) // } @@ -119,9 +113,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -150,7 +143,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -178,7 +170,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -215,7 +206,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -238,9 +228,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -278,7 +267,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -307,7 +295,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -344,7 +331,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -364,9 +350,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -395,7 +380,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -420,7 +404,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -457,7 +440,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -481,9 +463,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -517,7 +498,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -546,7 +526,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -583,7 +562,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -603,9 +581,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -638,7 +615,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -663,7 +639,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -700,7 +675,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -720,9 +694,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -755,7 +728,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -780,7 +752,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -817,7 +788,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, @@ -837,9 +807,8 @@ import ( // mgr manager.Manager // name string // namespace string -// idKey string // onError func(err error) -// onReconcile func(svcs []ReadReplicaSvc) +// onReconcile func(svcs []Svc) // lopts []client.ListOption // } // type want struct { @@ -876,7 +845,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -901,7 +869,6 @@ import ( // mgr:nil, // name:"", // namespace:"", -// idKey:"", // onError:nil, // onReconcile:nil, // lopts:nil, @@ -938,7 +905,6 @@ import ( // mgr: test.fields.mgr, // name: test.fields.name, // namespace: test.fields.namespace, -// idKey: test.fields.idKey, // onError: test.fields.onError, // onReconcile: test.fields.onReconcile, // lopts: test.fields.lopts, diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 1ef86df34b..e8c46276fc 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -22,6 +22,7 @@ import ( "context" "reflect" "slices" + "strconv" "sync/atomic" "time" @@ -33,7 +34,7 @@ import ( mpod "github.com/vdaas/vald/internal/k8s/metrics/pod" "github.com/vdaas/vald/internal/k8s/node" "github.com/vdaas/vald/internal/k8s/pod" - "github.com/vdaas/vald/internal/k8s/readreplica/svc" + "github.com/vdaas/vald/internal/k8s/svc" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" "github.com/vdaas/vald/internal/safety" @@ -48,13 +49,19 @@ type Discoverer interface { GetReadReplicaSvcs(*payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) } +type readReplicaSvc struct { + Name string + Addr string + ReplicaID uint64 +} + type discoverer struct { maxPods int nodes sync.Map[string, *node.Node] nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] - svcs sync.Map[string, svc.ReadReplicaSvc] + svcs sync.Map[string, readReplicaSvc] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value @@ -69,6 +76,8 @@ type discoverer struct { replicaIDKey string } +// New returns Discoverer implementation. +// skipcq: GO-R1005 func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) { d := new(discoverer) for _, opt := range append(defaultOptions, opts...) { @@ -179,20 +188,37 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithLabels(selector.GetNodeLabels()), )), k8s.WithResourceController(svc.New( - selector.GetReadReplicaSvcLabels(), - d.replicaIDKey, svc.WithControllerName("readreplica svc discoverer"), svc.WithOnErrorFunc(func(err error) { log.Error("failed to reconcile:", err) }), - svc.WithOnReconcileFunc(func(svcs []svc.ReadReplicaSvc) { + svc.WithOnReconcileFunc(func(svcs []svc.Svc) { log.Debugf("svc resource reconciled\t%#v", svcs) svcsmap := make(map[string]struct{}, len(svcs)) - for _, svc := range svcs { + for i := range svcs { + svc := &svcs[i] svcsmap[svc.Name] = struct{}{} - d.svcs.Store(svc.Name, svc) + + labels := svc.GetLabels() + v, ok := labels[d.replicaIDKey] + if !ok { + log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), d.replicaIDKey) + continue + } + id, err := strconv.ParseUint(v, 10, 32) + if err != nil { + log.Errorf("failed to parse readreplica id string to uint: %w", err) + continue + } + + rrsvc := readReplicaSvc{ + Name: svc.GetName(), + Addr: svc.Spec.ClusterIP, + ReplicaID: id, + } + d.svcs.Store(svc.Name, rrsvc) } - d.svcs.Range(func(name string, _ svc.ReadReplicaSvc) bool { + d.svcs.Range(func(name string, _ readReplicaSvc) bool { _, ok := svcsmap[name] if !ok { d.svcs.Delete(name) @@ -332,17 +358,17 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.svcs.Range(func(key string, svc svc.ReadReplicaSvc) bool { + d.svcs.Range(func(key string, rrsvc readReplicaSvc) bool { select { case <-ctx.Done(): return false default: ni := &payload.Info_ReadReplicaSvc{ - Name: svc.Name, - Addr: svc.Addr, - Replicaid: svc.ReplicaID, + Name: rrsvc.Name, + Addr: rrsvc.Addr, + Replicaid: rrsvc.ReplicaID, } - svcsByName[svc.Name] = ni + svcsByName[rrsvc.Name] = ni return true } }) diff --git a/pkg/discoverer/k8s/service/discover_test.go b/pkg/discoverer/k8s/service/discover_test.go index da91e861dd..7650461ffb 100644 --- a/pkg/discoverer/k8s/service/discover_test.go +++ b/pkg/discoverer/k8s/service/discover_test.go @@ -122,7 +122,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, svc.ReadReplicaSvc] +// svcs sync.Map[string, ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -293,7 +293,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, svc.ReadReplicaSvc] +// svcs sync.Map[string, ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -464,7 +464,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, svc.ReadReplicaSvc] +// svcs sync.Map[string, ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -635,7 +635,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, svc.ReadReplicaSvc] +// svcs sync.Map[string, ReadReplicaSvc] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value From 9541de5c6ad99183fe5352d18ef21fa6799baec8 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 12 Dec 2023 06:53:21 +0000 Subject: [PATCH 15/27] Make it possible to disable readreplica discoverer --- .../vald/templates/discoverer/configmap.yaml | 6 +- internal/config/discoverer.go | 53 ++++++- internal/errors/discoverer.go | 3 + pkg/discoverer/k8s/service/discover.go | 133 ++++++++++-------- pkg/discoverer/k8s/service/option.go | 7 + pkg/discoverer/k8s/usecase/discovered.go | 3 +- 6 files changed, 135 insertions(+), 70 deletions(-) diff --git a/charts/vald/templates/discoverer/configmap.yaml b/charts/vald/templates/discoverer/configmap.yaml index 27eeef8c4a..37882b9895 100644 --- a/charts/vald/templates/discoverer/configmap.yaml +++ b/charts/vald/templates/discoverer/configmap.yaml @@ -49,12 +49,12 @@ data: selectors: {{- $selectors := dict "Values" $discoverer.discoverer.selectors "chart" . "agent" $agent }} {{- include "vald.discoverer.selector" $selectors | nindent 10 }} - {{- if $readreplica.enabled }} readreplica_svc: labels: app.kubernetes.io/component: {{ $readreplica.component_name | quote }} - read_replica_id_key: {{ $readreplica.label_key | quote }} - {{- end }} + read_replica: + enabled: {{ $readreplica.enabled }} + id_key: {{ $readreplica.label_key | quote }} net: {{- toYaml $discoverer.discoverer.net | nindent 8 }} {{- end }} diff --git a/internal/config/discoverer.go b/internal/config/discoverer.go index bb3a37ab49..c9594acffc 100644 --- a/internal/config/discoverer.go +++ b/internal/config/discoverer.go @@ -19,12 +19,12 @@ package config // Discoverer represents the Discoverer configurations. type Discoverer struct { - Name string `json:"name,omitempty" yaml:"name"` - Namespace string `json:"namespace,omitempty" yaml:"namespace"` - DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` - Net *Net `json:"net,omitempty" yaml:"net"` - Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` - ReadReplicaIDKey string `json:"read_replica_id_key,omitempty" yaml:"read_replica_id_key"` + Name string `json:"name,omitempty" yaml:"name"` + Namespace string `json:"namespace,omitempty" yaml:"namespace"` + DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` + Net *Net `json:"net,omitempty" yaml:"net"` + Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` + ReadReplica *ReadReplica `json:"read_replica,omitempty" yaml:"read_replica"` } type Selectors struct { @@ -124,6 +124,25 @@ func (s *Selector) GetFields() map[string]string { return s.Fields } +type ReadReplica struct { + Enabled bool `json:"enabled,omitempty" yaml:"enabled"` + IDKey string `json:"id_key,omitempty" yaml:"id_key"` +} + +func (r *ReadReplica) GetEnabled() bool { + if r == nil { + return false + } + return r.Enabled +} + +func (r *ReadReplica) GetIDKey() string { + if r == nil { + return "" + } + return r.IDKey +} + // Bind binds the actual data from the Discoverer receiver field. func (d *Discoverer) Bind() *Discoverer { d.Name = GetActualValue(d.Name) @@ -134,6 +153,19 @@ func (d *Discoverer) Bind() *Discoverer { } else { d.Net = new(Net) } + + if d.Selectors != nil { + d.Selectors.Bind() + } else { + d.Selectors = new(Selectors) + } + + if d.ReadReplica != nil { + d.ReadReplica.Bind() + } else { + d.ReadReplica = new(ReadReplica) + } + return d } @@ -146,6 +178,7 @@ func (s *Selectors) Bind() *Selectors { s.Node = s.Node.Bind() s.PodMetrics = s.PodMetrics.Bind() s.NodeMetrics = s.NodeMetrics.Bind() + s.ReadReplicaSvc = s.ReadReplicaSvc.Bind() return s } @@ -163,6 +196,14 @@ func (s *Selector) Bind() *Selector { return s } +func (r *ReadReplica) Bind() *ReadReplica { + if r == nil { + return new(ReadReplica) + } + r.IDKey = GetActualValue(r.IDKey) + return r +} + // DiscovererClient represents the DiscovererClient configurations. type DiscovererClient struct { Duration string `json:"duration" yaml:"duration"` diff --git a/internal/errors/discoverer.go b/internal/errors/discoverer.go index a01f016c3e..1e4312b144 100644 --- a/internal/errors/discoverer.go +++ b/internal/errors/discoverer.go @@ -45,4 +45,7 @@ var ( // ErrInvalidDiscoveryCache represents an error that type conversion of discovery cache failed. ErrInvalidDiscoveryCache = New("cache type cast failed") + + // ErrReadReplicaDisabled represents an error that read replica is disabled. + ErrReadReplicaDisabled = New("read replica is disabled by config") ) diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index e8c46276fc..5e86415636 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -56,24 +56,25 @@ type readReplicaSvc struct { } type discoverer struct { - maxPods int - nodes sync.Map[string, *node.Node] - nodeMetrics sync.Map[string, mnode.Node] - pods sync.Map[string, *[]pod.Pod] - podMetrics sync.Map[string, mpod.Pod] - svcs sync.Map[string, readReplicaSvc] - podsByNode atomic.Value - podsByNamespace atomic.Value - podsByName atomic.Value - nodeByName atomic.Value - svcsByName atomic.Value - ctrl k8s.Controller - namespace string - name string - csd time.Duration - der net.Dialer - eg errgroup.Group - replicaIDKey string + maxPods int + nodes sync.Map[string, *node.Node] + nodeMetrics sync.Map[string, mnode.Node] + pods sync.Map[string, *[]pod.Pod] + podMetrics sync.Map[string, mpod.Pod] + svcs sync.Map[string, readReplicaSvc] + podsByNode atomic.Value + podsByNamespace atomic.Value + podsByName atomic.Value + nodeByName atomic.Value + svcsByName atomic.Value + ctrl k8s.Controller + namespace string + name string + csd time.Duration + der net.Dialer + eg errgroup.Group + readReplicaEnabled bool + replicaIDKey string } // New returns Discoverer implementation. @@ -90,7 +91,9 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) d.podsByNamespace.Store(make(map[string]map[string][]*payload.Info_Pod)) d.podsByName.Store(make(map[string][]*payload.Info_Pod)) d.nodeByName.Store(make(map[string]*payload.Info_Node)) - d.ctrl, err = k8s.New( + + var k8sOpts []k8s.Option + k8sOpts = append(k8sOpts, k8s.WithDialer(d.der), k8s.WithControllerName("vald k8s agent discoverer"), k8s.WithDisableLeaderElection(), @@ -187,50 +190,57 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithFields(selector.GetNodeFields()), node.WithLabels(selector.GetNodeLabels()), )), - k8s.WithResourceController(svc.New( - svc.WithControllerName("readreplica svc discoverer"), - svc.WithOnErrorFunc(func(err error) { - log.Error("failed to reconcile:", err) - }), - svc.WithOnReconcileFunc(func(svcs []svc.Svc) { - log.Debugf("svc resource reconciled\t%#v", svcs) - svcsmap := make(map[string]struct{}, len(svcs)) - for i := range svcs { - svc := &svcs[i] - svcsmap[svc.Name] = struct{}{} + ) - labels := svc.GetLabels() - v, ok := labels[d.replicaIDKey] - if !ok { - log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), d.replicaIDKey) - continue - } - id, err := strconv.ParseUint(v, 10, 32) - if err != nil { - log.Errorf("failed to parse readreplica id string to uint: %w", err) - continue - } + if d.readReplicaEnabled { + k8sOpts = append(k8sOpts, + k8s.WithResourceController(svc.New( + svc.WithControllerName("readreplica svc discoverer"), + svc.WithOnErrorFunc(func(err error) { + log.Error("failed to reconcile:", err) + }), + svc.WithOnReconcileFunc(func(svcs []svc.Svc) { + log.Debugf("svc resource reconciled\t%#v", svcs) + svcsmap := make(map[string]struct{}, len(svcs)) + for i := range svcs { + svc := &svcs[i] + svcsmap[svc.Name] = struct{}{} - rrsvc := readReplicaSvc{ - Name: svc.GetName(), - Addr: svc.Spec.ClusterIP, - ReplicaID: id, - } - d.svcs.Store(svc.Name, rrsvc) - } - d.svcs.Range(func(name string, _ readReplicaSvc) bool { - _, ok := svcsmap[name] - if !ok { - d.svcs.Delete(name) + labels := svc.GetLabels() + v, ok := labels[d.replicaIDKey] + if !ok { + log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), d.replicaIDKey) + continue + } + id, err := strconv.ParseUint(v, 10, 32) + if err != nil { + log.Errorf("failed to parse readreplica id string to uint: %w", err) + continue + } + + rrsvc := readReplicaSvc{ + Name: svc.GetName(), + Addr: svc.Spec.ClusterIP, + ReplicaID: id, + } + d.svcs.Store(svc.Name, rrsvc) } - return true - }) - }), - svc.WithNamespace(d.namespace), - svc.WithFields(selector.GetReadReplicaSvcFields()), - svc.WithLabels(selector.GetReadReplicaSvcLabels()), - )), - ) + d.svcs.Range(func(name string, _ readReplicaSvc) bool { + _, ok := svcsmap[name] + if !ok { + d.svcs.Delete(name) + } + return true + }) + }), + svc.WithNamespace(d.namespace), + svc.WithFields(selector.GetReadReplicaSvcFields()), + svc.WithLabels(selector.GetReadReplicaSvcLabels()), + )), + ) + } + + d.ctrl, err = k8s.New(k8sOpts...) if err != nil { return nil, err } @@ -562,6 +572,9 @@ func (d *discoverer) GetNodes(req *payload.Discoverer_Request) (nodes *payload.I } func (d *discoverer) GetReadReplicaSvcs(req *payload.Discoverer_ReadReplicaSvcsRequest) (svcs *payload.Info_ReadReplicaSvcs, err error) { + if !d.readReplicaEnabled { + return nil, errors.ErrReadReplicaDisabled + } svcs = new(payload.Info_ReadReplicaSvcs) sbn, ok := d.svcsByName.Load().(map[string]*payload.Info_ReadReplicaSvc) if !ok { diff --git a/pkg/discoverer/k8s/service/option.go b/pkg/discoverer/k8s/service/option.go index 9e95800875..028387cf4d 100644 --- a/pkg/discoverer/k8s/service/option.go +++ b/pkg/discoverer/k8s/service/option.go @@ -83,6 +83,13 @@ func WithErrGroup(eg errgroup.Group) Option { } } +func WithReadReplicaEnabled(enabled bool) Option { + return func(d *discoverer) error { + d.readReplicaEnabled = enabled + return nil + } +} + func WithReadReplicaIDKey(key string) Option { return func(d *discoverer) error { if key == "" { diff --git a/pkg/discoverer/k8s/usecase/discovered.go b/pkg/discoverer/k8s/usecase/discovered.go index 011a7d5386..a6f69a2fc2 100644 --- a/pkg/discoverer/k8s/usecase/discovered.go +++ b/pkg/discoverer/k8s/usecase/discovered.go @@ -67,7 +67,8 @@ func New(cfg *config.Data) (r runner.Runner, err error) { service.WithName(cfg.Discoverer.Name), service.WithNamespace(cfg.Discoverer.Namespace), service.WithDialer(der), - service.WithReadReplicaIDKey(cfg.Discoverer.ReadReplicaIDKey), + service.WithReadReplicaEnabled(cfg.Discoverer.ReadReplica.GetEnabled()), + service.WithReadReplicaIDKey(cfg.Discoverer.ReadReplica.GetIDKey()), ) if err != nil { return nil, err From 7d91adabb39d3ccfe16f01083cb7e039e9a0c647 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 12 Dec 2023 07:12:29 +0000 Subject: [PATCH 16/27] Fix config test --- internal/config/discoverer_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/config/discoverer_test.go b/internal/config/discoverer_test.go index 710d97d507..63a60f89df 100644 --- a/internal/config/discoverer_test.go +++ b/internal/config/discoverer_test.go @@ -31,6 +31,8 @@ func TestDiscoverer_Bind(t *testing.T) { Namespace string DiscoveryDuration string Net *Net + Selectors *Selectors + ReadReplica *ReadReplica } type want struct { want *Discoverer @@ -64,6 +66,8 @@ func TestDiscoverer_Bind(t *testing.T) { Namespace: "vald", DiscoveryDuration: "10ms", Net: new(Net), + Selectors: new(Selectors), + ReadReplica: new(ReadReplica), }, }, } @@ -83,6 +87,8 @@ func TestDiscoverer_Bind(t *testing.T) { Namespace: "vald", DiscoveryDuration: "10ms", Net: new(Net), + Selectors: new(Selectors), + ReadReplica: new(ReadReplica), }, }, } @@ -113,6 +119,8 @@ func TestDiscoverer_Bind(t *testing.T) { Namespace: "vald", DiscoveryDuration: "10ms", Net: new(Net), + Selectors: new(Selectors), + ReadReplica: new(ReadReplica), }, }, } @@ -137,6 +145,9 @@ func TestDiscoverer_Bind(t *testing.T) { Name: test.fields.Name, Namespace: test.fields.Namespace, DiscoveryDuration: test.fields.DiscoveryDuration, + Net: test.fields.Net, + Selectors: test.fields.Selectors, + ReadReplica: test.fields.ReadReplica, } got := d.Bind() From ff76ef8c62ade492f37cfe3bc27ca4ef7f52a01c Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 12 Dec 2023 07:14:50 +0000 Subject: [PATCH 17/27] rename svcs to rrsvcs --- pkg/discoverer/k8s/service/discover.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 5e86415636..aa85ef91d6 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -61,7 +61,7 @@ type discoverer struct { nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] - svcs sync.Map[string, readReplicaSvc] + rrsvcs sync.Map[string, readReplicaSvc] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value @@ -223,12 +223,12 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) Addr: svc.Spec.ClusterIP, ReplicaID: id, } - d.svcs.Store(svc.Name, rrsvc) + d.rrsvcs.Store(svc.Name, rrsvc) } - d.svcs.Range(func(name string, _ readReplicaSvc) bool { + d.rrsvcs.Range(func(name string, _ readReplicaSvc) bool { _, ok := svcsmap[name] if !ok { - d.svcs.Delete(name) + d.rrsvcs.Delete(name) } return true }) @@ -368,7 +368,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.svcs.Range(func(key string, rrsvc readReplicaSvc) bool { + d.rrsvcs.Range(func(key string, rrsvc readReplicaSvc) bool { select { case <-ctx.Done(): return false From 03b95059ff10ec42d993cf41e8cb6592f4221027 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 13 Dec 2023 06:11:57 +0000 Subject: [PATCH 18/27] Update discoverer decoupled from readreplica --- apis/docs/v1/docs.md | 67 +- apis/grpc/v1/discoverer/discoverer.pb.go | 49 +- .../v1/discoverer/discoverer_vtproto.pb.go | 28 +- apis/grpc/v1/payload/payload.pb.go | 597 ++++++++-------- apis/grpc/v1/payload/payload_vtproto.pb.go | 660 ++++++++++-------- apis/proto/v1/discoverer/discoverer.proto | 4 +- apis/proto/v1/payload/payload.proto | 38 +- .../v1/discoverer/discoverer.swagger.json | 73 +- .../vald-helm-operator/crds/valdrelease.yaml | 9 + charts/vald/templates/_helpers.tpl | 13 + .../vald/templates/discoverer/configmap.yaml | 6 - charts/vald/values.schema.json | 14 + charts/vald/values.yaml | 9 + internal/config/discoverer.go | 37 +- internal/config/discoverer_test.go | 551 +++++++++++---- internal/errors/discoverer.go | 3 - internal/k8s/{svc => service}/option.go | 4 +- internal/k8s/{svc => service}/option_test.go | 4 +- internal/k8s/{svc => service}/svc.go | 49 +- internal/k8s/{svc => service}/svc_test.go | 102 ++- pkg/discoverer/k8s/handler/grpc/handler.go | 18 +- .../k8s/handler/grpc/handler_test.go | 20 +- pkg/discoverer/k8s/service/discover.go | 154 ++-- pkg/discoverer/k8s/service/discover_test.go | 60 +- pkg/discoverer/k8s/service/option.go | 18 - pkg/discoverer/k8s/service/option_test.go | 86 --- pkg/discoverer/k8s/usecase/discovered.go | 2 - 27 files changed, 1533 insertions(+), 1142 deletions(-) rename internal/k8s/{svc => service}/option.go (96%) rename internal/k8s/{svc => service}/option_test.go (99%) rename internal/k8s/{svc => service}/svc.go (77%) rename internal/k8s/{svc => service}/svc_test.go (90%) diff --git a/apis/docs/v1/docs.md b/apis/docs/v1/docs.md index bd1a81f45e..fa0cf30994 100644 --- a/apis/docs/v1/docs.md +++ b/apis/docs/v1/docs.md @@ -9,7 +9,6 @@ - [Control](#payload-v1-Control) - [Control.CreateIndexRequest](#payload-v1-Control-CreateIndexRequest) - [Discoverer](#payload-v1-Discoverer) - - [Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) - [Discoverer.Request](#payload-v1-Discoverer-Request) - [Empty](#payload-v1-Empty) - [Filter](#payload-v1-Filter) @@ -28,8 +27,9 @@ - [Info.Nodes](#payload-v1-Info-Nodes) - [Info.Pod](#payload-v1-Info-Pod) - [Info.Pods](#payload-v1-Info-Pods) - - [Info.ReadReplicaSvc](#payload-v1-Info-ReadReplicaSvc) - - [Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) + - [Info.Service](#payload-v1-Info-Service) + - [Info.ServicePort](#payload-v1-Info-ServicePort) + - [Info.Services](#payload-v1-Info-Services) - [Insert](#payload-v1-Insert) - [Insert.Config](#payload-v1-Insert-Config) - [Insert.MultiObjectRequest](#payload-v1-Insert-MultiObjectRequest) @@ -160,17 +160,6 @@ Represent the create index request. Discoverer related messages. - - -### Discoverer.ReadReplicaSvcsRequest - -Represent the dicoverer svc request. - -| Field | Type | Label | Description | -| --------- | ----------------- | ----- | ------------------------------- | -| name | [string](#string) | | The svc name to be discovered. | -| namespace | [string](#string) | | The namespace to be discovered. | - ### Discoverer.Request @@ -352,27 +341,39 @@ Represent the multiple pod information message. | ----- | -------------------------------- | -------- | ----------------------------- | | pods | [Info.Pod](#payload-v1-Info-Pod) | repeated | The multiple pod information. | - + + +### Info.Service + +Represent the service information message. + +| Field | Type | Label | Description | +| ----------- | ------------------------------------------------ | -------- | --------------------------- | +| name | [string](#string) | | The name of the svc. | +| cluster_ip | [string](#string) | | The cluster ip of the svc. | +| cluster_ips | [string](#string) | repeated | The cluster ips of the svc. | +| ports | [Info.ServicePort](#payload-v1-Info-ServicePort) | repeated | The port of the svc. | + + -### Info.ReadReplicaSvc +### Info.ServicePort -Represent the svc information message. +Represets the service port information message. -| Field | Type | Label | Description | -| --------- | ----------------- | ----- | ------------------------------------- | -| name | [string](#string) | | The name of the svc. | -| addr | [string](#string) | | The IP address of the svc. | -| replicaid | [uint64](#uint64) | | The replicaid of the readreplica svc. | +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | --------------------- | +| name | [string](#string) | | The name of the port. | +| port | [int32](#int32) | | The port number | - + -### Info.ReadReplicaSvcs +### Info.Services -Represent the multiple svc information message. +Represent the multiple service information message. -| Field | Type | Label | Description | -| ----- | ------------------------------------------------------ | -------- | ------------------------------ | -| svcs | [Info.ReadReplicaSvc](#payload-v1-Info-ReadReplicaSvc) | repeated | The multiple node information. | +| Field | Type | Label | Description | +| -------- | ---------------------------------------- | -------- | --------------------------------- | +| services | [Info.Service](#payload-v1-Info-Service) | repeated | The multiple service information. | @@ -1012,11 +1013,11 @@ Represent the agent sidecar service. Represent the discoverer service. -| Method Name | Request Type | Response Type | Description | -| --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | -| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | -| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | -| ReadReplicaSvcs | [.payload.v1.Discoverer.ReadReplicaSvcsRequest](#payload-v1-Discoverer-ReadReplicaSvcsRequest) | [.payload.v1.Info.ReadReplicaSvcs](#payload-v1-Info-ReadReplicaSvcs) | Represent the RPC to get the readreplica svc information. | +| Method Name | Request Type | Response Type | Description | +| ----------- | ---------------------------------------------------------------- | ------------------------------------------------------ | --------------------------------------------------------- | +| Pods | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Pods](#payload-v1-Info-Pods) | Represent the RPC to get the agent pods information. | +| Nodes | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Nodes](#payload-v1-Info-Nodes) | Represent the RPC to get the node information. | +| Services | [.payload.v1.Discoverer.Request](#payload-v1-Discoverer-Request) | [.payload.v1.Info.Services](#payload-v1-Info-Services) | Represent the RPC to get the readreplica svc information. | diff --git a/apis/grpc/v1/discoverer/discoverer.pb.go b/apis/grpc/v1/discoverer/discoverer.pb.go index 6607475104..53ff314128 100644 --- a/apis/grpc/v1/discoverer/discoverer.pb.go +++ b/apis/grpc/v1/discoverer/discoverer.pb.go @@ -47,7 +47,7 @@ var file_v1_discoverer_discoverer_proto_rawDesc = []byte{ 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc2, 0x02, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xa9, 0x02, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, @@ -59,38 +59,35 @@ var file_v1_discoverer_discoverer_proto_rawDesc = []byte{ 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x7d, 0x0a, - 0x0f, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, - 0x12, 0x2d, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, - 0x73, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x76, 0x63, 0x73, 0x42, 0x63, 0x0a, 0x20, - 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, - 0x42, 0x0e, 0x56, 0x61, 0x6c, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, - 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, - 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, - 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x64, 0x0a, + 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, + 0x12, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x42, 0x63, 0x0a, 0x20, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, + 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x42, 0x0e, 0x56, 0x61, 0x6c, 0x64, 0x44, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, + 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_v1_discoverer_discoverer_proto_goTypes = []interface{}{ - (*payload.Discoverer_Request)(nil), // 0: payload.v1.Discoverer.Request - (*payload.Discoverer_ReadReplicaSvcsRequest)(nil), // 1: payload.v1.Discoverer.ReadReplicaSvcsRequest - (*payload.Info_Pods)(nil), // 2: payload.v1.Info.Pods - (*payload.Info_Nodes)(nil), // 3: payload.v1.Info.Nodes - (*payload.Info_ReadReplicaSvcs)(nil), // 4: payload.v1.Info.ReadReplicaSvcs + (*payload.Discoverer_Request)(nil), // 0: payload.v1.Discoverer.Request + (*payload.Info_Pods)(nil), // 1: payload.v1.Info.Pods + (*payload.Info_Nodes)(nil), // 2: payload.v1.Info.Nodes + (*payload.Info_Services)(nil), // 3: payload.v1.Info.Services } var file_v1_discoverer_discoverer_proto_depIdxs = []int32{ 0, // 0: discoverer.v1.Discoverer.Pods:input_type -> payload.v1.Discoverer.Request 0, // 1: discoverer.v1.Discoverer.Nodes:input_type -> payload.v1.Discoverer.Request - 1, // 2: discoverer.v1.Discoverer.ReadReplicaSvcs:input_type -> payload.v1.Discoverer.ReadReplicaSvcsRequest - 2, // 3: discoverer.v1.Discoverer.Pods:output_type -> payload.v1.Info.Pods - 3, // 4: discoverer.v1.Discoverer.Nodes:output_type -> payload.v1.Info.Nodes - 4, // 5: discoverer.v1.Discoverer.ReadReplicaSvcs:output_type -> payload.v1.Info.ReadReplicaSvcs + 0, // 2: discoverer.v1.Discoverer.Services:input_type -> payload.v1.Discoverer.Request + 1, // 3: discoverer.v1.Discoverer.Pods:output_type -> payload.v1.Info.Pods + 2, // 4: discoverer.v1.Discoverer.Nodes:output_type -> payload.v1.Info.Nodes + 3, // 5: discoverer.v1.Discoverer.Services:output_type -> payload.v1.Info.Services 3, // [3:6] is the sub-list for method output_type 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go b/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go index ef3e521690..17af4c46c1 100644 --- a/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go +++ b/apis/grpc/v1/discoverer/discoverer_vtproto.pb.go @@ -47,7 +47,7 @@ type DiscovererClient interface { // Represent the RPC to get the node information. Nodes(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Nodes, error) // Represent the RPC to get the readreplica svc information. - ReadReplicaSvcs(ctx context.Context, in *payload.Discoverer_ReadReplicaSvcsRequest, opts ...grpc.CallOption) (*payload.Info_ReadReplicaSvcs, error) + Services(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Services, error) } type discovererClient struct { @@ -76,9 +76,9 @@ func (c *discovererClient) Nodes(ctx context.Context, in *payload.Discoverer_Req return out, nil } -func (c *discovererClient) ReadReplicaSvcs(ctx context.Context, in *payload.Discoverer_ReadReplicaSvcsRequest, opts ...grpc.CallOption) (*payload.Info_ReadReplicaSvcs, error) { - out := new(payload.Info_ReadReplicaSvcs) - err := c.cc.Invoke(ctx, "/discoverer.v1.Discoverer/ReadReplicaSvcs", in, out, opts...) +func (c *discovererClient) Services(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Services, error) { + out := new(payload.Info_Services) + err := c.cc.Invoke(ctx, "/discoverer.v1.Discoverer/Services", in, out, opts...) if err != nil { return nil, err } @@ -94,7 +94,7 @@ type DiscovererServer interface { // Represent the RPC to get the node information. Nodes(context.Context, *payload.Discoverer_Request) (*payload.Info_Nodes, error) // Represent the RPC to get the readreplica svc information. - ReadReplicaSvcs(context.Context, *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) + Services(context.Context, *payload.Discoverer_Request) (*payload.Info_Services, error) mustEmbedUnimplementedDiscovererServer() } @@ -108,8 +108,8 @@ func (UnimplementedDiscovererServer) Pods(context.Context, *payload.Discoverer_R func (UnimplementedDiscovererServer) Nodes(context.Context, *payload.Discoverer_Request) (*payload.Info_Nodes, error) { return nil, status.Errorf(codes.Unimplemented, "method Nodes not implemented") } -func (UnimplementedDiscovererServer) ReadReplicaSvcs(context.Context, *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadReplicaSvcs not implemented") +func (UnimplementedDiscovererServer) Services(context.Context, *payload.Discoverer_Request) (*payload.Info_Services, error) { + return nil, status.Errorf(codes.Unimplemented, "method Services not implemented") } func (UnimplementedDiscovererServer) mustEmbedUnimplementedDiscovererServer() {} @@ -160,20 +160,20 @@ func _Discoverer_Nodes_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _Discoverer_ReadReplicaSvcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.Discoverer_ReadReplicaSvcsRequest) +func _Discoverer_Services_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.Discoverer_Request) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(DiscovererServer).ReadReplicaSvcs(ctx, in) + return srv.(DiscovererServer).Services(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/discoverer.v1.Discoverer/ReadReplicaSvcs", + FullMethod: "/discoverer.v1.Discoverer/Services", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiscovererServer).ReadReplicaSvcs(ctx, req.(*payload.Discoverer_ReadReplicaSvcsRequest)) + return srv.(DiscovererServer).Services(ctx, req.(*payload.Discoverer_Request)) } return interceptor(ctx, in, info, handler) } @@ -194,8 +194,8 @@ var Discoverer_ServiceDesc = grpc.ServiceDesc{ Handler: _Discoverer_Nodes_Handler, }, { - MethodName: "ReadReplicaSvcs", - Handler: _Discoverer_ReadReplicaSvcs_Handler, + MethodName: "Services", + Handler: _Discoverer_Services_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/apis/grpc/v1/payload/payload.pb.go b/apis/grpc/v1/payload/payload.pb.go index fc325a2f11..2c02ee4375 100644 --- a/apis/grpc/v1/payload/payload.pb.go +++ b/apis/grpc/v1/payload/payload.pb.go @@ -3777,64 +3777,6 @@ func (x *Discoverer_Request) GetNode() string { return "" } -// Represent the dicoverer svc request. -type Discoverer_ReadReplicaSvcsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The svc name to be discovered. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The namespace to be discovered. - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` -} - -func (x *Discoverer_ReadReplicaSvcsRequest) Reset() { - *x = Discoverer_ReadReplicaSvcsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[64] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Discoverer_ReadReplicaSvcsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Discoverer_ReadReplicaSvcsRequest) ProtoMessage() {} - -func (x *Discoverer_ReadReplicaSvcsRequest) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[64] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Discoverer_ReadReplicaSvcsRequest.ProtoReflect.Descriptor instead. -func (*Discoverer_ReadReplicaSvcsRequest) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{8, 1} -} - -func (x *Discoverer_ReadReplicaSvcsRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Discoverer_ReadReplicaSvcsRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - // Represent the index information messages. type Info_Index struct { state protoimpl.MessageState @@ -3845,7 +3787,7 @@ type Info_Index struct { func (x *Info_Index) Reset() { *x = Info_Index{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[65] + mi := &file_v1_payload_payload_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3858,7 +3800,7 @@ func (x *Info_Index) String() string { func (*Info_Index) ProtoMessage() {} func (x *Info_Index) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[65] + mi := &file_v1_payload_payload_proto_msgTypes[64] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3899,7 +3841,7 @@ type Info_Pod struct { func (x *Info_Pod) Reset() { *x = Info_Pod{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[66] + mi := &file_v1_payload_payload_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3912,7 +3854,7 @@ func (x *Info_Pod) String() string { func (*Info_Pod) ProtoMessage() {} func (x *Info_Pod) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[66] + mi := &file_v1_payload_payload_proto_msgTypes[65] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4000,7 +3942,7 @@ type Info_Node struct { func (x *Info_Node) Reset() { *x = Info_Node{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[67] + mi := &file_v1_payload_payload_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4013,7 +3955,7 @@ func (x *Info_Node) String() string { func (*Info_Node) ProtoMessage() {} func (x *Info_Node) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[67] + mi := &file_v1_payload_payload_proto_msgTypes[66] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4071,37 +4013,39 @@ func (x *Info_Node) GetPods() *Info_Pods { return nil } -// Represent the svc information message. -type Info_ReadReplicaSvc struct { +// Represent the service information message. +type Info_Service struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The name of the svc. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The IP address of the svc. - Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - // The replicaid of the readreplica svc. - Replicaid uint64 `protobuf:"varint,3,opt,name=replicaid,proto3" json:"replicaid,omitempty"` + // The cluster ip of the svc. + ClusterIp string `protobuf:"bytes,2,opt,name=cluster_ip,json=clusterIp,proto3" json:"cluster_ip,omitempty"` + // The cluster ips of the svc. + ClusterIps []string `protobuf:"bytes,3,rep,name=cluster_ips,json=clusterIps,proto3" json:"cluster_ips,omitempty"` + // The port of the svc. + Ports []*Info_ServicePort `protobuf:"bytes,4,rep,name=ports,proto3" json:"ports,omitempty"` } -func (x *Info_ReadReplicaSvc) Reset() { - *x = Info_ReadReplicaSvc{} +func (x *Info_Service) Reset() { + *x = Info_Service{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[68] + mi := &file_v1_payload_payload_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Info_ReadReplicaSvc) String() string { +func (x *Info_Service) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Info_ReadReplicaSvc) ProtoMessage() {} +func (*Info_Service) ProtoMessage() {} -func (x *Info_ReadReplicaSvc) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[68] +func (x *Info_Service) ProtoReflect() protoreflect.Message { + mi := &file_v1_payload_payload_proto_msgTypes[67] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4112,28 +4056,93 @@ func (x *Info_ReadReplicaSvc) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Info_ReadReplicaSvc.ProtoReflect.Descriptor instead. -func (*Info_ReadReplicaSvc) Descriptor() ([]byte, []int) { +// Deprecated: Use Info_Service.ProtoReflect.Descriptor instead. +func (*Info_Service) Descriptor() ([]byte, []int) { return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 3} } -func (x *Info_ReadReplicaSvc) GetName() string { +func (x *Info_Service) GetName() string { if x != nil { return x.Name } return "" } -func (x *Info_ReadReplicaSvc) GetAddr() string { +func (x *Info_Service) GetClusterIp() string { + if x != nil { + return x.ClusterIp + } + return "" +} + +func (x *Info_Service) GetClusterIps() []string { + if x != nil { + return x.ClusterIps + } + return nil +} + +func (x *Info_Service) GetPorts() []*Info_ServicePort { + if x != nil { + return x.Ports + } + return nil +} + +// Represets the service port information message. +type Info_ServicePort struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the port. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The port number + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` +} + +func (x *Info_ServicePort) Reset() { + *x = Info_ServicePort{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_payload_payload_proto_msgTypes[68] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info_ServicePort) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info_ServicePort) ProtoMessage() {} + +func (x *Info_ServicePort) ProtoReflect() protoreflect.Message { + mi := &file_v1_payload_payload_proto_msgTypes[68] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info_ServicePort.ProtoReflect.Descriptor instead. +func (*Info_ServicePort) Descriptor() ([]byte, []int) { + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 4} +} + +func (x *Info_ServicePort) GetName() string { if x != nil { - return x.Addr + return x.Name } return "" } -func (x *Info_ReadReplicaSvc) GetReplicaid() uint64 { +func (x *Info_ServicePort) GetPort() int32 { if x != nil { - return x.Replicaid + return x.Port } return 0 } @@ -4181,7 +4190,7 @@ func (x *Info_CPU) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_CPU.ProtoReflect.Descriptor instead. func (*Info_CPU) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 4} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} } func (x *Info_CPU) GetLimit() float64 { @@ -4248,7 +4257,7 @@ func (x *Info_Memory) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Memory.ProtoReflect.Descriptor instead. func (*Info_Memory) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} } func (x *Info_Memory) GetLimit() float64 { @@ -4311,7 +4320,7 @@ func (x *Info_Pods) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Pods.ProtoReflect.Descriptor instead. func (*Info_Pods) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} } func (x *Info_Pods) GetPods() []*Info_Pod { @@ -4360,7 +4369,7 @@ func (x *Info_Nodes) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Nodes.ProtoReflect.Descriptor instead. func (*Info_Nodes) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} } func (x *Info_Nodes) GetNodes() []*Info_Node { @@ -4370,18 +4379,18 @@ func (x *Info_Nodes) GetNodes() []*Info_Node { return nil } -// Represent the multiple svc information message. -type Info_ReadReplicaSvcs struct { +// Represent the multiple service information message. +type Info_Services struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The multiple node information. - Svcs []*Info_ReadReplicaSvc `protobuf:"bytes,1,rep,name=svcs,proto3" json:"svcs,omitempty"` + // The multiple service information. + Services []*Info_Service `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` } -func (x *Info_ReadReplicaSvcs) Reset() { - *x = Info_ReadReplicaSvcs{} +func (x *Info_Services) Reset() { + *x = Info_Services{} if protoimpl.UnsafeEnabled { mi := &file_v1_payload_payload_proto_msgTypes[73] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4389,13 +4398,13 @@ func (x *Info_ReadReplicaSvcs) Reset() { } } -func (x *Info_ReadReplicaSvcs) String() string { +func (x *Info_Services) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Info_ReadReplicaSvcs) ProtoMessage() {} +func (*Info_Services) ProtoMessage() {} -func (x *Info_ReadReplicaSvcs) ProtoReflect() protoreflect.Message { +func (x *Info_Services) ProtoReflect() protoreflect.Message { mi := &file_v1_payload_payload_proto_msgTypes[73] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4407,14 +4416,14 @@ func (x *Info_ReadReplicaSvcs) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Info_ReadReplicaSvcs.ProtoReflect.Descriptor instead. -func (*Info_ReadReplicaSvcs) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} +// Deprecated: Use Info_Services.ProtoReflect.Descriptor instead. +func (*Info_Services) Descriptor() ([]byte, []int) { + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 9} } -func (x *Info_ReadReplicaSvcs) GetSvcs() []*Info_ReadReplicaSvc { +func (x *Info_Services) GetServices() []*Info_Service { if x != nil { - return x.Svcs + return x.Services } return nil } @@ -4457,7 +4466,7 @@ func (x *Info_IPs) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_IPs.ProtoReflect.Descriptor instead. func (*Info_IPs) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 9} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 10} } func (x *Info_IPs) GetIp() []string { @@ -5033,99 +5042,100 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x09, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xba, 0x48, 0x04, 0x2a, 0x02, 0x28, 0x00, 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, - 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, - 0x1a, 0x58, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x1a, 0x53, 0x0a, 0x16, 0x52, 0x65, - 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, - 0x8a, 0x09, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, - 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, - 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, - 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x73, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x1a, 0x4a, 0x0a, 0x04, 0x55, 0x55, 0x49, - 0x44, 0x1a, 0x1f, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, - 0x69, 0x64, 0x1a, 0x21, 0x0a, 0x0b, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, 0xef, 0x01, 0x0a, 0x03, 0x50, 0x6f, 0x64, 0x12, 0x19, 0x0a, - 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x78, 0x01, 0x52, - 0x02, 0x69, 0x70, 0x12, 0x26, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, - 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, - 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, - 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x1a, 0xe8, 0x01, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x26, - 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, - 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, - 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, - 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, - 0x64, 0x73, 0x1a, 0x56, 0x0a, 0x0e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x53, 0x76, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, - 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x09, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x69, 0x64, 0x1a, 0x4b, 0x0a, 0x03, 0x43, 0x50, - 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, - 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, - 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, - 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x05, - 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, - 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x6e, 0x6f, - 0x64, 0x65, 0x73, 0x1a, 0x50, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x53, 0x76, 0x63, 0x73, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x76, 0x63, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, - 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x53, 0x76, 0x63, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, - 0x04, 0x73, 0x76, 0x63, 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, - 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x0b, 0x56, 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0xa2, 0x02, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x65, 0x22, 0x66, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x72, 0x1a, + 0x58, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0xf7, 0x09, 0x0a, 0x04, 0x49, 0x6e, + 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, + 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x61, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x61, 0x76, + 0x69, 0x6e, 0x67, 0x1a, 0x4a, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x1a, 0x1f, 0x0a, 0x09, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, 0x21, 0x0a, 0x0b, + 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, + 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x1a, + 0xef, 0x01, 0x0a, 0x03, 0x50, 0x6f, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x78, 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, 0x26, 0x0a, + 0x03, 0x63, 0x70, 0x75, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, + 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, + 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, + 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, + 0x65, 0x1a, 0xe8, 0x01, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x26, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x50, 0x55, 0x52, 0x03, 0x63, 0x70, 0x75, + 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x91, 0x01, 0x0a, + 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x70, 0x73, 0x12, 0x32, 0x0a, 0x05, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x1a, 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x4b, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x04, + 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, + 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, + 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x42, + 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, + 0x1a, 0x4a, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x08, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, + 0x08, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x15, 0x0a, 0x03, + 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, + 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x0b, 0x56, + 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, + 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, + 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0xa2, 0x02, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5143,88 +5153,88 @@ func file_v1_payload_payload_proto_rawDescGZIP() []byte { var file_v1_payload_payload_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 79) var file_v1_payload_payload_proto_goTypes = []interface{}{ - (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm - (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator - (*Search)(nil), // 2: payload.v1.Search - (*Filter)(nil), // 3: payload.v1.Filter - (*Insert)(nil), // 4: payload.v1.Insert - (*Update)(nil), // 5: payload.v1.Update - (*Upsert)(nil), // 6: payload.v1.Upsert - (*Remove)(nil), // 7: payload.v1.Remove - (*Object)(nil), // 8: payload.v1.Object - (*Control)(nil), // 9: payload.v1.Control - (*Discoverer)(nil), // 10: payload.v1.Discoverer - (*Info)(nil), // 11: payload.v1.Info - (*Empty)(nil), // 12: payload.v1.Empty - (*Search_Request)(nil), // 13: payload.v1.Search.Request - (*Search_MultiRequest)(nil), // 14: payload.v1.Search.MultiRequest - (*Search_IDRequest)(nil), // 15: payload.v1.Search.IDRequest - (*Search_MultiIDRequest)(nil), // 16: payload.v1.Search.MultiIDRequest - (*Search_ObjectRequest)(nil), // 17: payload.v1.Search.ObjectRequest - (*Search_MultiObjectRequest)(nil), // 18: payload.v1.Search.MultiObjectRequest - (*Search_Config)(nil), // 19: payload.v1.Search.Config - (*Search_Response)(nil), // 20: payload.v1.Search.Response - (*Search_Responses)(nil), // 21: payload.v1.Search.Responses - (*Search_StreamResponse)(nil), // 22: payload.v1.Search.StreamResponse - (*Filter_Target)(nil), // 23: payload.v1.Filter.Target - (*Filter_Config)(nil), // 24: payload.v1.Filter.Config - (*Insert_Request)(nil), // 25: payload.v1.Insert.Request - (*Insert_MultiRequest)(nil), // 26: payload.v1.Insert.MultiRequest - (*Insert_ObjectRequest)(nil), // 27: payload.v1.Insert.ObjectRequest - (*Insert_MultiObjectRequest)(nil), // 28: payload.v1.Insert.MultiObjectRequest - (*Insert_Config)(nil), // 29: payload.v1.Insert.Config - (*Update_Request)(nil), // 30: payload.v1.Update.Request - (*Update_MultiRequest)(nil), // 31: payload.v1.Update.MultiRequest - (*Update_ObjectRequest)(nil), // 32: payload.v1.Update.ObjectRequest - (*Update_MultiObjectRequest)(nil), // 33: payload.v1.Update.MultiObjectRequest - (*Update_Config)(nil), // 34: payload.v1.Update.Config - (*Upsert_Request)(nil), // 35: payload.v1.Upsert.Request - (*Upsert_MultiRequest)(nil), // 36: payload.v1.Upsert.MultiRequest - (*Upsert_ObjectRequest)(nil), // 37: payload.v1.Upsert.ObjectRequest - (*Upsert_MultiObjectRequest)(nil), // 38: payload.v1.Upsert.MultiObjectRequest - (*Upsert_Config)(nil), // 39: payload.v1.Upsert.Config - (*Remove_Request)(nil), // 40: payload.v1.Remove.Request - (*Remove_MultiRequest)(nil), // 41: payload.v1.Remove.MultiRequest - (*Remove_TimestampRequest)(nil), // 42: payload.v1.Remove.TimestampRequest - (*Remove_Timestamp)(nil), // 43: payload.v1.Remove.Timestamp - (*Remove_Config)(nil), // 44: payload.v1.Remove.Config - (*Object_VectorRequest)(nil), // 45: payload.v1.Object.VectorRequest - (*Object_Distance)(nil), // 46: payload.v1.Object.Distance - (*Object_StreamDistance)(nil), // 47: payload.v1.Object.StreamDistance - (*Object_ID)(nil), // 48: payload.v1.Object.ID - (*Object_IDs)(nil), // 49: payload.v1.Object.IDs - (*Object_Vector)(nil), // 50: payload.v1.Object.Vector - (*Object_GetTimestampRequest)(nil), // 51: payload.v1.Object.GetTimestampRequest - (*Object_Timestamp)(nil), // 52: payload.v1.Object.Timestamp - (*Object_Vectors)(nil), // 53: payload.v1.Object.Vectors - (*Object_StreamVector)(nil), // 54: payload.v1.Object.StreamVector - (*Object_ReshapeVector)(nil), // 55: payload.v1.Object.ReshapeVector - (*Object_Blob)(nil), // 56: payload.v1.Object.Blob - (*Object_StreamBlob)(nil), // 57: payload.v1.Object.StreamBlob - (*Object_Location)(nil), // 58: payload.v1.Object.Location - (*Object_StreamLocation)(nil), // 59: payload.v1.Object.StreamLocation - (*Object_Locations)(nil), // 60: payload.v1.Object.Locations - (*Object_List)(nil), // 61: payload.v1.Object.List - (*Object_List_Request)(nil), // 62: payload.v1.Object.List.Request - (*Object_List_Response)(nil), // 63: payload.v1.Object.List.Response - (*Control_CreateIndexRequest)(nil), // 64: payload.v1.Control.CreateIndexRequest - (*Discoverer_Request)(nil), // 65: payload.v1.Discoverer.Request - (*Discoverer_ReadReplicaSvcsRequest)(nil), // 66: payload.v1.Discoverer.ReadReplicaSvcsRequest - (*Info_Index)(nil), // 67: payload.v1.Info.Index - (*Info_Pod)(nil), // 68: payload.v1.Info.Pod - (*Info_Node)(nil), // 69: payload.v1.Info.Node - (*Info_ReadReplicaSvc)(nil), // 70: payload.v1.Info.ReadReplicaSvc - (*Info_CPU)(nil), // 71: payload.v1.Info.CPU - (*Info_Memory)(nil), // 72: payload.v1.Info.Memory - (*Info_Pods)(nil), // 73: payload.v1.Info.Pods - (*Info_Nodes)(nil), // 74: payload.v1.Info.Nodes - (*Info_ReadReplicaSvcs)(nil), // 75: payload.v1.Info.ReadReplicaSvcs - (*Info_IPs)(nil), // 76: payload.v1.Info.IPs - (*Info_Index_Count)(nil), // 77: payload.v1.Info.Index.Count - (*Info_Index_UUID)(nil), // 78: payload.v1.Info.Index.UUID - (*Info_Index_UUID_Committed)(nil), // 79: payload.v1.Info.Index.UUID.Committed - (*Info_Index_UUID_Uncommitted)(nil), // 80: payload.v1.Info.Index.UUID.Uncommitted - (*status.Status)(nil), // 81: google.rpc.Status + (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm + (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator + (*Search)(nil), // 2: payload.v1.Search + (*Filter)(nil), // 3: payload.v1.Filter + (*Insert)(nil), // 4: payload.v1.Insert + (*Update)(nil), // 5: payload.v1.Update + (*Upsert)(nil), // 6: payload.v1.Upsert + (*Remove)(nil), // 7: payload.v1.Remove + (*Object)(nil), // 8: payload.v1.Object + (*Control)(nil), // 9: payload.v1.Control + (*Discoverer)(nil), // 10: payload.v1.Discoverer + (*Info)(nil), // 11: payload.v1.Info + (*Empty)(nil), // 12: payload.v1.Empty + (*Search_Request)(nil), // 13: payload.v1.Search.Request + (*Search_MultiRequest)(nil), // 14: payload.v1.Search.MultiRequest + (*Search_IDRequest)(nil), // 15: payload.v1.Search.IDRequest + (*Search_MultiIDRequest)(nil), // 16: payload.v1.Search.MultiIDRequest + (*Search_ObjectRequest)(nil), // 17: payload.v1.Search.ObjectRequest + (*Search_MultiObjectRequest)(nil), // 18: payload.v1.Search.MultiObjectRequest + (*Search_Config)(nil), // 19: payload.v1.Search.Config + (*Search_Response)(nil), // 20: payload.v1.Search.Response + (*Search_Responses)(nil), // 21: payload.v1.Search.Responses + (*Search_StreamResponse)(nil), // 22: payload.v1.Search.StreamResponse + (*Filter_Target)(nil), // 23: payload.v1.Filter.Target + (*Filter_Config)(nil), // 24: payload.v1.Filter.Config + (*Insert_Request)(nil), // 25: payload.v1.Insert.Request + (*Insert_MultiRequest)(nil), // 26: payload.v1.Insert.MultiRequest + (*Insert_ObjectRequest)(nil), // 27: payload.v1.Insert.ObjectRequest + (*Insert_MultiObjectRequest)(nil), // 28: payload.v1.Insert.MultiObjectRequest + (*Insert_Config)(nil), // 29: payload.v1.Insert.Config + (*Update_Request)(nil), // 30: payload.v1.Update.Request + (*Update_MultiRequest)(nil), // 31: payload.v1.Update.MultiRequest + (*Update_ObjectRequest)(nil), // 32: payload.v1.Update.ObjectRequest + (*Update_MultiObjectRequest)(nil), // 33: payload.v1.Update.MultiObjectRequest + (*Update_Config)(nil), // 34: payload.v1.Update.Config + (*Upsert_Request)(nil), // 35: payload.v1.Upsert.Request + (*Upsert_MultiRequest)(nil), // 36: payload.v1.Upsert.MultiRequest + (*Upsert_ObjectRequest)(nil), // 37: payload.v1.Upsert.ObjectRequest + (*Upsert_MultiObjectRequest)(nil), // 38: payload.v1.Upsert.MultiObjectRequest + (*Upsert_Config)(nil), // 39: payload.v1.Upsert.Config + (*Remove_Request)(nil), // 40: payload.v1.Remove.Request + (*Remove_MultiRequest)(nil), // 41: payload.v1.Remove.MultiRequest + (*Remove_TimestampRequest)(nil), // 42: payload.v1.Remove.TimestampRequest + (*Remove_Timestamp)(nil), // 43: payload.v1.Remove.Timestamp + (*Remove_Config)(nil), // 44: payload.v1.Remove.Config + (*Object_VectorRequest)(nil), // 45: payload.v1.Object.VectorRequest + (*Object_Distance)(nil), // 46: payload.v1.Object.Distance + (*Object_StreamDistance)(nil), // 47: payload.v1.Object.StreamDistance + (*Object_ID)(nil), // 48: payload.v1.Object.ID + (*Object_IDs)(nil), // 49: payload.v1.Object.IDs + (*Object_Vector)(nil), // 50: payload.v1.Object.Vector + (*Object_GetTimestampRequest)(nil), // 51: payload.v1.Object.GetTimestampRequest + (*Object_Timestamp)(nil), // 52: payload.v1.Object.Timestamp + (*Object_Vectors)(nil), // 53: payload.v1.Object.Vectors + (*Object_StreamVector)(nil), // 54: payload.v1.Object.StreamVector + (*Object_ReshapeVector)(nil), // 55: payload.v1.Object.ReshapeVector + (*Object_Blob)(nil), // 56: payload.v1.Object.Blob + (*Object_StreamBlob)(nil), // 57: payload.v1.Object.StreamBlob + (*Object_Location)(nil), // 58: payload.v1.Object.Location + (*Object_StreamLocation)(nil), // 59: payload.v1.Object.StreamLocation + (*Object_Locations)(nil), // 60: payload.v1.Object.Locations + (*Object_List)(nil), // 61: payload.v1.Object.List + (*Object_List_Request)(nil), // 62: payload.v1.Object.List.Request + (*Object_List_Response)(nil), // 63: payload.v1.Object.List.Response + (*Control_CreateIndexRequest)(nil), // 64: payload.v1.Control.CreateIndexRequest + (*Discoverer_Request)(nil), // 65: payload.v1.Discoverer.Request + (*Info_Index)(nil), // 66: payload.v1.Info.Index + (*Info_Pod)(nil), // 67: payload.v1.Info.Pod + (*Info_Node)(nil), // 68: payload.v1.Info.Node + (*Info_Service)(nil), // 69: payload.v1.Info.Service + (*Info_ServicePort)(nil), // 70: payload.v1.Info.ServicePort + (*Info_CPU)(nil), // 71: payload.v1.Info.CPU + (*Info_Memory)(nil), // 72: payload.v1.Info.Memory + (*Info_Pods)(nil), // 73: payload.v1.Info.Pods + (*Info_Nodes)(nil), // 74: payload.v1.Info.Nodes + (*Info_Services)(nil), // 75: payload.v1.Info.Services + (*Info_IPs)(nil), // 76: payload.v1.Info.IPs + (*Info_Index_Count)(nil), // 77: payload.v1.Info.Index.Count + (*Info_Index_UUID)(nil), // 78: payload.v1.Info.Index.UUID + (*Info_Index_UUID_Committed)(nil), // 79: payload.v1.Info.Index.UUID.Committed + (*Info_Index_UUID_Uncommitted)(nil), // 80: payload.v1.Info.Index.UUID.Uncommitted + (*status.Status)(nil), // 81: google.rpc.Status } var file_v1_payload_payload_proto_depIdxs = []int32{ 19, // 0: payload.v1.Search.Request.config:type_name -> payload.v1.Search.Config @@ -5288,18 +5298,19 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 81, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status 71, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU 72, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory - 69, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node + 68, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node 71, // 62: payload.v1.Info.Node.cpu:type_name -> payload.v1.Info.CPU 72, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory 73, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods - 68, // 65: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod - 69, // 66: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node - 70, // 67: payload.v1.Info.ReadReplicaSvcs.svcs:type_name -> payload.v1.Info.ReadReplicaSvc - 68, // [68:68] is the sub-list for method output_type - 68, // [68:68] is the sub-list for method input_type - 68, // [68:68] is the sub-list for extension type_name - 68, // [68:68] is the sub-list for extension extendee - 0, // [0:68] is the sub-list for field type_name + 70, // 65: payload.v1.Info.Service.ports:type_name -> payload.v1.Info.ServicePort + 67, // 66: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod + 68, // 67: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node + 69, // 68: payload.v1.Info.Services.services:type_name -> payload.v1.Info.Service + 69, // [69:69] is the sub-list for method output_type + 69, // [69:69] is the sub-list for method input_type + 69, // [69:69] is the sub-list for extension type_name + 69, // [69:69] is the sub-list for extension extendee + 0, // [0:69] is the sub-list for field type_name } func init() { file_v1_payload_payload_proto_init() } @@ -6077,7 +6088,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Discoverer_ReadReplicaSvcsRequest); i { + switch v := v.(*Info_Index); i { case 0: return &v.state case 1: @@ -6089,7 +6100,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index); i { + switch v := v.(*Info_Pod); i { case 0: return &v.state case 1: @@ -6101,7 +6112,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Pod); i { + switch v := v.(*Info_Node); i { case 0: return &v.state case 1: @@ -6113,7 +6124,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Node); i { + switch v := v.(*Info_Service); i { case 0: return &v.state case 1: @@ -6125,7 +6136,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_ReadReplicaSvc); i { + switch v := v.(*Info_ServicePort); i { case 0: return &v.state case 1: @@ -6185,7 +6196,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_ReadReplicaSvcs); i { + switch v := v.(*Info_Services); i { case 0: return &v.state case 1: diff --git a/apis/grpc/v1/payload/payload_vtproto.pb.go b/apis/grpc/v1/payload/payload_vtproto.pb.go index 0e5502722f..b1d86d4abf 100644 --- a/apis/grpc/v1/payload/payload_vtproto.pb.go +++ b/apis/grpc/v1/payload/payload_vtproto.pb.go @@ -1437,25 +1437,6 @@ func (m *Discoverer_Request) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Discoverer_ReadReplicaSvcsRequest) CloneVT() *Discoverer_ReadReplicaSvcsRequest { - if m == nil { - return (*Discoverer_ReadReplicaSvcsRequest)(nil) - } - r := &Discoverer_ReadReplicaSvcsRequest{ - Name: m.Name, - Namespace: m.Namespace, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Discoverer_ReadReplicaSvcsRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - func (m *Discoverer) CloneVT() *Discoverer { if m == nil { return (*Discoverer)(nil) @@ -1608,14 +1589,25 @@ func (m *Info_Node) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Info_ReadReplicaSvc) CloneVT() *Info_ReadReplicaSvc { +func (m *Info_Service) CloneVT() *Info_Service { if m == nil { - return (*Info_ReadReplicaSvc)(nil) + return (*Info_Service)(nil) } - r := &Info_ReadReplicaSvc{ + r := &Info_Service{ Name: m.Name, - Addr: m.Addr, - Replicaid: m.Replicaid, + ClusterIp: m.ClusterIp, + } + if rhs := m.ClusterIps; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.ClusterIps = tmpContainer + } + if rhs := m.Ports; rhs != nil { + tmpContainer := make([]*Info_ServicePort, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Ports = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -1624,7 +1616,26 @@ func (m *Info_ReadReplicaSvc) CloneVT() *Info_ReadReplicaSvc { return r } -func (m *Info_ReadReplicaSvc) CloneMessageVT() proto.Message { +func (m *Info_Service) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Info_ServicePort) CloneVT() *Info_ServicePort { + if m == nil { + return (*Info_ServicePort)(nil) + } + r := &Info_ServicePort{ + Name: m.Name, + Port: m.Port, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Info_ServicePort) CloneMessageVT() proto.Message { return m.CloneVT() } @@ -1714,17 +1725,17 @@ func (m *Info_Nodes) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Info_ReadReplicaSvcs) CloneVT() *Info_ReadReplicaSvcs { +func (m *Info_Services) CloneVT() *Info_Services { if m == nil { - return (*Info_ReadReplicaSvcs)(nil) + return (*Info_Services)(nil) } - r := &Info_ReadReplicaSvcs{} - if rhs := m.Svcs; rhs != nil { - tmpContainer := make([]*Info_ReadReplicaSvc, len(rhs)) + r := &Info_Services{} + if rhs := m.Services; rhs != nil { + tmpContainer := make([]*Info_Service, len(rhs)) for k, v := range rhs { tmpContainer[k] = v.CloneVT() } - r.Svcs = tmpContainer + r.Services = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -1733,7 +1744,7 @@ func (m *Info_ReadReplicaSvcs) CloneVT() *Info_ReadReplicaSvcs { return r } -func (m *Info_ReadReplicaSvcs) CloneMessageVT() proto.Message { +func (m *Info_Services) CloneMessageVT() proto.Message { return m.CloneVT() } @@ -3686,28 +3697,6 @@ func (this *Discoverer_Request) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (this *Discoverer_ReadReplicaSvcsRequest) EqualVT(that *Discoverer_ReadReplicaSvcsRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Namespace != that.Namespace { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Discoverer_ReadReplicaSvcsRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Discoverer_ReadReplicaSvcsRequest) - if !ok { - return false - } - return this.EqualVT(that) -} func (this *Discoverer) EqualVT(that *Discoverer) bool { if this == that { return true @@ -3893,7 +3882,7 @@ func (this *Info_Node) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (this *Info_ReadReplicaSvc) EqualVT(that *Info_ReadReplicaSvc) bool { +func (this *Info_Service) EqualVT(that *Info_Service) bool { if this == that { return true } else if this == nil || that == nil { @@ -3902,17 +3891,62 @@ func (this *Info_ReadReplicaSvc) EqualVT(that *Info_ReadReplicaSvc) bool { if this.Name != that.Name { return false } - if this.Addr != that.Addr { + if this.ClusterIp != that.ClusterIp { + return false + } + if len(this.ClusterIps) != len(that.ClusterIps) { + return false + } + for i, vx := range this.ClusterIps { + vy := that.ClusterIps[i] + if vx != vy { + return false + } + } + if len(this.Ports) != len(that.Ports) { + return false + } + for i, vx := range this.Ports { + vy := that.Ports[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Info_ServicePort{} + } + if q == nil { + q = &Info_ServicePort{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Info_Service) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Service) + if !ok { return false } - if this.Replicaid != that.Replicaid { + return this.EqualVT(that) +} +func (this *Info_ServicePort) EqualVT(that *Info_ServicePort) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.Port != that.Port { return false } return string(this.unknownFields) == string(that.unknownFields) } -func (this *Info_ReadReplicaSvc) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Info_ReadReplicaSvc) +func (this *Info_ServicePort) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_ServicePort) if !ok { return false } @@ -4034,23 +4068,23 @@ func (this *Info_Nodes) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (this *Info_ReadReplicaSvcs) EqualVT(that *Info_ReadReplicaSvcs) bool { +func (this *Info_Services) EqualVT(that *Info_Services) bool { if this == that { return true } else if this == nil || that == nil { return false } - if len(this.Svcs) != len(that.Svcs) { + if len(this.Services) != len(that.Services) { return false } - for i, vx := range this.Svcs { - vy := that.Svcs[i] + for i, vx := range this.Services { + vy := that.Services[i] if p, q := vx, vy; p != q { if p == nil { - p = &Info_ReadReplicaSvc{} + p = &Info_Service{} } if q == nil { - q = &Info_ReadReplicaSvc{} + q = &Info_Service{} } if !p.EqualVT(q) { return false @@ -4060,8 +4094,8 @@ func (this *Info_ReadReplicaSvcs) EqualVT(that *Info_ReadReplicaSvcs) bool { return string(this.unknownFields) == string(that.unknownFields) } -func (this *Info_ReadReplicaSvcs) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Info_ReadReplicaSvcs) +func (this *Info_Services) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Services) if !ok { return false } @@ -7299,53 +7333,6 @@ func (m *Discoverer_Request) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Discoverer_ReadReplicaSvcsRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Discoverer_ReadReplicaSvcsRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Discoverer_ReadReplicaSvcsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Namespace) > 0 { - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarint(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Discoverer) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -7763,7 +7750,7 @@ func (m *Info_Node) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Info_ReadReplicaSvc) MarshalVT() (dAtA []byte, err error) { +func (m *Info_Service) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -7776,12 +7763,12 @@ func (m *Info_ReadReplicaSvc) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Info_ReadReplicaSvc) MarshalToVT(dAtA []byte) (int, error) { +func (m *Info_Service) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Info_ReadReplicaSvc) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Info_Service) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -7793,15 +7780,31 @@ func (m *Info_ReadReplicaSvc) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.Replicaid != 0 { - i = encodeVarint(dAtA, i, uint64(m.Replicaid)) - i-- - dAtA[i] = 0x18 + if len(m.Ports) > 0 { + for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Ports[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } } - if len(m.Addr) > 0 { - i -= len(m.Addr) - copy(dAtA[i:], m.Addr) - i = encodeVarint(dAtA, i, uint64(len(m.Addr))) + if len(m.ClusterIps) > 0 { + for iNdEx := len(m.ClusterIps) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ClusterIps[iNdEx]) + copy(dAtA[i:], m.ClusterIps[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.ClusterIps[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ClusterIp) > 0 { + i -= len(m.ClusterIp) + copy(dAtA[i:], m.ClusterIp) + i = encodeVarint(dAtA, i, uint64(len(m.ClusterIp))) i-- dAtA[i] = 0x12 } @@ -7815,6 +7818,51 @@ func (m *Info_ReadReplicaSvc) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Info_ServicePort) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info_ServicePort) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Info_ServicePort) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Port != 0 { + i = encodeVarint(dAtA, i, uint64(m.Port)) + i-- + dAtA[i] = 0x10 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Info_CPU) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -8007,7 +8055,7 @@ func (m *Info_Nodes) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Info_ReadReplicaSvcs) MarshalVT() (dAtA []byte, err error) { +func (m *Info_Services) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -8020,12 +8068,12 @@ func (m *Info_ReadReplicaSvcs) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Info_ReadReplicaSvcs) MarshalToVT(dAtA []byte) (int, error) { +func (m *Info_Services) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Info_ReadReplicaSvcs) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Info_Services) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -8037,9 +8085,9 @@ func (m *Info_ReadReplicaSvcs) MarshalToSizedBufferVT(dAtA []byte) (int, error) i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Svcs) > 0 { - for iNdEx := len(m.Svcs) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Svcs[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if len(m.Services) > 0 { + for iNdEx := len(m.Services) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Services[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) if err != nil { return 0, err } @@ -9353,24 +9401,6 @@ func (m *Discoverer_Request) SizeVT() (n int) { return n } -func (m *Discoverer_ReadReplicaSvcsRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Namespace) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - func (m *Discoverer) SizeVT() (n int) { if m == nil { return 0 @@ -9523,7 +9553,7 @@ func (m *Info_Node) SizeVT() (n int) { return n } -func (m *Info_ReadReplicaSvc) SizeVT() (n int) { +func (m *Info_Service) SizeVT() (n int) { if m == nil { return 0 } @@ -9533,12 +9563,38 @@ func (m *Info_ReadReplicaSvc) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } - l = len(m.Addr) + l = len(m.ClusterIp) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if len(m.ClusterIps) > 0 { + for _, s := range m.ClusterIps { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + if len(m.Ports) > 0 { + for _, e := range m.Ports { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Info_ServicePort) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) if l > 0 { n += 1 + l + sov(uint64(l)) } - if m.Replicaid != 0 { - n += 1 + sov(uint64(m.Replicaid)) + if m.Port != 0 { + n += 1 + sov(uint64(m.Port)) } n += len(m.unknownFields) return n @@ -9614,14 +9670,14 @@ func (m *Info_Nodes) SizeVT() (n int) { return n } -func (m *Info_ReadReplicaSvcs) SizeVT() (n int) { +func (m *Info_Services) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Svcs) > 0 { - for _, e := range m.Svcs { + if len(m.Services) > 0 { + for _, e := range m.Services { l = e.SizeVT() n += 1 + l + sov(uint64(l)) } @@ -16176,121 +16232,6 @@ func (m *Discoverer_Request) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Discoverer_ReadReplicaSvcsRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Discoverer_ReadReplicaSvcsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Discoverer_ReadReplicaSvcsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Discoverer) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -17281,7 +17222,7 @@ func (m *Info_Node) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { +func (m *Info_Service) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -17304,10 +17245,10 @@ func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Info_ReadReplicaSvc: wiretype end group for non-group") + return fmt.Errorf("proto: Info_Service: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Info_ReadReplicaSvc: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Info_Service: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -17344,7 +17285,7 @@ func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIp", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -17372,13 +17313,162 @@ func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Addr = string(dAtA[iNdEx:postIndex]) + m.ClusterIp = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIps", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterIps = append(m.ClusterIps, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ports = append(m.Ports, &Info_ServicePort{}) + if err := m.Ports[len(m.Ports)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Info_ServicePort) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info_ServicePort: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info_ServicePort: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Replicaid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) } - m.Replicaid = 0 + m.Port = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -17388,7 +17478,7 @@ func (m *Info_ReadReplicaSvc) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Replicaid |= uint64(b&0x7F) << shift + m.Port |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -17753,7 +17843,7 @@ func (m *Info_Nodes) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Info_ReadReplicaSvcs) UnmarshalVT(dAtA []byte) error { +func (m *Info_Services) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -17776,15 +17866,15 @@ func (m *Info_ReadReplicaSvcs) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Info_ReadReplicaSvcs: wiretype end group for non-group") + return fmt.Errorf("proto: Info_Services: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Info_ReadReplicaSvcs: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Info_Services: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Svcs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -17811,8 +17901,8 @@ func (m *Info_ReadReplicaSvcs) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Svcs = append(m.Svcs, &Info_ReadReplicaSvc{}) - if err := m.Svcs[len(m.Svcs)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + m.Services = append(m.Services, &Info_Service{}) + if err := m.Services[len(m.Services)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/apis/proto/v1/discoverer/discoverer.proto b/apis/proto/v1/discoverer/discoverer.proto index 6500099a88..9dd0c22f56 100644 --- a/apis/proto/v1/discoverer/discoverer.proto +++ b/apis/proto/v1/discoverer/discoverer.proto @@ -45,9 +45,9 @@ service Discoverer { } // Represent the RPC to get the readreplica svc information. - rpc ReadReplicaSvcs(payload.v1.Discoverer.ReadReplicaSvcsRequest) returns (payload.v1.Info.ReadReplicaSvcs) { + rpc Services(payload.v1.Discoverer.Request) returns (payload.v1.Info.Services) { option (google.api.http) = { - post: "/discover/svcs" + post: "/discover/services" body: "*" }; } diff --git a/apis/proto/v1/payload/payload.proto b/apis/proto/v1/payload/payload.proto index 5984da4ad0..2974013656 100644 --- a/apis/proto/v1/payload/payload.proto +++ b/apis/proto/v1/payload/payload.proto @@ -498,14 +498,6 @@ message Discoverer { // The node to be discovered. string node = 3; } - - // Represent the dicoverer svc request. - message ReadReplicaSvcsRequest { - // The svc name to be discovered. - string name = 1 [(buf.validate.field).string.min_len = 1]; - // The namespace to be discovered. - string namespace = 2; - } } // Info related messages. @@ -571,14 +563,24 @@ message Info { Pods Pods = 6; } - // Represent the svc information message. - message ReadReplicaSvc { + // Represent the service information message. + message Service { // The name of the svc. string name = 1; - // The IP address of the svc. - string addr = 2; - // The replicaid of the readreplica svc. - uint64 replicaid = 3; + // The cluster ip of the svc. + string cluster_ip = 2; + // The cluster ips of the svc. + repeated string cluster_ips = 3; + // The port of the svc. + repeated ServicePort ports = 4; + } + + // Represets the service port information message. + message ServicePort { + // The name of the port. + string name = 1; + // The port number + int32 port = 2; } // Represent the CPU information message. @@ -613,10 +615,10 @@ message Info { repeated Node nodes = 1 [(buf.validate.field).repeated.min_items = 1]; } - // Represent the multiple svc information message. - message ReadReplicaSvcs { - // The multiple node information. - repeated ReadReplicaSvc svcs = 1 [(buf.validate.field).repeated.min_items = 1]; + // Represent the multiple service information message. + message Services { + // The multiple service information. + repeated Service services = 1 [(buf.validate.field).repeated.min_items = 1]; } // Represent the multiple IP message. diff --git a/apis/swagger/v1/discoverer/discoverer.swagger.json b/apis/swagger/v1/discoverer/discoverer.swagger.json index e867c97983..6e109c94f3 100644 --- a/apis/swagger/v1/discoverer/discoverer.swagger.json +++ b/apis/swagger/v1/discoverer/discoverer.swagger.json @@ -76,15 +76,15 @@ "tags": ["Discoverer"] } }, - "/discover/svcs": { + "/discover/services": { "post": { "summary": "Represent the RPC to get the readreplica svc information.", - "operationId": "Discoverer_ReadReplicaSvcs", + "operationId": "Discoverer_Services", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/InfoReadReplicaSvcs" + "$ref": "#/definitions/InfoServices" } }, "default": { @@ -97,11 +97,11 @@ "parameters": [ { "name": "body", - "description": "Represent the dicoverer svc request.", + "description": "Represent the dicoverer request.", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DiscovererReadReplicaSvcsRequest" + "$ref": "#/definitions/v1DiscovererRequest" } } ], @@ -110,20 +110,6 @@ } }, "definitions": { - "DiscovererReadReplicaSvcsRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The svc name to be discovered." - }, - "namespace": { - "type": "string", - "description": "The namespace to be discovered." - } - }, - "description": "Represent the dicoverer svc request." - }, "InfoCPU": { "type": "object", "properties": { @@ -258,38 +244,63 @@ }, "description": "Represent the multiple pod information message." }, - "InfoReadReplicaSvc": { + "InfoService": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of the svc." }, - "addr": { + "clusterIp": { "type": "string", - "description": "The IP address of the svc." + "description": "The cluster ip of the svc." }, - "replicaid": { + "clusterIps": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The cluster ips of the svc." + }, + "ports": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/InfoServicePort" + }, + "description": "The port of the svc." + } + }, + "description": "Represent the service information message." + }, + "InfoServicePort": { + "type": "object", + "properties": { + "name": { "type": "string", - "format": "uint64", - "description": "The replicaid of the readreplica svc." + "description": "The name of the port." + }, + "port": { + "type": "integer", + "format": "int32", + "title": "The port number" } }, - "description": "Represent the svc information message." + "description": "Represets the service port information message." }, - "InfoReadReplicaSvcs": { + "InfoServices": { "type": "object", "properties": { - "svcs": { + "services": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/InfoReadReplicaSvc" + "$ref": "#/definitions/InfoService" }, - "description": "The multiple node information." + "description": "The multiple service information." } }, - "description": "Represent the multiple svc information message." + "description": "Represent the multiple service information message." }, "protobufAny": { "type": "object", diff --git a/charts/vald-helm-operator/crds/valdrelease.yaml b/charts/vald-helm-operator/crds/valdrelease.yaml index 38f1d2e254..08832a86b2 100644 --- a/charts/vald-helm-operator/crds/valdrelease.yaml +++ b/charts/vald-helm-operator/crds/valdrelease.yaml @@ -2803,6 +2803,15 @@ spec: labels: type: object x-kubernetes-preserve-unknown-fields: true + service: + type: object + properties: + fields: + type: object + x-kubernetes-preserve-unknown-fields: true + labels: + type: object + x-kubernetes-preserve-unknown-fields: true enabled: type: boolean env: diff --git a/charts/vald/templates/_helpers.tpl b/charts/vald/templates/_helpers.tpl index c224fb6254..602de193fa 100755 --- a/charts/vald/templates/_helpers.tpl +++ b/charts/vald/templates/_helpers.tpl @@ -834,4 +834,17 @@ node_metrics: {{- else }} fields: {} {{- end }} +service: + {{- if .Values.node_metrics.labels }} + labels: + {{- toYaml .Values.service.labels | nindent 4 }} + {{- else }} + labels: {} + {{- end }} + {{- if .Values.service.fields }} + fields: + {{- toYaml .Values.service.fields | nindent 4 }} + {{- else }} + fields: {} + {{- end }} {{- end -}} diff --git a/charts/vald/templates/discoverer/configmap.yaml b/charts/vald/templates/discoverer/configmap.yaml index 37882b9895..610c195fde 100644 --- a/charts/vald/templates/discoverer/configmap.yaml +++ b/charts/vald/templates/discoverer/configmap.yaml @@ -49,12 +49,6 @@ data: selectors: {{- $selectors := dict "Values" $discoverer.discoverer.selectors "chart" . "agent" $agent }} {{- include "vald.discoverer.selector" $selectors | nindent 10 }} - readreplica_svc: - labels: - app.kubernetes.io/component: {{ $readreplica.component_name | quote }} - read_replica: - enabled: {{ $readreplica.enabled }} - id_key: {{ $readreplica.label_key | quote }} net: {{- toYaml $discoverer.discoverer.net | nindent 8 }} {{- end }} diff --git a/charts/vald/values.schema.json b/charts/vald/values.schema.json index 99e70097af..f225cea11d 100644 --- a/charts/vald/values.schema.json +++ b/charts/vald/values.schema.json @@ -4602,6 +4602,20 @@ "description": "k8s label selectors for pod_metrics discovery" } } + }, + "service": { + "type": "object", + "description": "k8s resource selectors for service discovery", + "properties": { + "fields": { + "type": "object", + "description": "k8s field selectors for service discovery" + }, + "labels": { + "type": "object", + "description": "k8s label selectors for service discovery" + } + } } } } diff --git a/charts/vald/values.yaml b/charts/vald/values.yaml index fff65e59f4..f48e1d2aa7 100644 --- a/charts/vald/values.yaml +++ b/charts/vald/values.yaml @@ -2363,6 +2363,15 @@ discoverer: # @schema {"name": "discoverer.discoverer.selectors.node_metrics.fields", "type": "object"} # discoverer.discoverer.selectors.node_metrics.fields -- k8s field selectors for node_metrics discovery fields: {} + # @schema {"name": "discoverer.discoverer.selectors.service", "type": "object"} + # discoverer.discoverer.selectors.service -- k8s resource selectors for service discovery + service: + # @schema {"name": "discoverer.discoverer.selectors.service.labels", "type": "object"} + # discoverer.discoverer.selectors.service.labels -- k8s label selectors for service discovery + labels: {} + # @schema {"name": "discoverer.discoverer.selectors.service.fields", "type": "object"} + # discoverer.discoverer.selectors.service.fields -- k8s field selectors for service discovery + fields: {} # @schema {"name": "discoverer.discoverer.net", "alias": "net"} net: dns: diff --git a/internal/config/discoverer.go b/internal/config/discoverer.go index c9594acffc..81835cbb48 100644 --- a/internal/config/discoverer.go +++ b/internal/config/discoverer.go @@ -19,20 +19,19 @@ package config // Discoverer represents the Discoverer configurations. type Discoverer struct { - Name string `json:"name,omitempty" yaml:"name"` - Namespace string `json:"namespace,omitempty" yaml:"namespace"` - DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` - Net *Net `json:"net,omitempty" yaml:"net"` - Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` - ReadReplica *ReadReplica `json:"read_replica,omitempty" yaml:"read_replica"` + Name string `json:"name,omitempty" yaml:"name"` + Namespace string `json:"namespace,omitempty" yaml:"namespace"` + DiscoveryDuration string `json:"discovery_duration,omitempty" yaml:"discovery_duration"` + Net *Net `json:"net,omitempty" yaml:"net"` + Selectors *Selectors `json:"selectors,omitempty" yaml:"selectors"` } type Selectors struct { - Pod *Selector `json:"pod,omitempty" yaml:"pod"` - Node *Selector `json:"node,omitempty" yaml:"node"` - NodeMetrics *Selector `json:"node_metrics,omitempty" yaml:"node_metrics"` - PodMetrics *Selector `json:"pod_metrics,omitempty" yaml:"pod_metrics"` - ReadReplicaSvc *Selector `json:"readreplica_svc,omitempty" yaml:"readreplica_svc"` + Pod *Selector `json:"pod,omitempty" yaml:"pod"` + Node *Selector `json:"node,omitempty" yaml:"node"` + NodeMetrics *Selector `json:"node_metrics,omitempty" yaml:"node_metrics"` + PodMetrics *Selector `json:"pod_metrics,omitempty" yaml:"pod_metrics"` + Service *Selector `json:"service,omitempty" yaml:"service"` } func (s *Selectors) GetPodFields() map[string]string { @@ -91,18 +90,18 @@ func (s *Selectors) GetNodeMetricsLabels() map[string]string { return s.NodeMetrics.GetLabels() } -func (s *Selectors) GetReadReplicaSvcFields() map[string]string { +func (s *Selectors) GetServiceFields() map[string]string { if s == nil { return nil } - return s.ReadReplicaSvc.GetFields() + return s.Service.GetFields() } -func (s *Selectors) GetReadReplicaSvcLabels() map[string]string { +func (s *Selectors) GetServiceLabels() map[string]string { if s == nil { return nil } - return s.ReadReplicaSvc.GetLabels() + return s.Service.GetLabels() } type Selector struct { @@ -160,12 +159,6 @@ func (d *Discoverer) Bind() *Discoverer { d.Selectors = new(Selectors) } - if d.ReadReplica != nil { - d.ReadReplica.Bind() - } else { - d.ReadReplica = new(ReadReplica) - } - return d } @@ -178,7 +171,7 @@ func (s *Selectors) Bind() *Selectors { s.Node = s.Node.Bind() s.PodMetrics = s.PodMetrics.Bind() s.NodeMetrics = s.NodeMetrics.Bind() - s.ReadReplicaSvc = s.ReadReplicaSvc.Bind() + s.Service = s.Service.Bind() return s } diff --git a/internal/config/discoverer_test.go b/internal/config/discoverer_test.go index 63a60f89df..d4349a1720 100644 --- a/internal/config/discoverer_test.go +++ b/internal/config/discoverer_test.go @@ -301,11 +301,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -334,7 +334,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -357,7 +357,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -388,11 +388,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetPodFields() @@ -406,11 +406,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -439,7 +439,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -462,7 +462,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -493,11 +493,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetPodLabels() @@ -511,11 +511,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -544,7 +544,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -567,7 +567,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -598,11 +598,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetNodeFields() @@ -616,11 +616,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -649,7 +649,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -672,7 +672,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -703,11 +703,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetNodeLabels() @@ -721,11 +721,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodMetricsFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -754,7 +754,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -777,7 +777,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -808,11 +808,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetPodMetricsFields() @@ -826,11 +826,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetPodMetricsLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -859,7 +859,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -882,7 +882,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -913,11 +913,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetPodMetricsLabels() @@ -931,11 +931,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeMetricsFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -964,7 +964,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -987,7 +987,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1018,11 +1018,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetNodeMetricsFields() @@ -1036,11 +1036,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // // func TestSelectors_GetNodeMetricsLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -1069,7 +1069,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1092,7 +1092,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1123,11 +1123,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.GetNodeMetricsLabels() @@ -1139,13 +1139,13 @@ func TestDiscovererClient_Bind(t *testing.T) { // } // } // -// func TestSelectors_GetReadReplicaSvcFields(t *testing.T) { +// func TestSelectors_GetServiceFields(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -1174,7 +1174,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1197,7 +1197,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1228,14 +1228,14 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // -// got := s.GetReadReplicaSvcFields() +// got := s.GetServiceFields() // if err := checkFunc(test.want, got); err != nil { // tt.Errorf("error = %v", err) // } @@ -1244,13 +1244,13 @@ func TestDiscovererClient_Bind(t *testing.T) { // } // } // -// func TestSelectors_GetReadReplicaSvcLabels(t *testing.T) { +// func TestSelectors_GetServiceLabels(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want map[string]string @@ -1279,7 +1279,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1302,7 +1302,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1333,14 +1333,14 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // -// got := s.GetReadReplicaSvcLabels() +// got := s.GetServiceLabels() // if err := checkFunc(test.want, got); err != nil { // tt.Errorf("error = %v", err) // } @@ -1535,13 +1535,199 @@ func TestDiscovererClient_Bind(t *testing.T) { // } // } // +// func TestReadReplica_GetEnabled(t *testing.T) { +// type fields struct { +// Enabled bool +// IDKey string +// } +// type want struct { +// want bool +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, bool) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got bool) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &ReadReplica{ +// Enabled: test.fields.Enabled, +// IDKey: test.fields.IDKey, +// } +// +// got := r.GetEnabled() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// +// func TestReadReplica_GetIDKey(t *testing.T) { +// type fields struct { +// Enabled bool +// IDKey string +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &ReadReplica{ +// Enabled: test.fields.Enabled, +// IDKey: test.fields.IDKey, +// } +// +// got := r.GetIDKey() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// // func TestSelectors_Bind(t *testing.T) { // type fields struct { -// Pod *Selector -// Node *Selector -// NodeMetrics *Selector -// PodMetrics *Selector -// ReadReplicaSvc *Selector +// Pod *Selector +// Node *Selector +// NodeMetrics *Selector +// PodMetrics *Selector +// Service *Selector // } // type want struct { // want *Selectors @@ -1570,7 +1756,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1593,7 +1779,7 @@ func TestDiscovererClient_Bind(t *testing.T) { // Node:Selector{}, // NodeMetrics:Selector{}, // PodMetrics:Selector{}, -// ReadReplicaSvc:Selector{}, +// Service:Selector{}, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1624,11 +1810,11 @@ func TestDiscovererClient_Bind(t *testing.T) { // checkFunc = defaultCheckFunc // } // s := &Selectors{ -// Pod: test.fields.Pod, -// Node: test.fields.Node, -// NodeMetrics: test.fields.NodeMetrics, -// PodMetrics: test.fields.PodMetrics, -// ReadReplicaSvc: test.fields.ReadReplicaSvc, +// Pod: test.fields.Pod, +// Node: test.fields.Node, +// NodeMetrics: test.fields.NodeMetrics, +// PodMetrics: test.fields.PodMetrics, +// Service: test.fields.Service, // } // // got := s.Bind() @@ -1732,3 +1918,96 @@ func TestDiscovererClient_Bind(t *testing.T) { // }) // } // } +// +// func TestReadReplica_Bind(t *testing.T) { +// type fields struct { +// Enabled bool +// IDKey string +// } +// type want struct { +// want *ReadReplica +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, *ReadReplica) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got *ReadReplica) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Enabled:false, +// IDKey:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// r := &ReadReplica{ +// Enabled: test.fields.Enabled, +// IDKey: test.fields.IDKey, +// } +// +// got := r.Bind() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } diff --git a/internal/errors/discoverer.go b/internal/errors/discoverer.go index 1e4312b144..a01f016c3e 100644 --- a/internal/errors/discoverer.go +++ b/internal/errors/discoverer.go @@ -45,7 +45,4 @@ var ( // ErrInvalidDiscoveryCache represents an error that type conversion of discovery cache failed. ErrInvalidDiscoveryCache = New("cache type cast failed") - - // ErrReadReplicaDisabled represents an error that read replica is disabled. - ErrReadReplicaDisabled = New("read replica is disabled by config") ) diff --git a/internal/k8s/svc/option.go b/internal/k8s/service/option.go similarity index 96% rename from internal/k8s/svc/option.go rename to internal/k8s/service/option.go index 5ac3e644c4..0effc6cec2 100644 --- a/internal/k8s/svc/option.go +++ b/internal/k8s/service/option.go @@ -15,7 +15,7 @@ // // Package svc provides kubernetes svc information and preriodically update -package svc +package service import ( "sigs.k8s.io/controller-runtime/pkg/client" @@ -47,7 +47,7 @@ func WithOnErrorFunc(f func(err error)) Option { } } -func WithOnReconcileFunc(f func(svcs []Svc)) Option { +func WithOnReconcileFunc(f func(svcs []Service)) Option { return func(r *reconciler) error { r.onReconcile = f return nil diff --git a/internal/k8s/svc/option_test.go b/internal/k8s/service/option_test.go similarity index 99% rename from internal/k8s/svc/option_test.go rename to internal/k8s/service/option_test.go index c1ac91b06a..c7debcd75e 100644 --- a/internal/k8s/svc/option_test.go +++ b/internal/k8s/service/option_test.go @@ -11,7 +11,7 @@ // 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 svc +package service // NOT IMPLEMENTED BELOW // @@ -275,7 +275,7 @@ package svc // // func TestWithOnReconcileFunc(t *testing.T) { // type args struct { -// f func(svcs []Svc) +// f func(svcs []Service) // } // type want struct { // want Option diff --git a/internal/k8s/svc/svc.go b/internal/k8s/service/svc.go similarity index 77% rename from internal/k8s/svc/svc.go rename to internal/k8s/service/svc.go index 49e7949e17..833cf55a4e 100644 --- a/internal/k8s/svc/svc.go +++ b/internal/k8s/service/svc.go @@ -15,7 +15,7 @@ // // Package svc provides kubernetes svc information and preriodically update -package svc +package service import ( "context" @@ -33,17 +33,28 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -type ( - SvcWatcher k8s.ResourceController - Svc = corev1.Service -) +type SvcWatcher k8s.ResourceController + +type Service struct { + Name string + ClusterIP string + ClusterIPs []string + Ports []servicePort + Labels map[string]string + Annotations map[string]string +} + +type servicePort struct { + Name string + Port int32 +} type reconciler struct { mgr manager.Manager name string namespace string onError func(err error) - onReconcile func(svcs []Svc) + onReconcile func(svcs []Service) lopts []client.ListOption } @@ -92,7 +103,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return res, err } - svcs := make([]Svc, 0, len(svcList.Items)) + svcs := make([]Service, 0, len(svcList.Items)) for i := range svcList.Items { svc := &svcList.Items[i] if svc.GetDeletionTimestamp() != nil { @@ -102,7 +113,16 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re svc.GetDeletionTimestamp()) continue } - svcs = append(svcs, *svc) + + ports := extractApiPorts(svc.Spec.Ports) + svcs = append(svcs, Service{ + Name: svc.GetName(), + ClusterIP: svc.Spec.ClusterIP, + ClusterIPs: svc.Spec.ClusterIPs, + Ports: ports, + Labels: svc.GetLabels(), + Annotations: svc.GetAnnotations(), + }) } if r.onReconcile != nil { r.onReconcile(svcs) @@ -111,6 +131,19 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return res, nil } +func extractApiPorts(ports []corev1.ServicePort) []servicePort { + var apiPorts []servicePort + for _, port := range ports { + if port.Name == "grpc" || port.Name == "rest" { + apiPorts = append(apiPorts, servicePort{ + Name: port.Name, + Port: port.Port, + }) + } + } + return apiPorts +} + func (r *reconciler) GetName() string { return r.name } diff --git a/internal/k8s/svc/svc_test.go b/internal/k8s/service/svc_test.go similarity index 90% rename from internal/k8s/svc/svc_test.go rename to internal/k8s/service/svc_test.go index 687560d02b..1ae7c40859 100644 --- a/internal/k8s/svc/svc_test.go +++ b/internal/k8s/service/svc_test.go @@ -11,7 +11,7 @@ // 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 svc +package service import ( _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" @@ -114,7 +114,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -229,7 +229,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -345,13 +345,99 @@ import ( // } // } // +// func Test_extractApiPorts(t *testing.T) { +// type args struct { +// ports []corev1.ServicePort +// } +// type want struct { +// want []servicePort +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, []servicePort) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got []servicePort) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ports:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ports:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := extractApiPorts(test.args.ports) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// +// }) +// } +// } +// // func Test_reconciler_GetName(t *testing.T) { // type fields struct { // mgr manager.Manager // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -464,7 +550,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -582,7 +668,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -695,7 +781,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { @@ -808,7 +894,7 @@ import ( // name string // namespace string // onError func(err error) -// onReconcile func(svcs []Svc) +// onReconcile func(svcs []Service) // lopts []client.ListOption // } // type want struct { diff --git a/pkg/discoverer/k8s/handler/grpc/handler.go b/pkg/discoverer/k8s/handler/grpc/handler.go index 246b1b0b18..f08777f65f 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler.go +++ b/pkg/discoverer/k8s/handler/grpc/handler.go @@ -40,9 +40,9 @@ type DiscovererServer interface { type server struct { dsc service.Discoverer - pgroup singleflight.Group[*payload.Info_Pods] // pod singleflight group - ngroup singleflight.Group[*payload.Info_Nodes] // node singleflight group - sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] // svc singleflight group + pgroup singleflight.Group[*payload.Info_Pods] // pod singleflight group + ngroup singleflight.Group[*payload.Info_Nodes] // node singleflight group + sgroup singleflight.Group[*payload.Info_Services] // services singleflight group ip string name string discoverer.UnimplementedDiscovererServer @@ -68,7 +68,7 @@ func New(opts ...Option) (ds DiscovererServer, err error) { s.pgroup = singleflight.New[*payload.Info_Pods]() s.ngroup = singleflight.New[*payload.Info_Nodes]() - s.sgroup = singleflight.New[*payload.Info_ReadReplicaSvcs]() + s.sgroup = singleflight.New[*payload.Info_Services]() return s, nil } @@ -224,8 +224,8 @@ func (s *server) Nodes(ctx context.Context, req *payload.Discoverer_Request) (*p return cn, nil } -func (s *server) ReadReplicaSvcs(ctx context.Context, req *payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) { - ctx, span := trace.StartSpan(ctx, apiName+".Svcs") +func (s *server) Services(ctx context.Context, req *payload.Discoverer_Request) (*payload.Info_Services, error) { + ctx, span := trace.StartSpan(ctx, apiName+".Services") defer func() { if span != nil { span.End() @@ -233,8 +233,8 @@ func (s *server) ReadReplicaSvcs(ctx context.Context, req *payload.Discoverer_Re }() key := singleflightKeyForSvcs(svcPrefix, req) - res, _, err := s.sgroup.Do(ctx, key, func(context.Context) (*payload.Info_ReadReplicaSvcs, error) { - return s.dsc.GetReadReplicaSvcs(req) + res, _, err := s.sgroup.Do(ctx, key, func(context.Context) (*payload.Info_Services, error) { + return s.dsc.GetServices(req) }) if err != nil { err = status.WrapWithInternal(fmt.Sprintf("Svcs API request (name: %s, namespace: %s) failed", req.GetName(), req.GetNamespace()), err, @@ -309,7 +309,7 @@ func singleflightKey(pref string, req *payload.Discoverer_Request) string { }, keyDelim) } -func singleflightKeyForSvcs(pref string, req *payload.Discoverer_ReadReplicaSvcsRequest) string { +func singleflightKeyForSvcs(pref string, req *payload.Discoverer_Request) string { return strings.Join([]string{ pref, req.GetNamespace(), diff --git a/pkg/discoverer/k8s/handler/grpc/handler_test.go b/pkg/discoverer/k8s/handler/grpc/handler_test.go index 705f0115c5..4f6c2cc8bc 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler_test.go +++ b/pkg/discoverer/k8s/handler/grpc/handler_test.go @@ -117,7 +117,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] -// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] +// sgroup singleflight.Group[*payload.Info_Services] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -236,7 +236,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] -// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] +// sgroup singleflight.Group[*payload.Info_Services] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -366,7 +366,7 @@ package grpc // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] -// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] +// sgroup singleflight.Group[*payload.Info_Services] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer @@ -487,22 +487,22 @@ package grpc // } // } // -// func Test_server_ReadReplicaSvcs(t *testing.T) { +// func Test_server_Services(t *testing.T) { // type args struct { // ctx context.Context -// req *payload.Discoverer_ReadReplicaSvcsRequest +// req *payload.Discoverer_Request // } // type fields struct { // dsc service.Discoverer // pgroup singleflight.Group[*payload.Info_Pods] // ngroup singleflight.Group[*payload.Info_Nodes] -// sgroup singleflight.Group[*payload.Info_ReadReplicaSvcs] +// sgroup singleflight.Group[*payload.Info_Services] // ip string // name string // UnimplementedDiscovererServer discoverer.UnimplementedDiscovererServer // } // type want struct { -// want *payload.Info_ReadReplicaSvcs +// want *payload.Info_Services // err error // } // type test struct { @@ -510,11 +510,11 @@ package grpc // args args // fields fields // want want -// checkFunc func(want, *payload.Info_ReadReplicaSvcs, error) error +// checkFunc func(want, *payload.Info_Services, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, got *payload.Info_ReadReplicaSvcs, err error) error { +// defaultCheckFunc := func(w want, got *payload.Info_Services, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } @@ -608,7 +608,7 @@ package grpc // UnimplementedDiscovererServer: test.fields.UnimplementedDiscovererServer, // } // -// got, err := s.ReadReplicaSvcs(test.args.ctx, test.args.req) +// got, err := s.Services(test.args.ctx, test.args.req) // if err := checkFunc(test.want, got, err); err != nil { // tt.Errorf("error = %v", err) // } diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index aa85ef91d6..e73b75f0e6 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -22,7 +22,6 @@ import ( "context" "reflect" "slices" - "strconv" "sync/atomic" "time" @@ -34,7 +33,7 @@ import ( mpod "github.com/vdaas/vald/internal/k8s/metrics/pod" "github.com/vdaas/vald/internal/k8s/node" "github.com/vdaas/vald/internal/k8s/pod" - "github.com/vdaas/vald/internal/k8s/svc" + "github.com/vdaas/vald/internal/k8s/service" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" "github.com/vdaas/vald/internal/safety" @@ -46,35 +45,27 @@ type Discoverer interface { Start(context.Context) (<-chan error, error) GetPods(*payload.Discoverer_Request) (*payload.Info_Pods, error) GetNodes(*payload.Discoverer_Request) (*payload.Info_Nodes, error) - GetReadReplicaSvcs(*payload.Discoverer_ReadReplicaSvcsRequest) (*payload.Info_ReadReplicaSvcs, error) -} - -type readReplicaSvc struct { - Name string - Addr string - ReplicaID uint64 + GetServices(*payload.Discoverer_Request) (*payload.Info_Services, error) } type discoverer struct { - maxPods int - nodes sync.Map[string, *node.Node] - nodeMetrics sync.Map[string, mnode.Node] - pods sync.Map[string, *[]pod.Pod] - podMetrics sync.Map[string, mpod.Pod] - rrsvcs sync.Map[string, readReplicaSvc] - podsByNode atomic.Value - podsByNamespace atomic.Value - podsByName atomic.Value - nodeByName atomic.Value - svcsByName atomic.Value - ctrl k8s.Controller - namespace string - name string - csd time.Duration - der net.Dialer - eg errgroup.Group - readReplicaEnabled bool - replicaIDKey string + maxPods int + nodes sync.Map[string, *node.Node] + nodeMetrics sync.Map[string, mnode.Node] + pods sync.Map[string, *[]pod.Pod] + podMetrics sync.Map[string, mpod.Pod] + rrsvcs sync.Map[string, *service.Service] + podsByNode atomic.Value + podsByNamespace atomic.Value + podsByName atomic.Value + nodeByName atomic.Value + svcsByName atomic.Value + ctrl k8s.Controller + namespace string + name string + csd time.Duration + der net.Dialer + eg errgroup.Group } // New returns Discoverer implementation. @@ -190,55 +181,33 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithFields(selector.GetNodeFields()), node.WithLabels(selector.GetNodeLabels()), )), - ) - - if d.readReplicaEnabled { - k8sOpts = append(k8sOpts, - k8s.WithResourceController(svc.New( - svc.WithControllerName("readreplica svc discoverer"), - svc.WithOnErrorFunc(func(err error) { - log.Error("failed to reconcile:", err) - }), - svc.WithOnReconcileFunc(func(svcs []svc.Svc) { - log.Debugf("svc resource reconciled\t%#v", svcs) - svcsmap := make(map[string]struct{}, len(svcs)) - for i := range svcs { - svc := &svcs[i] - svcsmap[svc.Name] = struct{}{} - - labels := svc.GetLabels() - v, ok := labels[d.replicaIDKey] - if !ok { - log.Errorf("this svc(%s) does not have readreplica id label(%s)", svc.GetName(), d.replicaIDKey) - continue - } - id, err := strconv.ParseUint(v, 10, 32) - if err != nil { - log.Errorf("failed to parse readreplica id string to uint: %w", err) - continue - } - - rrsvc := readReplicaSvc{ - Name: svc.GetName(), - Addr: svc.Spec.ClusterIP, - ReplicaID: id, - } - d.rrsvcs.Store(svc.Name, rrsvc) + // Only required when service reconciation is required like read replica. + k8s.WithResourceController(service.New( + service.WithControllerName("service discoverer"), + service.WithOnErrorFunc(func(err error) { + log.Error("failed to reconcile:", err) + }), + service.WithOnReconcileFunc(func(svcs []service.Service) { + log.Debugf("svc resource reconciled\t%#v", svcs) + svcsmap := make(map[string]struct{}, len(svcs)) + for i := range svcs { + svc := &svcs[i] + svcsmap[svc.Name] = struct{}{} + d.rrsvcs.Store(svc.Name, svc) + } + d.rrsvcs.Range(func(name string, _ *service.Service) bool { + _, ok := svcsmap[name] + if !ok { + d.rrsvcs.Delete(name) } - d.rrsvcs.Range(func(name string, _ readReplicaSvc) bool { - _, ok := svcsmap[name] - if !ok { - d.rrsvcs.Delete(name) - } - return true - }) - }), - svc.WithNamespace(d.namespace), - svc.WithFields(selector.GetReadReplicaSvcFields()), - svc.WithLabels(selector.GetReadReplicaSvcLabels()), - )), - ) - } + return true + }) + }), + service.WithNamespace(d.namespace), + service.WithFields(selector.GetServiceFields()), + service.WithLabels(selector.GetServiceLabels()), + )), + ) d.ctrl, err = k8s.New(k8sOpts...) if err != nil { @@ -270,7 +239,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { podsByNamespace = make(map[string]map[string][]*payload.Info_Pod) // map[namespace][name][]pod podsByName = make(map[string][]*payload.Info_Pod) // map[name][]pod nodeByName = make(map[string]*payload.Info_Node) // map[name]node - svcsByName = make(map[string]*payload.Info_ReadReplicaSvc) // map[name]svc + svcsByName = make(map[string]*payload.Info_Service) // map[name]svc ) d.nodes.Range(func(nodeName string, n *node.Node) bool { @@ -368,15 +337,23 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.rrsvcs.Range(func(key string, rrsvc readReplicaSvc) bool { + d.rrsvcs.Range(func(key string, rrsvc *service.Service) bool { select { case <-ctx.Done(): return false default: - ni := &payload.Info_ReadReplicaSvc{ - Name: rrsvc.Name, - Addr: rrsvc.Addr, - Replicaid: rrsvc.ReplicaID, + var ports []*payload.Info_ServicePort + for _, p := range rrsvc.Ports { + ports = append(ports, &payload.Info_ServicePort{ + Name: p.Name, + Port: p.Port, + }) + } + ni := &payload.Info_Service{ + Name: rrsvc.Name, + ClusterIp: rrsvc.ClusterIP, + ClusterIps: rrsvc.ClusterIPs, + Ports: ports, } svcsByName[rrsvc.Name] = ni return true @@ -571,12 +548,9 @@ func (d *discoverer) GetNodes(req *payload.Discoverer_Request) (nodes *payload.I return nodes, nil } -func (d *discoverer) GetReadReplicaSvcs(req *payload.Discoverer_ReadReplicaSvcsRequest) (svcs *payload.Info_ReadReplicaSvcs, err error) { - if !d.readReplicaEnabled { - return nil, errors.ErrReadReplicaDisabled - } - svcs = new(payload.Info_ReadReplicaSvcs) - sbn, ok := d.svcsByName.Load().(map[string]*payload.Info_ReadReplicaSvc) +func (d *discoverer) GetServices(req *payload.Discoverer_Request) (svcs *payload.Info_Services, err error) { + svcs = new(payload.Info_Services) + sbn, ok := d.svcsByName.Load().(map[string]*payload.Info_Service) if !ok { return nil, errors.ErrInvalidDiscoveryCache } @@ -586,10 +560,10 @@ func (d *discoverer) GetReadReplicaSvcs(req *payload.Discoverer_ReadReplicaSvcsR if !ok { return nil, errors.ErrSvcNameNotFound(req.GetName()) } - svcs.Svcs = append(svcs.Svcs, v) + svcs.Services = append(svcs.Services, v) } else { for _, svc := range sbn { - svcs.Svcs = append(svcs.Svcs, svc) + svcs.Services = append(svcs.Services, svc) } } diff --git a/pkg/discoverer/k8s/service/discover_test.go b/pkg/discoverer/k8s/service/discover_test.go index 7650461ffb..ec24bba4ca 100644 --- a/pkg/discoverer/k8s/service/discover_test.go +++ b/pkg/discoverer/k8s/service/discover_test.go @@ -122,7 +122,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, ReadReplicaSvc] +// rrsvcs sync.Map[string, *service.Service] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -134,7 +134,6 @@ package service // csd time.Duration // der net.Dialer // eg errgroup.Group -// replicaIDKey string // } // type want struct { // want <-chan error @@ -172,7 +171,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -184,7 +183,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -211,7 +209,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -223,7 +221,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -259,7 +256,7 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, -// svcs: test.fields.svcs, +// rrsvcs: test.fields.rrsvcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, @@ -271,7 +268,6 @@ package service // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, -// replicaIDKey: test.fields.replicaIDKey, // } // // got, err := d.Start(test.args.ctx) @@ -293,7 +289,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, ReadReplicaSvc] +// rrsvcs sync.Map[string, *service.Service] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -305,7 +301,6 @@ package service // csd time.Duration // der net.Dialer // eg errgroup.Group -// replicaIDKey string // } // type want struct { // wantPods *payload.Info_Pods @@ -343,7 +338,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -355,7 +350,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -382,7 +376,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -394,7 +388,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -430,7 +423,7 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, -// svcs: test.fields.svcs, +// rrsvcs: test.fields.rrsvcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, @@ -442,7 +435,6 @@ package service // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, -// replicaIDKey: test.fields.replicaIDKey, // } // // gotPods, err := d.GetPods(test.args.req) @@ -464,7 +456,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, ReadReplicaSvc] +// rrsvcs sync.Map[string, *service.Service] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -476,7 +468,6 @@ package service // csd time.Duration // der net.Dialer // eg errgroup.Group -// replicaIDKey string // } // type want struct { // wantNodes *payload.Info_Nodes @@ -514,7 +505,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -526,7 +517,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -553,7 +543,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -565,7 +555,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -601,7 +590,7 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, -// svcs: test.fields.svcs, +// rrsvcs: test.fields.rrsvcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, @@ -613,7 +602,6 @@ package service // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, -// replicaIDKey: test.fields.replicaIDKey, // } // // gotNodes, err := d.GetNodes(test.args.req) @@ -625,9 +613,9 @@ package service // } // } // -// func Test_discoverer_GetReadReplicaSvcs(t *testing.T) { +// func Test_discoverer_GetServices(t *testing.T) { // type args struct { -// req *payload.Discoverer_ReadReplicaSvcsRequest +// req *payload.Discoverer_Request // } // type fields struct { // maxPods int @@ -635,7 +623,7 @@ package service // nodeMetrics sync.Map[string, mnode.Node] // pods sync.Map[string, *[]pod.Pod] // podMetrics sync.Map[string, mpod.Pod] -// svcs sync.Map[string, ReadReplicaSvc] +// rrsvcs sync.Map[string, *service.Service] // podsByNode atomic.Value // podsByNamespace atomic.Value // podsByName atomic.Value @@ -647,10 +635,9 @@ package service // csd time.Duration // der net.Dialer // eg errgroup.Group -// replicaIDKey string // } // type want struct { -// wantSvcs *payload.Info_ReadReplicaSvcs +// wantSvcs *payload.Info_Services // err error // } // type test struct { @@ -658,11 +645,11 @@ package service // args args // fields fields // want want -// checkFunc func(want, *payload.Info_ReadReplicaSvcs, error) error +// checkFunc func(want, *payload.Info_Services, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, gotSvcs *payload.Info_ReadReplicaSvcs, err error) error { +// defaultCheckFunc := func(w want, gotSvcs *payload.Info_Services, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } @@ -685,7 +672,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -697,7 +684,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -724,7 +710,7 @@ package service // nodeMetrics:nil, // pods:nil, // podMetrics:nil, -// svcs:nil, +// rrsvcs:nil, // podsByNode:nil, // podsByNamespace:nil, // podsByName:nil, @@ -736,7 +722,6 @@ package service // csd:nil, // der:nil, // eg:nil, -// replicaIDKey:"", // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -772,7 +757,7 @@ package service // nodeMetrics: test.fields.nodeMetrics, // pods: test.fields.pods, // podMetrics: test.fields.podMetrics, -// svcs: test.fields.svcs, +// rrsvcs: test.fields.rrsvcs, // podsByNode: test.fields.podsByNode, // podsByNamespace: test.fields.podsByNamespace, // podsByName: test.fields.podsByName, @@ -784,10 +769,9 @@ package service // csd: test.fields.csd, // der: test.fields.der, // eg: test.fields.eg, -// replicaIDKey: test.fields.replicaIDKey, // } // -// gotSvcs, err := d.GetReadReplicaSvcs(test.args.req) +// gotSvcs, err := d.GetServices(test.args.req) // if err := checkFunc(test.want, gotSvcs, err); err != nil { // tt.Errorf("error = %v", err) // } diff --git a/pkg/discoverer/k8s/service/option.go b/pkg/discoverer/k8s/service/option.go index 028387cf4d..426d112348 100644 --- a/pkg/discoverer/k8s/service/option.go +++ b/pkg/discoverer/k8s/service/option.go @@ -20,7 +20,6 @@ package service import ( "time" - "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/net" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/internal/timeutil" @@ -82,20 +81,3 @@ func WithErrGroup(eg errgroup.Group) Option { return nil } } - -func WithReadReplicaEnabled(enabled bool) Option { - return func(d *discoverer) error { - d.readReplicaEnabled = enabled - return nil - } -} - -func WithReadReplicaIDKey(key string) Option { - return func(d *discoverer) error { - if key == "" { - return errors.NewErrInvalidOption("readReplicaIDKey", key) - } - d.replicaIDKey = key - return nil - } -} diff --git a/pkg/discoverer/k8s/service/option_test.go b/pkg/discoverer/k8s/service/option_test.go index 8bf18ce231..303de17430 100644 --- a/pkg/discoverer/k8s/service/option_test.go +++ b/pkg/discoverer/k8s/service/option_test.go @@ -448,89 +448,3 @@ package service // }) // } // } -// -// func TestWithReadReplicaIDKey(t *testing.T) { -// type args struct { -// key string -// } -// type want struct { -// want Option -// } -// type test struct { -// name string -// args args -// want want -// checkFunc func(want, Option) error -// beforeFunc func(*testing.T, args) -// afterFunc func(*testing.T, args) -// } -// defaultCheckFunc := func(w want, got Option) error { -// if !reflect.DeepEqual(got, w.want) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) -// } -// return nil -// } -// tests := []test{ -// // TODO test cases -// /* -// { -// name: "test_case_1", -// args: args { -// key:"", -// }, -// want: want{}, -// checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// afterFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// }, -// */ -// -// // TODO test cases -// /* -// func() test { -// return test { -// name: "test_case_2", -// args: args { -// key:"", -// }, -// want: want{}, -// checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// afterFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// } -// }(), -// */ -// } -// -// for _, tc := range tests { -// test := tc -// t.Run(test.name, func(tt *testing.T) { -// tt.Parallel() -// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) -// if test.beforeFunc != nil { -// test.beforeFunc(tt, test.args) -// } -// if test.afterFunc != nil { -// defer test.afterFunc(tt, test.args) -// } -// checkFunc := test.checkFunc -// if test.checkFunc == nil { -// checkFunc = defaultCheckFunc -// } -// -// got := WithReadReplicaIDKey(test.args.key) -// if err := checkFunc(test.want, got); err != nil { -// tt.Errorf("error = %v", err) -// } -// -// }) -// } -// } diff --git a/pkg/discoverer/k8s/usecase/discovered.go b/pkg/discoverer/k8s/usecase/discovered.go index a6f69a2fc2..35b42eaef9 100644 --- a/pkg/discoverer/k8s/usecase/discovered.go +++ b/pkg/discoverer/k8s/usecase/discovered.go @@ -67,8 +67,6 @@ func New(cfg *config.Data) (r runner.Runner, err error) { service.WithName(cfg.Discoverer.Name), service.WithNamespace(cfg.Discoverer.Namespace), service.WithDialer(der), - service.WithReadReplicaEnabled(cfg.Discoverer.ReadReplica.GetEnabled()), - service.WithReadReplicaIDKey(cfg.Discoverer.ReadReplica.GetIDKey()), ) if err != nil { return nil, err From 90e579c96796900497e8ea9790a226c525056058 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 13 Dec 2023 08:40:56 +0000 Subject: [PATCH 19/27] Add extractAPIPorts test --- internal/config/discoverer_test.go | 4 - internal/k8s/service/{svc.go => service.go} | 28 +- .../service/{svc_test.go => service_test.go} | 253 ++++++++++++------ 3 files changed, 182 insertions(+), 103 deletions(-) rename internal/k8s/service/{svc.go => service.go} (97%) rename internal/k8s/service/{svc_test.go => service_test.go} (89%) diff --git a/internal/config/discoverer_test.go b/internal/config/discoverer_test.go index d4349a1720..3456e968d9 100644 --- a/internal/config/discoverer_test.go +++ b/internal/config/discoverer_test.go @@ -67,7 +67,6 @@ func TestDiscoverer_Bind(t *testing.T) { DiscoveryDuration: "10ms", Net: new(Net), Selectors: new(Selectors), - ReadReplica: new(ReadReplica), }, }, } @@ -88,7 +87,6 @@ func TestDiscoverer_Bind(t *testing.T) { DiscoveryDuration: "10ms", Net: new(Net), Selectors: new(Selectors), - ReadReplica: new(ReadReplica), }, }, } @@ -120,7 +118,6 @@ func TestDiscoverer_Bind(t *testing.T) { DiscoveryDuration: "10ms", Net: new(Net), Selectors: new(Selectors), - ReadReplica: new(ReadReplica), }, }, } @@ -147,7 +144,6 @@ func TestDiscoverer_Bind(t *testing.T) { DiscoveryDuration: test.fields.DiscoveryDuration, Net: test.fields.Net, Selectors: test.fields.Selectors, - ReadReplica: test.fields.ReadReplica, } got := d.Bind() diff --git a/internal/k8s/service/svc.go b/internal/k8s/service/service.go similarity index 97% rename from internal/k8s/service/svc.go rename to internal/k8s/service/service.go index 833cf55a4e..9dbd62b34b 100644 --- a/internal/k8s/service/svc.go +++ b/internal/k8s/service/service.go @@ -77,6 +77,19 @@ func (r *reconciler) addListOpts(opt client.ListOption) { r.lopts = append(r.lopts, opt) } +func extractAPIPorts(ports []corev1.ServicePort) []servicePort { + var apiPorts []servicePort + for _, port := range ports { + if port.Name == "grpc" || port.Name == "rest" { + apiPorts = append(apiPorts, servicePort{ + Name: port.Name, + Port: port.Port, + }) + } + } + return apiPorts +} + func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res reconcile.Result, err error) { svcList := &corev1.ServiceList{} @@ -114,7 +127,7 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re continue } - ports := extractApiPorts(svc.Spec.Ports) + ports := extractAPIPorts(svc.Spec.Ports) svcs = append(svcs, Service{ Name: svc.GetName(), ClusterIP: svc.Spec.ClusterIP, @@ -131,19 +144,6 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return res, nil } -func extractApiPorts(ports []corev1.ServicePort) []servicePort { - var apiPorts []servicePort - for _, port := range ports { - if port.Name == "grpc" || port.Name == "rest" { - apiPorts = append(apiPorts, servicePort{ - Name: port.Name, - Port: port.Port, - }) - } - } - return apiPorts -} - func (r *reconciler) GetName() string { return r.name } diff --git a/internal/k8s/service/svc_test.go b/internal/k8s/service/service_test.go similarity index 89% rename from internal/k8s/service/svc_test.go rename to internal/k8s/service/service_test.go index 1ae7c40859..1d1004f29f 100644 --- a/internal/k8s/service/svc_test.go +++ b/internal/k8s/service/service_test.go @@ -14,9 +14,177 @@ package service import ( + "reflect" + "testing" + + "github.com/vdaas/vald/internal/errors" + "github.com/vdaas/vald/internal/test/goleak" + corev1 "k8s.io/api/core/v1" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ) +func Test_extractAPIPorts(t *testing.T) { + type args struct { + ports []corev1.ServicePort + } + type want struct { + ports []servicePort + } + type test struct { + name string + args args + want want + checkFunc func(want, []servicePort) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultCheckFunc := func(w want, got []servicePort) error { + if !reflect.DeepEqual(got, w.ports) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.ports) + } + return nil + } + tests := []test{ + { + name: "success to parse grpc", + args: args{ + ports: []corev1.ServicePort{ + { + Name: "grpc", + Port: 8081, + }, + { + Name: "readiness", + Port: 3000, + }, + { + Name: "liveness", + Port: 3001, + }, + { + Name: "pprof", + Port: 6060, + }, + }, + }, + want: want{ + ports: []servicePort{ + { + Name: "grpc", + Port: 8081, + }, + }, + }, + checkFunc: defaultCheckFunc, + }, + { + name: "success to parse rest", + args: args{ + ports: []corev1.ServicePort{ + { + Name: "rest", + Port: 8082, + }, + { + Name: "readiness", + Port: 3000, + }, + { + Name: "liveness", + Port: 3001, + }, + { + Name: "pprof", + Port: 6060, + }, + }, + }, + want: want{ + ports: []servicePort{ + { + Name: "rest", + Port: 8082, + }, + }, + }, + checkFunc: defaultCheckFunc, + }, + { + name: "success to parse grpc and rest", + args: args{ + ports: []corev1.ServicePort{ + { + Name: "rest", + Port: 8082, + }, + { + Name: "grpc", + Port: 8081, + }, + { + Name: "readiness", + Port: 3000, + }, + { + Name: "liveness", + Port: 3001, + }, + { + Name: "pprof", + Port: 6060, + }, + }, + }, + want: want{ + ports: []servicePort{ + { + Name: "rest", + Port: 8082, + }, + { + Name: "grpc", + Port: 8081, + }, + }, + }, + checkFunc: defaultCheckFunc, + }, + { + name: "empty input returns empty", + args: args{ + ports: nil, + }, + want: want{ + ports: nil, + }, + checkFunc: defaultCheckFunc, + }, + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got := extractAPIPorts(test.args.ports) + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + // NOT IMPLEMENTED BELOW // // func TestNew(t *testing.T) { @@ -345,91 +513,6 @@ import ( // } // } // -// func Test_extractApiPorts(t *testing.T) { -// type args struct { -// ports []corev1.ServicePort -// } -// type want struct { -// want []servicePort -// } -// type test struct { -// name string -// args args -// want want -// checkFunc func(want, []servicePort) error -// beforeFunc func(*testing.T, args) -// afterFunc func(*testing.T, args) -// } -// defaultCheckFunc := func(w want, got []servicePort) error { -// if !reflect.DeepEqual(got, w.want) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) -// } -// return nil -// } -// tests := []test{ -// // TODO test cases -// /* -// { -// name: "test_case_1", -// args: args { -// ports:nil, -// }, -// want: want{}, -// checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// afterFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// }, -// */ -// -// // TODO test cases -// /* -// func() test { -// return test { -// name: "test_case_2", -// args: args { -// ports:nil, -// }, -// want: want{}, -// checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// afterFunc: func(t *testing.T, args args) { -// t.Helper() -// }, -// } -// }(), -// */ -// } -// -// for _, tc := range tests { -// test := tc -// t.Run(test.name, func(tt *testing.T) { -// tt.Parallel() -// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) -// if test.beforeFunc != nil { -// test.beforeFunc(tt, test.args) -// } -// if test.afterFunc != nil { -// defer test.afterFunc(tt, test.args) -// } -// checkFunc := test.checkFunc -// if test.checkFunc == nil { -// checkFunc = defaultCheckFunc -// } -// -// got := extractApiPorts(test.args.ports) -// if err := checkFunc(test.want, got); err != nil { -// tt.Errorf("error = %v", err) -// } -// -// }) -// } -// } // // func Test_reconciler_GetName(t *testing.T) { // type fields struct { From f0e2e0037ccf9064abb7d90fb87bd8ee05589f10 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 13 Dec 2023 08:48:51 +0000 Subject: [PATCH 20/27] Add t.Parallel on the top level --- internal/k8s/service/service_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/k8s/service/service_test.go b/internal/k8s/service/service_test.go index 1d1004f29f..2f058d04b4 100644 --- a/internal/k8s/service/service_test.go +++ b/internal/k8s/service/service_test.go @@ -24,6 +24,8 @@ import ( ) func Test_extractAPIPorts(t *testing.T) { + t.Parallel() + type args struct { ports []corev1.ServicePort } From 725e288de9ad4300514979b03df220d9f243a0ec Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:49:13 +0000 Subject: [PATCH 21/27] style: format code with Gofumpt and Prettier This commit fixes the style issues introduced in f0e2e00 according to the output from Gofumpt and Prettier. Details: https://github.com/vdaas/vald/pull/2263 --- internal/k8s/service/service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/k8s/service/service_test.go b/internal/k8s/service/service_test.go index 2f058d04b4..0ce51a8890 100644 --- a/internal/k8s/service/service_test.go +++ b/internal/k8s/service/service_test.go @@ -25,7 +25,7 @@ import ( func Test_extractAPIPorts(t *testing.T) { t.Parallel() - + type args struct { ports []corev1.ServicePort } From a16b1e557b1b761497339cae5c14d7414344565b Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 13 Dec 2023 08:56:05 +0000 Subject: [PATCH 22/27] rename rrsvcs to services --- pkg/discoverer/k8s/service/discover.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index e73b75f0e6..98c8731edd 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -54,7 +54,7 @@ type discoverer struct { nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] - rrsvcs sync.Map[string, *service.Service] + services sync.Map[string, *service.Service] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value @@ -193,12 +193,12 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) for i := range svcs { svc := &svcs[i] svcsmap[svc.Name] = struct{}{} - d.rrsvcs.Store(svc.Name, svc) + d.services.Store(svc.Name, svc) } - d.rrsvcs.Range(func(name string, _ *service.Service) bool { + d.services.Range(func(name string, _ *service.Service) bool { _, ok := svcsmap[name] if !ok { - d.rrsvcs.Delete(name) + d.services.Delete(name) } return true }) @@ -337,7 +337,7 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.rrsvcs.Range(func(key string, rrsvc *service.Service) bool { + d.services.Range(func(key string, rrsvc *service.Service) bool { select { case <-ctx.Done(): return false From 38c9af6fe127cd89f73905c54a5a85ae04ca60f9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:56:36 +0000 Subject: [PATCH 23/27] style: format code with Gofumpt and Prettier This commit fixes the style issues introduced in a16b1e5 according to the output from Gofumpt and Prettier. Details: https://github.com/vdaas/vald/pull/2263 --- pkg/discoverer/k8s/service/discover.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 98c8731edd..3286dc2a68 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -54,7 +54,7 @@ type discoverer struct { nodeMetrics sync.Map[string, mnode.Node] pods sync.Map[string, *[]pod.Pod] podMetrics sync.Map[string, mpod.Pod] - services sync.Map[string, *service.Service] + services sync.Map[string, *service.Service] podsByNode atomic.Value podsByNamespace atomic.Value podsByName atomic.Value From 354ab817c7032d846bef645615844af27a866572 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Thu, 14 Dec 2023 02:47:05 +0000 Subject: [PATCH 24/27] Add Labels and Annotations field in payload --- apis/docs/v1/docs.md | 38 +- apis/grpc/v1/payload/payload.pb.go | 377 ++++++++--- apis/grpc/v1/payload/payload_vtproto.pb.go | 594 ++++++++++++++++++ apis/proto/v1/payload/payload.proto | 16 + apis/swagger/v1/agent/core/agent.swagger.json | 4 +- .../v1/agent/sidecar/sidecar.swagger.json | 4 +- .../v1/discoverer/discoverer.swagger.json | 44 +- .../filter/egress/egress_filter.swagger.json | 4 +- .../ingress/ingress_filter.swagger.json | 4 +- .../manager/index/index_manager.swagger.json | 4 +- apis/swagger/v1/payload/payload.swagger.json | 4 +- .../rpc/errdetails/error_details.swagger.json | 4 +- apis/swagger/v1/vald/filter.swagger.json | 4 +- apis/swagger/v1/vald/insert.swagger.json | 4 +- apis/swagger/v1/vald/object.swagger.json | 4 +- apis/swagger/v1/vald/remove.swagger.json | 4 +- apis/swagger/v1/vald/search.swagger.json | 4 +- apis/swagger/v1/vald/update.swagger.json | 4 +- apis/swagger/v1/vald/upsert.swagger.json | 4 +- pkg/discoverer/k8s/service/discover.go | 30 +- 20 files changed, 1009 insertions(+), 146 deletions(-) diff --git a/apis/docs/v1/docs.md b/apis/docs/v1/docs.md index fa0cf30994..5d2ac8e7c0 100644 --- a/apis/docs/v1/docs.md +++ b/apis/docs/v1/docs.md @@ -15,6 +15,7 @@ - [Filter.Config](#payload-v1-Filter-Config) - [Filter.Target](#payload-v1-Filter-Target) - [Info](#payload-v1-Info) + - [Info.Annotation](#payload-v1-Info-Annotation) - [Info.CPU](#payload-v1-Info-CPU) - [Info.IPs](#payload-v1-Info-IPs) - [Info.Index](#payload-v1-Info-Index) @@ -22,6 +23,7 @@ - [Info.Index.UUID](#payload-v1-Info-Index-UUID) - [Info.Index.UUID.Committed](#payload-v1-Info-Index-UUID-Committed) - [Info.Index.UUID.Uncommitted](#payload-v1-Info-Index-UUID-Uncommitted) + - [Info.Label](#payload-v1-Info-Label) - [Info.Memory](#payload-v1-Info-Memory) - [Info.Node](#payload-v1-Info-Node) - [Info.Nodes](#payload-v1-Info-Nodes) @@ -211,6 +213,17 @@ Represent the target filter server. Info related messages. + + +### Info.Annotation + +Represent the kubernetes annotation. + +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| key | [string](#string) | | | +| value | [string](#string) | | | + ### Info.CPU @@ -278,6 +291,17 @@ The uncommitted UUID. | ----- | ----------------- | ----- | ----------- | | uuid | [string](#string) | | | + + +### Info.Label + +Represent the kubernetes label. + +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| key | [string](#string) | | | +| value | [string](#string) | | | + ### Info.Memory @@ -347,12 +371,14 @@ Represent the multiple pod information message. Represent the service information message. -| Field | Type | Label | Description | -| ----------- | ------------------------------------------------ | -------- | --------------------------- | -| name | [string](#string) | | The name of the svc. | -| cluster_ip | [string](#string) | | The cluster ip of the svc. | -| cluster_ips | [string](#string) | repeated | The cluster ips of the svc. | -| ports | [Info.ServicePort](#payload-v1-Info-ServicePort) | repeated | The port of the svc. | +| Field | Type | Label | Description | +| ----------- | ------------------------------------------------ | -------- | ------------------------------- | +| name | [string](#string) | | The name of the svc. | +| cluster_ip | [string](#string) | | The cluster ip of the svc. | +| cluster_ips | [string](#string) | repeated | The cluster ips of the svc. | +| ports | [Info.ServicePort](#payload-v1-Info-ServicePort) | repeated | The port of the svc. | +| labels | [Info.Label](#payload-v1-Info-Label) | repeated | The labels of the service. | +| annotations | [Info.Annotation](#payload-v1-Info-Annotation) | repeated | The annotations of the service. | diff --git a/apis/grpc/v1/payload/payload.pb.go b/apis/grpc/v1/payload/payload.pb.go index 2c02ee4375..65c185f74b 100644 --- a/apis/grpc/v1/payload/payload.pb.go +++ b/apis/grpc/v1/payload/payload.pb.go @@ -4027,6 +4027,10 @@ type Info_Service struct { ClusterIps []string `protobuf:"bytes,3,rep,name=cluster_ips,json=clusterIps,proto3" json:"cluster_ips,omitempty"` // The port of the svc. Ports []*Info_ServicePort `protobuf:"bytes,4,rep,name=ports,proto3" json:"ports,omitempty"` + // The labels of the service. + Labels []*Info_Label `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"` + // The annotations of the service. + Annotations []*Info_Annotation `protobuf:"bytes,6,rep,name=annotations,proto3" json:"annotations,omitempty"` } func (x *Info_Service) Reset() { @@ -4089,6 +4093,20 @@ func (x *Info_Service) GetPorts() []*Info_ServicePort { return nil } +func (x *Info_Service) GetLabels() []*Info_Label { + if x != nil { + return x.Labels + } + return nil +} + +func (x *Info_Service) GetAnnotations() []*Info_Annotation { + if x != nil { + return x.Annotations + } + return nil +} + // Represets the service port information message. type Info_ServicePort struct { state protoimpl.MessageState @@ -4147,6 +4165,118 @@ func (x *Info_ServicePort) GetPort() int32 { return 0 } +// Represent the kubernetes label. +type Info_Label struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Info_Label) Reset() { + *x = Info_Label{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_payload_payload_proto_msgTypes[69] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info_Label) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info_Label) ProtoMessage() {} + +func (x *Info_Label) ProtoReflect() protoreflect.Message { + mi := &file_v1_payload_payload_proto_msgTypes[69] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info_Label.ProtoReflect.Descriptor instead. +func (*Info_Label) Descriptor() ([]byte, []int) { + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} +} + +func (x *Info_Label) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Info_Label) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +// Represent the kubernetes annotation. +type Info_Annotation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Info_Annotation) Reset() { + *x = Info_Annotation{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_payload_payload_proto_msgTypes[70] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info_Annotation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info_Annotation) ProtoMessage() {} + +func (x *Info_Annotation) ProtoReflect() protoreflect.Message { + mi := &file_v1_payload_payload_proto_msgTypes[70] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info_Annotation.ProtoReflect.Descriptor instead. +func (*Info_Annotation) Descriptor() ([]byte, []int) { + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} +} + +func (x *Info_Annotation) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Info_Annotation) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + // Represent the CPU information message. type Info_CPU struct { state protoimpl.MessageState @@ -4164,7 +4294,7 @@ type Info_CPU struct { func (x *Info_CPU) Reset() { *x = Info_CPU{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[69] + mi := &file_v1_payload_payload_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4177,7 +4307,7 @@ func (x *Info_CPU) String() string { func (*Info_CPU) ProtoMessage() {} func (x *Info_CPU) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[69] + mi := &file_v1_payload_payload_proto_msgTypes[71] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4190,7 +4320,7 @@ func (x *Info_CPU) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_CPU.ProtoReflect.Descriptor instead. func (*Info_CPU) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} } func (x *Info_CPU) GetLimit() float64 { @@ -4231,7 +4361,7 @@ type Info_Memory struct { func (x *Info_Memory) Reset() { *x = Info_Memory{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[70] + mi := &file_v1_payload_payload_proto_msgTypes[72] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4244,7 +4374,7 @@ func (x *Info_Memory) String() string { func (*Info_Memory) ProtoMessage() {} func (x *Info_Memory) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[70] + mi := &file_v1_payload_payload_proto_msgTypes[72] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4257,7 +4387,7 @@ func (x *Info_Memory) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Memory.ProtoReflect.Descriptor instead. func (*Info_Memory) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} } func (x *Info_Memory) GetLimit() float64 { @@ -4294,7 +4424,7 @@ type Info_Pods struct { func (x *Info_Pods) Reset() { *x = Info_Pods{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[71] + mi := &file_v1_payload_payload_proto_msgTypes[73] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4307,7 +4437,7 @@ func (x *Info_Pods) String() string { func (*Info_Pods) ProtoMessage() {} func (x *Info_Pods) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[71] + mi := &file_v1_payload_payload_proto_msgTypes[73] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4320,7 +4450,7 @@ func (x *Info_Pods) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Pods.ProtoReflect.Descriptor instead. func (*Info_Pods) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 7} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 9} } func (x *Info_Pods) GetPods() []*Info_Pod { @@ -4343,7 +4473,7 @@ type Info_Nodes struct { func (x *Info_Nodes) Reset() { *x = Info_Nodes{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[72] + mi := &file_v1_payload_payload_proto_msgTypes[74] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4356,7 +4486,7 @@ func (x *Info_Nodes) String() string { func (*Info_Nodes) ProtoMessage() {} func (x *Info_Nodes) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[72] + mi := &file_v1_payload_payload_proto_msgTypes[74] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4369,7 +4499,7 @@ func (x *Info_Nodes) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Nodes.ProtoReflect.Descriptor instead. func (*Info_Nodes) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 8} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 10} } func (x *Info_Nodes) GetNodes() []*Info_Node { @@ -4392,7 +4522,7 @@ type Info_Services struct { func (x *Info_Services) Reset() { *x = Info_Services{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[75] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4405,7 +4535,7 @@ func (x *Info_Services) String() string { func (*Info_Services) ProtoMessage() {} func (x *Info_Services) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[73] + mi := &file_v1_payload_payload_proto_msgTypes[75] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4418,7 +4548,7 @@ func (x *Info_Services) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_Services.ProtoReflect.Descriptor instead. func (*Info_Services) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 9} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 11} } func (x *Info_Services) GetServices() []*Info_Service { @@ -4440,7 +4570,7 @@ type Info_IPs struct { func (x *Info_IPs) Reset() { *x = Info_IPs{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[74] + mi := &file_v1_payload_payload_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4453,7 +4583,7 @@ func (x *Info_IPs) String() string { func (*Info_IPs) ProtoMessage() {} func (x *Info_IPs) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[74] + mi := &file_v1_payload_payload_proto_msgTypes[76] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4466,7 +4596,7 @@ func (x *Info_IPs) ProtoReflect() protoreflect.Message { // Deprecated: Use Info_IPs.ProtoReflect.Descriptor instead. func (*Info_IPs) Descriptor() ([]byte, []int) { - return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 10} + return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 12} } func (x *Info_IPs) GetIp() []string { @@ -4495,7 +4625,7 @@ type Info_Index_Count struct { func (x *Info_Index_Count) Reset() { *x = Info_Index_Count{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[75] + mi := &file_v1_payload_payload_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4508,7 +4638,7 @@ func (x *Info_Index_Count) String() string { func (*Info_Index_Count) ProtoMessage() {} func (x *Info_Index_Count) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[75] + mi := &file_v1_payload_payload_proto_msgTypes[77] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4562,7 +4692,7 @@ type Info_Index_UUID struct { func (x *Info_Index_UUID) Reset() { *x = Info_Index_UUID{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[76] + mi := &file_v1_payload_payload_proto_msgTypes[78] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4575,7 +4705,7 @@ func (x *Info_Index_UUID) String() string { func (*Info_Index_UUID) ProtoMessage() {} func (x *Info_Index_UUID) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[76] + mi := &file_v1_payload_payload_proto_msgTypes[78] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4603,7 +4733,7 @@ type Info_Index_UUID_Committed struct { func (x *Info_Index_UUID_Committed) Reset() { *x = Info_Index_UUID_Committed{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[77] + mi := &file_v1_payload_payload_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4616,7 +4746,7 @@ func (x *Info_Index_UUID_Committed) String() string { func (*Info_Index_UUID_Committed) ProtoMessage() {} func (x *Info_Index_UUID_Committed) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[77] + mi := &file_v1_payload_payload_proto_msgTypes[79] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4651,7 +4781,7 @@ type Info_Index_UUID_Uncommitted struct { func (x *Info_Index_UUID_Uncommitted) Reset() { *x = Info_Index_UUID_Uncommitted{} if protoimpl.UnsafeEnabled { - mi := &file_v1_payload_payload_proto_msgTypes[78] + mi := &file_v1_payload_payload_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4664,7 +4794,7 @@ func (x *Info_Index_UUID_Uncommitted) String() string { func (*Info_Index_UUID_Uncommitted) ProtoMessage() {} func (x *Info_Index_UUID_Uncommitted) ProtoReflect() protoreflect.Message { - mi := &file_v1_payload_payload_proto_msgTypes[78] + mi := &file_v1_payload_payload_proto_msgTypes[80] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5048,7 +5178,7 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0xf7, 0x09, 0x0a, 0x04, 0x49, 0x6e, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0xcd, 0x0b, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, @@ -5091,7 +5221,7 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x91, 0x01, 0x0a, + 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x80, 0x02, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, @@ -5101,41 +5231,54 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x1a, 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x4b, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x12, 0x14, - 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, - 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, - 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x04, - 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, - 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, - 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x6e, 0x6f, 0x64, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x42, - 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, - 0x1a, 0x4a, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x12, 0x2e, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x12, 0x3d, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, + 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x2f, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x34, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4b, 0x0a, + 0x03, 0x43, 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, + 0x64, 0x73, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, + 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, + 0x35, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, - 0x08, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x15, 0x0a, 0x03, - 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, - 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x0b, 0x56, - 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, - 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, - 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0xa2, 0x02, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, + 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x1a, 0x4a, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, + 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, + 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, + 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x42, 0x0b, 0x56, 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, + 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0xa2, 0x02, + 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5151,7 +5294,7 @@ func file_v1_payload_payload_proto_rawDescGZIP() []byte { } var file_v1_payload_payload_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 79) +var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 81) var file_v1_payload_payload_proto_goTypes = []interface{}{ (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator @@ -5224,17 +5367,19 @@ var file_v1_payload_payload_proto_goTypes = []interface{}{ (*Info_Node)(nil), // 68: payload.v1.Info.Node (*Info_Service)(nil), // 69: payload.v1.Info.Service (*Info_ServicePort)(nil), // 70: payload.v1.Info.ServicePort - (*Info_CPU)(nil), // 71: payload.v1.Info.CPU - (*Info_Memory)(nil), // 72: payload.v1.Info.Memory - (*Info_Pods)(nil), // 73: payload.v1.Info.Pods - (*Info_Nodes)(nil), // 74: payload.v1.Info.Nodes - (*Info_Services)(nil), // 75: payload.v1.Info.Services - (*Info_IPs)(nil), // 76: payload.v1.Info.IPs - (*Info_Index_Count)(nil), // 77: payload.v1.Info.Index.Count - (*Info_Index_UUID)(nil), // 78: payload.v1.Info.Index.UUID - (*Info_Index_UUID_Committed)(nil), // 79: payload.v1.Info.Index.UUID.Committed - (*Info_Index_UUID_Uncommitted)(nil), // 80: payload.v1.Info.Index.UUID.Uncommitted - (*status.Status)(nil), // 81: google.rpc.Status + (*Info_Label)(nil), // 71: payload.v1.Info.Label + (*Info_Annotation)(nil), // 72: payload.v1.Info.Annotation + (*Info_CPU)(nil), // 73: payload.v1.Info.CPU + (*Info_Memory)(nil), // 74: payload.v1.Info.Memory + (*Info_Pods)(nil), // 75: payload.v1.Info.Pods + (*Info_Nodes)(nil), // 76: payload.v1.Info.Nodes + (*Info_Services)(nil), // 77: payload.v1.Info.Services + (*Info_IPs)(nil), // 78: payload.v1.Info.IPs + (*Info_Index_Count)(nil), // 79: payload.v1.Info.Index.Count + (*Info_Index_UUID)(nil), // 80: payload.v1.Info.Index.UUID + (*Info_Index_UUID_Committed)(nil), // 81: payload.v1.Info.Index.UUID.Committed + (*Info_Index_UUID_Uncommitted)(nil), // 82: payload.v1.Info.Index.UUID.Uncommitted + (*status.Status)(nil), // 83: google.rpc.Status } var file_v1_payload_payload_proto_depIdxs = []int32{ 19, // 0: payload.v1.Search.Request.config:type_name -> payload.v1.Search.Config @@ -5250,7 +5395,7 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 46, // 10: payload.v1.Search.Response.results:type_name -> payload.v1.Object.Distance 20, // 11: payload.v1.Search.Responses.responses:type_name -> payload.v1.Search.Response 20, // 12: payload.v1.Search.StreamResponse.response:type_name -> payload.v1.Search.Response - 81, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status + 83, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status 23, // 14: payload.v1.Filter.Config.targets:type_name -> payload.v1.Filter.Target 50, // 15: payload.v1.Insert.Request.vector:type_name -> payload.v1.Object.Vector 29, // 16: payload.v1.Insert.Request.config:type_name -> payload.v1.Insert.Config @@ -5284,33 +5429,35 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 48, // 44: payload.v1.Object.VectorRequest.id:type_name -> payload.v1.Object.ID 24, // 45: payload.v1.Object.VectorRequest.filters:type_name -> payload.v1.Filter.Config 46, // 46: payload.v1.Object.StreamDistance.distance:type_name -> payload.v1.Object.Distance - 81, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status + 83, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status 48, // 48: payload.v1.Object.GetTimestampRequest.id:type_name -> payload.v1.Object.ID 50, // 49: payload.v1.Object.Vectors.vectors:type_name -> payload.v1.Object.Vector 50, // 50: payload.v1.Object.StreamVector.vector:type_name -> payload.v1.Object.Vector - 81, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status + 83, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status 56, // 52: payload.v1.Object.StreamBlob.blob:type_name -> payload.v1.Object.Blob - 81, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status + 83, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status 58, // 54: payload.v1.Object.StreamLocation.location:type_name -> payload.v1.Object.Location - 81, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status + 83, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status 58, // 56: payload.v1.Object.Locations.locations:type_name -> payload.v1.Object.Location 50, // 57: payload.v1.Object.List.Response.vector:type_name -> payload.v1.Object.Vector - 81, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status - 71, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU - 72, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory + 83, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status + 73, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU + 74, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory 68, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node - 71, // 62: payload.v1.Info.Node.cpu:type_name -> payload.v1.Info.CPU - 72, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory - 73, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods + 73, // 62: payload.v1.Info.Node.cpu:type_name -> payload.v1.Info.CPU + 74, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory + 75, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods 70, // 65: payload.v1.Info.Service.ports:type_name -> payload.v1.Info.ServicePort - 67, // 66: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod - 68, // 67: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node - 69, // 68: payload.v1.Info.Services.services:type_name -> payload.v1.Info.Service - 69, // [69:69] is the sub-list for method output_type - 69, // [69:69] is the sub-list for method input_type - 69, // [69:69] is the sub-list for extension type_name - 69, // [69:69] is the sub-list for extension extendee - 0, // [0:69] is the sub-list for field type_name + 71, // 66: payload.v1.Info.Service.labels:type_name -> payload.v1.Info.Label + 72, // 67: payload.v1.Info.Service.annotations:type_name -> payload.v1.Info.Annotation + 67, // 68: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod + 68, // 69: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node + 69, // 70: payload.v1.Info.Services.services:type_name -> payload.v1.Info.Service + 71, // [71:71] is the sub-list for method output_type + 71, // [71:71] is the sub-list for method input_type + 71, // [71:71] is the sub-list for extension type_name + 71, // [71:71] is the sub-list for extension extendee + 0, // [0:71] is the sub-list for field type_name } func init() { file_v1_payload_payload_proto_init() } @@ -6148,7 +6295,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_CPU); i { + switch v := v.(*Info_Label); i { case 0: return &v.state case 1: @@ -6160,7 +6307,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Memory); i { + switch v := v.(*Info_Annotation); i { case 0: return &v.state case 1: @@ -6172,7 +6319,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Pods); i { + switch v := v.(*Info_CPU); i { case 0: return &v.state case 1: @@ -6184,7 +6331,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Nodes); i { + switch v := v.(*Info_Memory); i { case 0: return &v.state case 1: @@ -6196,7 +6343,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Services); i { + switch v := v.(*Info_Pods); i { case 0: return &v.state case 1: @@ -6208,7 +6355,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_IPs); i { + switch v := v.(*Info_Nodes); i { case 0: return &v.state case 1: @@ -6220,7 +6367,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_Count); i { + switch v := v.(*Info_Services); i { case 0: return &v.state case 1: @@ -6232,7 +6379,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_UUID); i { + switch v := v.(*Info_IPs); i { case 0: return &v.state case 1: @@ -6244,7 +6391,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Index_UUID_Committed); i { + switch v := v.(*Info_Index_Count); i { case 0: return &v.state case 1: @@ -6256,6 +6403,30 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[78].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info_Index_UUID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_payload_payload_proto_msgTypes[79].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info_Index_UUID_Committed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_payload_payload_proto_msgTypes[80].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Info_Index_UUID_Uncommitted); i { case 0: return &v.state @@ -6298,7 +6469,7 @@ func file_v1_payload_payload_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v1_payload_payload_proto_rawDesc, NumEnums: 2, - NumMessages: 79, + NumMessages: 81, NumExtensions: 0, NumServices: 0, }, diff --git a/apis/grpc/v1/payload/payload_vtproto.pb.go b/apis/grpc/v1/payload/payload_vtproto.pb.go index b1d86d4abf..f8a35771e3 100644 --- a/apis/grpc/v1/payload/payload_vtproto.pb.go +++ b/apis/grpc/v1/payload/payload_vtproto.pb.go @@ -1609,6 +1609,20 @@ func (m *Info_Service) CloneVT() *Info_Service { } r.Ports = tmpContainer } + if rhs := m.Labels; rhs != nil { + tmpContainer := make([]*Info_Label, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Labels = tmpContainer + } + if rhs := m.Annotations; rhs != nil { + tmpContainer := make([]*Info_Annotation, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Annotations = tmpContainer + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -1639,6 +1653,44 @@ func (m *Info_ServicePort) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Info_Label) CloneVT() *Info_Label { + if m == nil { + return (*Info_Label)(nil) + } + r := &Info_Label{ + Key: m.Key, + Value: m.Value, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Info_Label) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Info_Annotation) CloneVT() *Info_Annotation { + if m == nil { + return (*Info_Annotation)(nil) + } + r := &Info_Annotation{ + Key: m.Key, + Value: m.Value, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Info_Annotation) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *Info_CPU) CloneVT() *Info_CPU { if m == nil { return (*Info_CPU)(nil) @@ -3920,6 +3972,40 @@ func (this *Info_Service) EqualVT(that *Info_Service) bool { } } } + if len(this.Labels) != len(that.Labels) { + return false + } + for i, vx := range this.Labels { + vy := that.Labels[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Info_Label{} + } + if q == nil { + q = &Info_Label{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Annotations) != len(that.Annotations) { + return false + } + for i, vx := range this.Annotations { + vy := that.Annotations[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Info_Annotation{} + } + if q == nil { + q = &Info_Annotation{} + } + if !p.EqualVT(q) { + return false + } + } + } return string(this.unknownFields) == string(that.unknownFields) } @@ -3952,6 +4038,50 @@ func (this *Info_ServicePort) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Info_Label) EqualVT(that *Info_Label) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Key != that.Key { + return false + } + if this.Value != that.Value { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Info_Label) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Label) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Info_Annotation) EqualVT(that *Info_Annotation) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Key != that.Key { + return false + } + if this.Value != that.Value { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Info_Annotation) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Annotation) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *Info_CPU) EqualVT(that *Info_CPU) bool { if this == that { return true @@ -7780,6 +7910,30 @@ func (m *Info_Service) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.Annotations) > 0 { + for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Annotations[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + } + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Labels[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + } if len(m.Ports) > 0 { for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { size, err := m.Ports[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) @@ -7863,6 +8017,100 @@ func (m *Info_ServicePort) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Info_Label) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info_Label) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Info_Label) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarint(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Info_Annotation) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info_Annotation) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Info_Annotation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarint(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Info_CPU) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -9579,6 +9827,18 @@ func (m *Info_Service) SizeVT() (n int) { n += 1 + l + sov(uint64(l)) } } + if len(m.Labels) > 0 { + for _, e := range m.Labels { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + if len(m.Annotations) > 0 { + for _, e := range m.Annotations { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } n += len(m.unknownFields) return n } @@ -9600,6 +9860,42 @@ func (m *Info_ServicePort) SizeVT() (n int) { return n } +func (m *Info_Label) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Info_Annotation) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *Info_CPU) SizeVT() (n int) { if m == nil { return 0 @@ -17381,6 +17677,74 @@ func (m *Info_Service) UnmarshalVT(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Labels = append(m.Labels, &Info_Label{}) + if err := m.Labels[len(m.Labels)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Annotations = append(m.Annotations, &Info_Annotation{}) + if err := m.Annotations[len(m.Annotations)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -17505,6 +17869,236 @@ func (m *Info_ServicePort) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Info_Label) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info_Label: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info_Label: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Info_Annotation) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info_Annotation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info_Annotation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Info_CPU) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/apis/proto/v1/payload/payload.proto b/apis/proto/v1/payload/payload.proto index 2974013656..0d028c7754 100644 --- a/apis/proto/v1/payload/payload.proto +++ b/apis/proto/v1/payload/payload.proto @@ -573,6 +573,10 @@ message Info { repeated string cluster_ips = 3; // The port of the svc. repeated ServicePort ports = 4; + // The labels of the service. + repeated Label labels = 5; + // The annotations of the service. + repeated Annotation annotations = 6; } // Represets the service port information message. @@ -583,6 +587,18 @@ message Info { int32 port = 2; } + // Represent the kubernetes label. + message Label { + string key = 1; + string value = 2; + } + + // Represent the kubernetes annotation. + message Annotation { + string key = 1; + string value = 2; + } + // Represent the CPU information message. message CPU { // The CPU resource limit. diff --git a/apis/swagger/v1/agent/core/agent.swagger.json b/apis/swagger/v1/agent/core/agent.swagger.json index 82e99b0fdf..a3c2fda39b 100644 --- a/apis/swagger/v1/agent/core/agent.swagger.json +++ b/apis/swagger/v1/agent/core/agent.swagger.json @@ -185,11 +185,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/agent/sidecar/sidecar.swagger.json b/apis/swagger/v1/agent/sidecar/sidecar.swagger.json index a044f2a146..c3f84e0170 100644 --- a/apis/swagger/v1/agent/sidecar/sidecar.swagger.json +++ b/apis/swagger/v1/agent/sidecar/sidecar.swagger.json @@ -13,11 +13,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/discoverer/discoverer.swagger.json b/apis/swagger/v1/discoverer/discoverer.swagger.json index 6e109c94f3..e9a8881c40 100644 --- a/apis/swagger/v1/discoverer/discoverer.swagger.json +++ b/apis/swagger/v1/discoverer/discoverer.swagger.json @@ -269,6 +269,22 @@ "$ref": "#/definitions/InfoServicePort" }, "description": "The port of the svc." + }, + "labels": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1InfoLabel" + }, + "description": "The labels of the service." + }, + "annotations": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1InfoAnnotation" + }, + "description": "The annotations of the service." } }, "description": "Represent the service information message." @@ -307,11 +323,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", @@ -353,6 +369,30 @@ } }, "description": "Represent the dicoverer request." + }, + "v1InfoAnnotation": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "description": "Represent the kubernetes annotation." + }, + "v1InfoLabel": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "description": "Represent the kubernetes label." } } } diff --git a/apis/swagger/v1/filter/egress/egress_filter.swagger.json b/apis/swagger/v1/filter/egress/egress_filter.swagger.json index b368572f94..395887d8e2 100644 --- a/apis/swagger/v1/filter/egress/egress_filter.swagger.json +++ b/apis/swagger/v1/filter/egress/egress_filter.swagger.json @@ -121,11 +121,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/filter/ingress/ingress_filter.swagger.json b/apis/swagger/v1/filter/ingress/ingress_filter.swagger.json index 38a6028dbd..ae3504a56b 100644 --- a/apis/swagger/v1/filter/ingress/ingress_filter.swagger.json +++ b/apis/swagger/v1/filter/ingress/ingress_filter.swagger.json @@ -121,11 +121,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/manager/index/index_manager.swagger.json b/apis/swagger/v1/manager/index/index_manager.swagger.json index 80dba65478..73a3c346cf 100644 --- a/apis/swagger/v1/manager/index/index_manager.swagger.json +++ b/apis/swagger/v1/manager/index/index_manager.swagger.json @@ -64,11 +64,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/payload/payload.swagger.json b/apis/swagger/v1/payload/payload.swagger.json index 66c9631809..345c401edd 100644 --- a/apis/swagger/v1/payload/payload.swagger.json +++ b/apis/swagger/v1/payload/payload.swagger.json @@ -13,11 +13,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/rpc/errdetails/error_details.swagger.json b/apis/swagger/v1/rpc/errdetails/error_details.swagger.json index 8e12730af2..50d969b871 100644 --- a/apis/swagger/v1/rpc/errdetails/error_details.swagger.json +++ b/apis/swagger/v1/rpc/errdetails/error_details.swagger.json @@ -13,11 +13,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/filter.swagger.json b/apis/swagger/v1/vald/filter.swagger.json index 2ff5de1ad3..d4993d784e 100644 --- a/apis/swagger/v1/vald/filter.swagger.json +++ b/apis/swagger/v1/vald/filter.swagger.json @@ -387,11 +387,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/insert.swagger.json b/apis/swagger/v1/vald/insert.swagger.json index 7c17e63578..8b47bbcdde 100644 --- a/apis/swagger/v1/vald/insert.swagger.json +++ b/apis/swagger/v1/vald/insert.swagger.json @@ -148,11 +148,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/object.swagger.json b/apis/swagger/v1/vald/object.swagger.json index fb4e9250ad..b0ca410f12 100644 --- a/apis/swagger/v1/vald/object.swagger.json +++ b/apis/swagger/v1/vald/object.swagger.json @@ -181,11 +181,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/remove.swagger.json b/apis/swagger/v1/vald/remove.swagger.json index ada5d12c65..b68f220b47 100644 --- a/apis/swagger/v1/vald/remove.swagger.json +++ b/apis/swagger/v1/vald/remove.swagger.json @@ -171,11 +171,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/search.swagger.json b/apis/swagger/v1/vald/search.swagger.json index 30e387f2d5..3a0dafd252 100644 --- a/apis/swagger/v1/vald/search.swagger.json +++ b/apis/swagger/v1/vald/search.swagger.json @@ -373,11 +373,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/update.swagger.json b/apis/swagger/v1/vald/update.swagger.json index e7fce2b767..1b256710d6 100644 --- a/apis/swagger/v1/vald/update.swagger.json +++ b/apis/swagger/v1/vald/update.swagger.json @@ -148,11 +148,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/apis/swagger/v1/vald/upsert.swagger.json b/apis/swagger/v1/vald/upsert.swagger.json index 06b19c032a..d4f429b6f3 100644 --- a/apis/swagger/v1/vald/upsert.swagger.json +++ b/apis/swagger/v1/vald/upsert.swagger.json @@ -148,11 +148,11 @@ "properties": { "@type": { "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 3286dc2a68..c256e2e957 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -337,25 +337,41 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { return true } }) - d.services.Range(func(key string, rrsvc *service.Service) bool { + d.services.Range(func(key string, svc *service.Service) bool { select { case <-ctx.Done(): return false default: var ports []*payload.Info_ServicePort - for _, p := range rrsvc.Ports { + for _, p := range svc.Ports { ports = append(ports, &payload.Info_ServicePort{ Name: p.Name, Port: p.Port, }) } + var labels []*payload.Info_Label + for k, v := range svc.Labels { + labels = append(labels, &payload.Info_Label{ + Key: k, + Value: v, + }) + } + var annotations []*payload.Info_Annotation + for k, v := range svc.Annotations { + annotations = append(annotations, &payload.Info_Annotation{ + Key: k, + Value: v, + }) + } ni := &payload.Info_Service{ - Name: rrsvc.Name, - ClusterIp: rrsvc.ClusterIP, - ClusterIps: rrsvc.ClusterIPs, - Ports: ports, + Name: svc.Name, + ClusterIp: svc.ClusterIP, + ClusterIps: svc.ClusterIPs, + Ports: ports, + Labels: labels, + Annotations: annotations, } - svcsByName[rrsvc.Name] = ni + svcsByName[svc.Name] = ni return true } }) From 2b7c55e352053974ae5518fd9598f4517f93f30a Mon Sep 17 00:00:00 2001 From: ykadowak Date: Thu, 14 Dec 2023 04:19:25 +0000 Subject: [PATCH 25/27] Use map type as Labels and Annotations payload --- apis/docs/v1/docs.md | 38 +- apis/grpc/v1/payload/payload.pb.go | 234 ++++---- apis/grpc/v1/payload/payload_vtproto.pb.go | 568 +++++++++++------- apis/proto/v1/payload/payload.proto | 18 +- .../v1/discoverer/discoverer.swagger.json | 60 +- pkg/discoverer/k8s/service/discover.go | 30 +- 6 files changed, 529 insertions(+), 419 deletions(-) diff --git a/apis/docs/v1/docs.md b/apis/docs/v1/docs.md index 5d2ac8e7c0..80245dd00c 100644 --- a/apis/docs/v1/docs.md +++ b/apis/docs/v1/docs.md @@ -15,7 +15,8 @@ - [Filter.Config](#payload-v1-Filter-Config) - [Filter.Target](#payload-v1-Filter-Target) - [Info](#payload-v1-Info) - - [Info.Annotation](#payload-v1-Info-Annotation) + - [Info.Annotations](#payload-v1-Info-Annotations) + - [Info.Annotations.AnnotationsEntry](#payload-v1-Info-Annotations-AnnotationsEntry) - [Info.CPU](#payload-v1-Info-CPU) - [Info.IPs](#payload-v1-Info-IPs) - [Info.Index](#payload-v1-Info-Index) @@ -23,7 +24,8 @@ - [Info.Index.UUID](#payload-v1-Info-Index-UUID) - [Info.Index.UUID.Committed](#payload-v1-Info-Index-UUID-Committed) - [Info.Index.UUID.Uncommitted](#payload-v1-Info-Index-UUID-Uncommitted) - - [Info.Label](#payload-v1-Info-Label) + - [Info.Labels](#payload-v1-Info-Labels) + - [Info.Labels.LabelsEntry](#payload-v1-Info-Labels-LabelsEntry) - [Info.Memory](#payload-v1-Info-Memory) - [Info.Node](#payload-v1-Info-Node) - [Info.Nodes](#payload-v1-Info-Nodes) @@ -213,11 +215,19 @@ Represent the target filter server. Info related messages. - + -### Info.Annotation +### Info.Annotations -Represent the kubernetes annotation. +Represent the kubernetes annotations. + +| Field | Type | Label | Description | +| ----------- | ---------------------------------------------------------------------------------- | -------- | ----------- | +| annotations | [Info.Annotations.AnnotationsEntry](#payload-v1-Info-Annotations-AnnotationsEntry) | repeated | | + + + +### Info.Annotations.AnnotationsEntry | Field | Type | Label | Description | | ----- | ----------------- | ----- | ----------- | @@ -291,11 +301,19 @@ The uncommitted UUID. | ----- | ----------------- | ----- | ----------- | | uuid | [string](#string) | | | - + + +### Info.Labels + +Represent the kubernetes labels. + +| Field | Type | Label | Description | +| ------ | -------------------------------------------------------------- | -------- | ----------- | +| labels | [Info.Labels.LabelsEntry](#payload-v1-Info-Labels-LabelsEntry) | repeated | | -### Info.Label + -Represent the kubernetes label. +### Info.Labels.LabelsEntry | Field | Type | Label | Description | | ----- | ----------------- | ----- | ----------- | @@ -377,8 +395,8 @@ Represent the service information message. | cluster_ip | [string](#string) | | The cluster ip of the svc. | | cluster_ips | [string](#string) | repeated | The cluster ips of the svc. | | ports | [Info.ServicePort](#payload-v1-Info-ServicePort) | repeated | The port of the svc. | -| labels | [Info.Label](#payload-v1-Info-Label) | repeated | The labels of the service. | -| annotations | [Info.Annotation](#payload-v1-Info-Annotation) | repeated | The annotations of the service. | +| labels | [Info.Labels](#payload-v1-Info-Labels) | | The labels of the service. | +| annotations | [Info.Annotations](#payload-v1-Info-Annotations) | | The annotations of the service. | diff --git a/apis/grpc/v1/payload/payload.pb.go b/apis/grpc/v1/payload/payload.pb.go index 65c185f74b..5950868f82 100644 --- a/apis/grpc/v1/payload/payload.pb.go +++ b/apis/grpc/v1/payload/payload.pb.go @@ -4028,9 +4028,9 @@ type Info_Service struct { // The port of the svc. Ports []*Info_ServicePort `protobuf:"bytes,4,rep,name=ports,proto3" json:"ports,omitempty"` // The labels of the service. - Labels []*Info_Label `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"` + Labels *Info_Labels `protobuf:"bytes,5,opt,name=labels,proto3" json:"labels,omitempty"` // The annotations of the service. - Annotations []*Info_Annotation `protobuf:"bytes,6,rep,name=annotations,proto3" json:"annotations,omitempty"` + Annotations *Info_Annotations `protobuf:"bytes,6,opt,name=annotations,proto3" json:"annotations,omitempty"` } func (x *Info_Service) Reset() { @@ -4093,14 +4093,14 @@ func (x *Info_Service) GetPorts() []*Info_ServicePort { return nil } -func (x *Info_Service) GetLabels() []*Info_Label { +func (x *Info_Service) GetLabels() *Info_Labels { if x != nil { return x.Labels } return nil } -func (x *Info_Service) GetAnnotations() []*Info_Annotation { +func (x *Info_Service) GetAnnotations() *Info_Annotations { if x != nil { return x.Annotations } @@ -4165,18 +4165,17 @@ func (x *Info_ServicePort) GetPort() int32 { return 0 } -// Represent the kubernetes label. -type Info_Label struct { +// Represent the kubernetes labels. +type Info_Labels struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Labels map[string]string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *Info_Label) Reset() { - *x = Info_Label{} +func (x *Info_Labels) Reset() { + *x = Info_Labels{} if protoimpl.UnsafeEnabled { mi := &file_v1_payload_payload_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4184,13 +4183,13 @@ func (x *Info_Label) Reset() { } } -func (x *Info_Label) String() string { +func (x *Info_Labels) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Info_Label) ProtoMessage() {} +func (*Info_Labels) ProtoMessage() {} -func (x *Info_Label) ProtoReflect() protoreflect.Message { +func (x *Info_Labels) ProtoReflect() protoreflect.Message { mi := &file_v1_payload_payload_proto_msgTypes[69] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4202,37 +4201,29 @@ func (x *Info_Label) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Info_Label.ProtoReflect.Descriptor instead. -func (*Info_Label) Descriptor() ([]byte, []int) { +// Deprecated: Use Info_Labels.ProtoReflect.Descriptor instead. +func (*Info_Labels) Descriptor() ([]byte, []int) { return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 5} } -func (x *Info_Label) GetKey() string { +func (x *Info_Labels) GetLabels() map[string]string { if x != nil { - return x.Key - } - return "" -} - -func (x *Info_Label) GetValue() string { - if x != nil { - return x.Value + return x.Labels } - return "" + return nil } -// Represent the kubernetes annotation. -type Info_Annotation struct { +// Represent the kubernetes annotations. +type Info_Annotations struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Annotations map[string]string `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *Info_Annotation) Reset() { - *x = Info_Annotation{} +func (x *Info_Annotations) Reset() { + *x = Info_Annotations{} if protoimpl.UnsafeEnabled { mi := &file_v1_payload_payload_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4240,13 +4231,13 @@ func (x *Info_Annotation) Reset() { } } -func (x *Info_Annotation) String() string { +func (x *Info_Annotations) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Info_Annotation) ProtoMessage() {} +func (*Info_Annotations) ProtoMessage() {} -func (x *Info_Annotation) ProtoReflect() protoreflect.Message { +func (x *Info_Annotations) ProtoReflect() protoreflect.Message { mi := &file_v1_payload_payload_proto_msgTypes[70] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4258,23 +4249,16 @@ func (x *Info_Annotation) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Info_Annotation.ProtoReflect.Descriptor instead. -func (*Info_Annotation) Descriptor() ([]byte, []int) { +// Deprecated: Use Info_Annotations.ProtoReflect.Descriptor instead. +func (*Info_Annotations) Descriptor() ([]byte, []int) { return file_v1_payload_payload_proto_rawDescGZIP(), []int{9, 6} } -func (x *Info_Annotation) GetKey() string { +func (x *Info_Annotations) GetAnnotations() map[string]string { if x != nil { - return x.Key - } - return "" -} - -func (x *Info_Annotation) GetValue() string { - if x != nil { - return x.Value + return x.Annotations } - return "" + return nil } // Represent the CPU information message. @@ -5178,7 +5162,7 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0xcd, 0x0b, 0x0a, 0x04, 0x49, 0x6e, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x8c, 0x0d, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xca, 0x01, 0x0a, 0x05, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x20, 0x0a, @@ -5221,7 +5205,7 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x80, 0x02, 0x0a, + 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x52, 0x04, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x82, 0x02, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, @@ -5231,54 +5215,66 @@ var file_v1_payload_payload_proto_rawDesc = []byte{ 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x12, 0x2e, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x12, 0x3d, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, - 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, - 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x2f, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, + 0x12, 0x2f, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x73, 0x12, 0x3e, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x1a, 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x80, 0x01, 0x0a, 0x06, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, + 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x34, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4b, 0x0a, - 0x03, 0x43, 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, - 0x64, 0x73, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, - 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, - 0x35, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, - 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x1a, 0x4a, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, - 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, - 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x42, 0x64, 0x0a, 0x1d, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, - 0x76, 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x42, 0x0b, 0x56, 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, - 0x64, 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0xa2, 0x02, - 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x9e, 0x01, 0x0a, 0x0b, + 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x0b, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3e, 0x0a, 0x10, + 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4b, 0x0a, 0x03, + 0x43, 0x50, 0x55, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4e, 0x0a, 0x06, 0x4d, 0x65, 0x6d, + 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3a, 0x0a, 0x04, 0x50, 0x6f, 0x64, + 0x73, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, + 0x04, 0x70, 0x6f, 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x35, + 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, + 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x1a, 0x4a, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, + 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0xba, + 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x1a, 0x15, 0x0a, 0x03, 0x49, 0x50, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x42, 0x64, 0x0a, 0x1d, 0x6f, 0x72, 0x67, 0x2e, 0x76, 0x64, 0x61, 0x61, 0x73, 0x2e, 0x76, + 0x61, 0x6c, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x42, 0x0b, 0x56, 0x61, 0x6c, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, + 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x64, + 0x61, 0x61, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0xa2, 0x02, 0x07, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5294,7 +5290,7 @@ func file_v1_payload_payload_proto_rawDescGZIP() []byte { } var file_v1_payload_payload_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 81) +var file_v1_payload_payload_proto_msgTypes = make([]protoimpl.MessageInfo, 83) var file_v1_payload_payload_proto_goTypes = []interface{}{ (Search_AggregationAlgorithm)(0), // 0: payload.v1.Search.AggregationAlgorithm (Remove_Timestamp_Operator)(0), // 1: payload.v1.Remove.Timestamp.Operator @@ -5367,8 +5363,8 @@ var file_v1_payload_payload_proto_goTypes = []interface{}{ (*Info_Node)(nil), // 68: payload.v1.Info.Node (*Info_Service)(nil), // 69: payload.v1.Info.Service (*Info_ServicePort)(nil), // 70: payload.v1.Info.ServicePort - (*Info_Label)(nil), // 71: payload.v1.Info.Label - (*Info_Annotation)(nil), // 72: payload.v1.Info.Annotation + (*Info_Labels)(nil), // 71: payload.v1.Info.Labels + (*Info_Annotations)(nil), // 72: payload.v1.Info.Annotations (*Info_CPU)(nil), // 73: payload.v1.Info.CPU (*Info_Memory)(nil), // 74: payload.v1.Info.Memory (*Info_Pods)(nil), // 75: payload.v1.Info.Pods @@ -5379,7 +5375,9 @@ var file_v1_payload_payload_proto_goTypes = []interface{}{ (*Info_Index_UUID)(nil), // 80: payload.v1.Info.Index.UUID (*Info_Index_UUID_Committed)(nil), // 81: payload.v1.Info.Index.UUID.Committed (*Info_Index_UUID_Uncommitted)(nil), // 82: payload.v1.Info.Index.UUID.Uncommitted - (*status.Status)(nil), // 83: google.rpc.Status + nil, // 83: payload.v1.Info.Labels.LabelsEntry + nil, // 84: payload.v1.Info.Annotations.AnnotationsEntry + (*status.Status)(nil), // 85: google.rpc.Status } var file_v1_payload_payload_proto_depIdxs = []int32{ 19, // 0: payload.v1.Search.Request.config:type_name -> payload.v1.Search.Config @@ -5395,7 +5393,7 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 46, // 10: payload.v1.Search.Response.results:type_name -> payload.v1.Object.Distance 20, // 11: payload.v1.Search.Responses.responses:type_name -> payload.v1.Search.Response 20, // 12: payload.v1.Search.StreamResponse.response:type_name -> payload.v1.Search.Response - 83, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status + 85, // 13: payload.v1.Search.StreamResponse.status:type_name -> google.rpc.Status 23, // 14: payload.v1.Filter.Config.targets:type_name -> payload.v1.Filter.Target 50, // 15: payload.v1.Insert.Request.vector:type_name -> payload.v1.Object.Vector 29, // 16: payload.v1.Insert.Request.config:type_name -> payload.v1.Insert.Config @@ -5429,18 +5427,18 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 48, // 44: payload.v1.Object.VectorRequest.id:type_name -> payload.v1.Object.ID 24, // 45: payload.v1.Object.VectorRequest.filters:type_name -> payload.v1.Filter.Config 46, // 46: payload.v1.Object.StreamDistance.distance:type_name -> payload.v1.Object.Distance - 83, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status + 85, // 47: payload.v1.Object.StreamDistance.status:type_name -> google.rpc.Status 48, // 48: payload.v1.Object.GetTimestampRequest.id:type_name -> payload.v1.Object.ID 50, // 49: payload.v1.Object.Vectors.vectors:type_name -> payload.v1.Object.Vector 50, // 50: payload.v1.Object.StreamVector.vector:type_name -> payload.v1.Object.Vector - 83, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status + 85, // 51: payload.v1.Object.StreamVector.status:type_name -> google.rpc.Status 56, // 52: payload.v1.Object.StreamBlob.blob:type_name -> payload.v1.Object.Blob - 83, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status + 85, // 53: payload.v1.Object.StreamBlob.status:type_name -> google.rpc.Status 58, // 54: payload.v1.Object.StreamLocation.location:type_name -> payload.v1.Object.Location - 83, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status + 85, // 55: payload.v1.Object.StreamLocation.status:type_name -> google.rpc.Status 58, // 56: payload.v1.Object.Locations.locations:type_name -> payload.v1.Object.Location 50, // 57: payload.v1.Object.List.Response.vector:type_name -> payload.v1.Object.Vector - 83, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status + 85, // 58: payload.v1.Object.List.Response.status:type_name -> google.rpc.Status 73, // 59: payload.v1.Info.Pod.cpu:type_name -> payload.v1.Info.CPU 74, // 60: payload.v1.Info.Pod.memory:type_name -> payload.v1.Info.Memory 68, // 61: payload.v1.Info.Pod.node:type_name -> payload.v1.Info.Node @@ -5448,16 +5446,18 @@ var file_v1_payload_payload_proto_depIdxs = []int32{ 74, // 63: payload.v1.Info.Node.memory:type_name -> payload.v1.Info.Memory 75, // 64: payload.v1.Info.Node.Pods:type_name -> payload.v1.Info.Pods 70, // 65: payload.v1.Info.Service.ports:type_name -> payload.v1.Info.ServicePort - 71, // 66: payload.v1.Info.Service.labels:type_name -> payload.v1.Info.Label - 72, // 67: payload.v1.Info.Service.annotations:type_name -> payload.v1.Info.Annotation - 67, // 68: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod - 68, // 69: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node - 69, // 70: payload.v1.Info.Services.services:type_name -> payload.v1.Info.Service - 71, // [71:71] is the sub-list for method output_type - 71, // [71:71] is the sub-list for method input_type - 71, // [71:71] is the sub-list for extension type_name - 71, // [71:71] is the sub-list for extension extendee - 0, // [0:71] is the sub-list for field type_name + 71, // 66: payload.v1.Info.Service.labels:type_name -> payload.v1.Info.Labels + 72, // 67: payload.v1.Info.Service.annotations:type_name -> payload.v1.Info.Annotations + 83, // 68: payload.v1.Info.Labels.labels:type_name -> payload.v1.Info.Labels.LabelsEntry + 84, // 69: payload.v1.Info.Annotations.annotations:type_name -> payload.v1.Info.Annotations.AnnotationsEntry + 67, // 70: payload.v1.Info.Pods.pods:type_name -> payload.v1.Info.Pod + 68, // 71: payload.v1.Info.Nodes.nodes:type_name -> payload.v1.Info.Node + 69, // 72: payload.v1.Info.Services.services:type_name -> payload.v1.Info.Service + 73, // [73:73] is the sub-list for method output_type + 73, // [73:73] is the sub-list for method input_type + 73, // [73:73] is the sub-list for extension type_name + 73, // [73:73] is the sub-list for extension extendee + 0, // [0:73] is the sub-list for field type_name } func init() { file_v1_payload_payload_proto_init() } @@ -6295,7 +6295,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Label); i { + switch v := v.(*Info_Labels); i { case 0: return &v.state case 1: @@ -6307,7 +6307,7 @@ func file_v1_payload_payload_proto_init() { } } file_v1_payload_payload_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info_Annotation); i { + switch v := v.(*Info_Annotations); i { case 0: return &v.state case 1: @@ -6469,7 +6469,7 @@ func file_v1_payload_payload_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v1_payload_payload_proto_rawDesc, NumEnums: 2, - NumMessages: 81, + NumMessages: 83, NumExtensions: 0, NumServices: 0, }, diff --git a/apis/grpc/v1/payload/payload_vtproto.pb.go b/apis/grpc/v1/payload/payload_vtproto.pb.go index f8a35771e3..cee9a48cbc 100644 --- a/apis/grpc/v1/payload/payload_vtproto.pb.go +++ b/apis/grpc/v1/payload/payload_vtproto.pb.go @@ -1594,8 +1594,10 @@ func (m *Info_Service) CloneVT() *Info_Service { return (*Info_Service)(nil) } r := &Info_Service{ - Name: m.Name, - ClusterIp: m.ClusterIp, + Name: m.Name, + ClusterIp: m.ClusterIp, + Labels: m.Labels.CloneVT(), + Annotations: m.Annotations.CloneVT(), } if rhs := m.ClusterIps; rhs != nil { tmpContainer := make([]string, len(rhs)) @@ -1609,20 +1611,6 @@ func (m *Info_Service) CloneVT() *Info_Service { } r.Ports = tmpContainer } - if rhs := m.Labels; rhs != nil { - tmpContainer := make([]*Info_Label, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Labels = tmpContainer - } - if rhs := m.Annotations; rhs != nil { - tmpContainer := make([]*Info_Annotation, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Annotations = tmpContainer - } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -1653,13 +1641,17 @@ func (m *Info_ServicePort) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Info_Label) CloneVT() *Info_Label { +func (m *Info_Labels) CloneVT() *Info_Labels { if m == nil { - return (*Info_Label)(nil) + return (*Info_Labels)(nil) } - r := &Info_Label{ - Key: m.Key, - Value: m.Value, + r := &Info_Labels{} + if rhs := m.Labels; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.Labels = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -1668,17 +1660,21 @@ func (m *Info_Label) CloneVT() *Info_Label { return r } -func (m *Info_Label) CloneMessageVT() proto.Message { +func (m *Info_Labels) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Info_Annotation) CloneVT() *Info_Annotation { +func (m *Info_Annotations) CloneVT() *Info_Annotations { if m == nil { - return (*Info_Annotation)(nil) + return (*Info_Annotations)(nil) } - r := &Info_Annotation{ - Key: m.Key, - Value: m.Value, + r := &Info_Annotations{} + if rhs := m.Annotations; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.Annotations = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -1687,7 +1683,7 @@ func (m *Info_Annotation) CloneVT() *Info_Annotation { return r } -func (m *Info_Annotation) CloneMessageVT() proto.Message { +func (m *Info_Annotations) CloneMessageVT() proto.Message { return m.CloneVT() } @@ -3972,40 +3968,12 @@ func (this *Info_Service) EqualVT(that *Info_Service) bool { } } } - if len(this.Labels) != len(that.Labels) { + if !this.Labels.EqualVT(that.Labels) { return false } - for i, vx := range this.Labels { - vy := that.Labels[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Info_Label{} - } - if q == nil { - q = &Info_Label{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Annotations) != len(that.Annotations) { + if !this.Annotations.EqualVT(that.Annotations) { return false } - for i, vx := range this.Annotations { - vy := that.Annotations[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Info_Annotation{} - } - if q == nil { - q = &Info_Annotation{} - } - if !p.EqualVT(q) { - return false - } - } - } return string(this.unknownFields) == string(that.unknownFields) } @@ -4038,45 +4006,57 @@ func (this *Info_ServicePort) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (this *Info_Label) EqualVT(that *Info_Label) bool { +func (this *Info_Labels) EqualVT(that *Info_Labels) bool { if this == that { return true } else if this == nil || that == nil { return false } - if this.Key != that.Key { + if len(this.Labels) != len(that.Labels) { return false } - if this.Value != that.Value { - return false + for i, vx := range this.Labels { + vy, ok := that.Labels[i] + if !ok { + return false + } + if vx != vy { + return false + } } return string(this.unknownFields) == string(that.unknownFields) } -func (this *Info_Label) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Info_Label) +func (this *Info_Labels) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Labels) if !ok { return false } return this.EqualVT(that) } -func (this *Info_Annotation) EqualVT(that *Info_Annotation) bool { +func (this *Info_Annotations) EqualVT(that *Info_Annotations) bool { if this == that { return true } else if this == nil || that == nil { return false } - if this.Key != that.Key { + if len(this.Annotations) != len(that.Annotations) { return false } - if this.Value != that.Value { - return false + for i, vx := range this.Annotations { + vy, ok := that.Annotations[i] + if !ok { + return false + } + if vx != vy { + return false + } } return string(this.unknownFields) == string(that.unknownFields) } -func (this *Info_Annotation) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Info_Annotation) +func (this *Info_Annotations) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Info_Annotations) if !ok { return false } @@ -7910,29 +7890,25 @@ func (m *Info_Service) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Annotations) > 0 { - for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Annotations[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 + if m.Annotations != nil { + size, err := m.Annotations.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 } - if len(m.Labels) > 0 { - for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Labels[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a + if m.Labels != nil { + size, err := m.Labels.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a } if len(m.Ports) > 0 { for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { @@ -8017,7 +7993,7 @@ func (m *Info_ServicePort) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Info_Label) MarshalVT() (dAtA []byte, err error) { +func (m *Info_Labels) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -8030,12 +8006,12 @@ func (m *Info_Label) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Info_Label) MarshalToVT(dAtA []byte) (int, error) { +func (m *Info_Labels) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Info_Label) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Info_Labels) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -8047,24 +8023,29 @@ func (m *Info_Label) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarint(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarint(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa + if len(m.Labels) > 0 { + for k := range m.Labels { + v := m.Labels[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *Info_Annotation) MarshalVT() (dAtA []byte, err error) { +func (m *Info_Annotations) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -8077,12 +8058,12 @@ func (m *Info_Annotation) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Info_Annotation) MarshalToVT(dAtA []byte) (int, error) { +func (m *Info_Annotations) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Info_Annotation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Info_Annotations) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -8094,19 +8075,24 @@ func (m *Info_Annotation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarint(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarint(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa + if len(m.Annotations) > 0 { + for k := range m.Annotations { + v := m.Annotations[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -9827,17 +9813,13 @@ func (m *Info_Service) SizeVT() (n int) { n += 1 + l + sov(uint64(l)) } } - if len(m.Labels) > 0 { - for _, e := range m.Labels { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } + if m.Labels != nil { + l = m.Labels.SizeVT() + n += 1 + l + sov(uint64(l)) } - if len(m.Annotations) > 0 { - for _, e := range m.Annotations { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } + if m.Annotations != nil { + l = m.Annotations.SizeVT() + n += 1 + l + sov(uint64(l)) } n += len(m.unknownFields) return n @@ -9860,37 +9842,37 @@ func (m *Info_ServicePort) SizeVT() (n int) { return n } -func (m *Info_Label) SizeVT() (n int) { +func (m *Info_Labels) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sov(uint64(l)) + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } } n += len(m.unknownFields) return n } -func (m *Info_Annotation) SizeVT() (n int) { +func (m *Info_Annotations) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sov(uint64(l)) + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } } n += len(m.unknownFields) return n @@ -17706,8 +17688,10 @@ func (m *Info_Service) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &Info_Label{}) - if err := m.Labels[len(m.Labels)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if m.Labels == nil { + m.Labels = &Info_Labels{} + } + if err := m.Labels.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -17740,8 +17724,10 @@ func (m *Info_Service) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Annotations = append(m.Annotations, &Info_Annotation{}) - if err := m.Annotations[len(m.Annotations)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if m.Annotations == nil { + m.Annotations = &Info_Annotations{} + } + if err := m.Annotations.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -17869,7 +17855,7 @@ func (m *Info_ServicePort) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Info_Label) UnmarshalVT(dAtA []byte) error { +func (m *Info_Labels) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -17892,17 +17878,17 @@ func (m *Info_Label) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Info_Label: wiretype end group for non-group") + return fmt.Errorf("proto: Info_Labels: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Info_Label: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Info_Labels: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -17912,55 +17898,118 @@ func (m *Info_Label) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if m.Labels == nil { + m.Labels = make(map[string]string) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) + m.Labels[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -17984,7 +18033,7 @@ func (m *Info_Label) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Info_Annotation) UnmarshalVT(dAtA []byte) error { +func (m *Info_Annotations) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -18007,17 +18056,17 @@ func (m *Info_Annotation) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Info_Annotation: wiretype end group for non-group") + return fmt.Errorf("proto: Info_Annotations: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Info_Annotation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Info_Annotations: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -18027,55 +18076,118 @@ func (m *Info_Annotation) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if m.Annotations == nil { + m.Annotations = make(map[string]string) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) + m.Annotations[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/apis/proto/v1/payload/payload.proto b/apis/proto/v1/payload/payload.proto index 0d028c7754..36880d29f7 100644 --- a/apis/proto/v1/payload/payload.proto +++ b/apis/proto/v1/payload/payload.proto @@ -574,9 +574,9 @@ message Info { // The port of the svc. repeated ServicePort ports = 4; // The labels of the service. - repeated Label labels = 5; + Labels labels = 5; // The annotations of the service. - repeated Annotation annotations = 6; + Annotations annotations = 6; } // Represets the service port information message. @@ -587,16 +587,14 @@ message Info { int32 port = 2; } - // Represent the kubernetes label. - message Label { - string key = 1; - string value = 2; + // Represent the kubernetes labels. + message Labels { + map labels = 1; } - // Represent the kubernetes annotation. - message Annotation { - string key = 1; - string value = 2; + // Represent the kubernetes annotations. + message Annotations { + map annotations = 1; } // Represent the CPU information message. diff --git a/apis/swagger/v1/discoverer/discoverer.swagger.json b/apis/swagger/v1/discoverer/discoverer.swagger.json index e9a8881c40..b6df1227c3 100644 --- a/apis/swagger/v1/discoverer/discoverer.swagger.json +++ b/apis/swagger/v1/discoverer/discoverer.swagger.json @@ -110,6 +110,18 @@ } }, "definitions": { + "InfoAnnotations": { + "type": "object", + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Represent the kubernetes annotations." + }, "InfoCPU": { "type": "object", "properties": { @@ -131,6 +143,18 @@ }, "description": "Represent the CPU information message." }, + "InfoLabels": { + "type": "object", + "properties": { + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Represent the kubernetes labels." + }, "InfoMemory": { "type": "object", "properties": { @@ -271,19 +295,11 @@ "description": "The port of the svc." }, "labels": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1InfoLabel" - }, + "$ref": "#/definitions/InfoLabels", "description": "The labels of the service." }, "annotations": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/v1InfoAnnotation" - }, + "$ref": "#/definitions/InfoAnnotations", "description": "The annotations of the service." } }, @@ -369,30 +385,6 @@ } }, "description": "Represent the dicoverer request." - }, - "v1InfoAnnotation": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "description": "Represent the kubernetes annotation." - }, - "v1InfoLabel": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "description": "Represent the kubernetes label." } } } diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index c256e2e957..9cc1f1045a 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -349,27 +349,17 @@ func (d *discoverer) Start(ctx context.Context) (<-chan error, error) { Port: p.Port, }) } - var labels []*payload.Info_Label - for k, v := range svc.Labels { - labels = append(labels, &payload.Info_Label{ - Key: k, - Value: v, - }) - } - var annotations []*payload.Info_Annotation - for k, v := range svc.Annotations { - annotations = append(annotations, &payload.Info_Annotation{ - Key: k, - Value: v, - }) - } ni := &payload.Info_Service{ - Name: svc.Name, - ClusterIp: svc.ClusterIP, - ClusterIps: svc.ClusterIPs, - Ports: ports, - Labels: labels, - Annotations: annotations, + Name: svc.Name, + ClusterIp: svc.ClusterIP, + ClusterIps: svc.ClusterIPs, + Ports: ports, + Labels: &payload.Info_Labels{ + Labels: svc.Labels, + }, + Annotations: &payload.Info_Annotations{ + Annotations: svc.Annotations, + }, } svcsByName[svc.Name] = ni return true From 4bd9c35510a0675633d56d45fbf3e98281a75a28 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Thu, 14 Dec 2023 08:13:41 +0000 Subject: [PATCH 26/27] Add godoc comments --- internal/k8s/service/service.go | 6 ++++++ pkg/discoverer/k8s/handler/grpc/handler.go | 1 + pkg/discoverer/k8s/service/discover.go | 1 + 3 files changed, 8 insertions(+) diff --git a/internal/k8s/service/service.go b/internal/k8s/service/service.go index 9dbd62b34b..523d252d5e 100644 --- a/internal/k8s/service/service.go +++ b/internal/k8s/service/service.go @@ -33,8 +33,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) +// SvcWatcher is a type alias of k8s.ResourceController for service resources type SvcWatcher k8s.ResourceController +// Service represents a kubernetes service information type Service struct { Name string ClusterIP string @@ -58,6 +60,7 @@ type reconciler struct { lopts []client.ListOption } +// New returns a new SvcWatcher instance. func New(opts ...Option) SvcWatcher { r := new(reconciler) for _, opt := range append(defaultOptions, opts...) { @@ -90,6 +93,7 @@ func extractAPIPorts(ports []corev1.ServicePort) []servicePort { return apiPorts } +// Reconcile reconciles the service resources and put the information into the Service struct. func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res reconcile.Result, err error) { svcList := &corev1.ServiceList{} @@ -144,10 +148,12 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re return res, nil } +// GetName returns the reconciler name. func (r *reconciler) GetName() string { return r.name } +// NewReconciler returns a new reconciler instance with corev1 scheme added. func (r *reconciler) NewReconciler(_ context.Context, mgr manager.Manager) reconcile.Reconciler { if r.mgr == nil && mgr != nil { r.mgr = mgr diff --git a/pkg/discoverer/k8s/handler/grpc/handler.go b/pkg/discoverer/k8s/handler/grpc/handler.go index f08777f65f..650acc8eb0 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler.go +++ b/pkg/discoverer/k8s/handler/grpc/handler.go @@ -224,6 +224,7 @@ func (s *server) Nodes(ctx context.Context, req *payload.Discoverer_Request) (*p return cn, nil } +// Services returns the services infomation that match the request. func (s *server) Services(ctx context.Context, req *payload.Discoverer_Request) (*payload.Info_Services, error) { ctx, span := trace.StartSpan(ctx, apiName+".Services") defer func() { diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index 9cc1f1045a..aac64ad8d2 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -554,6 +554,7 @@ func (d *discoverer) GetNodes(req *payload.Discoverer_Request) (nodes *payload.I return nodes, nil } +// Get Services returns the services that matches the request. func (d *discoverer) GetServices(req *payload.Discoverer_Request) (svcs *payload.Info_Services, err error) { svcs = new(payload.Info_Services) sbn, ok := d.svcsByName.Load().(map[string]*payload.Info_Service) From b5de93d3c55710429513c9cab59d47dd20c5cf78 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Mon, 18 Dec 2023 02:12:47 +0000 Subject: [PATCH 27/27] Disable service controller for now --- pkg/discoverer/k8s/handler/grpc/handler.go | 2 +- pkg/discoverer/k8s/service/discover.go | 50 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/discoverer/k8s/handler/grpc/handler.go b/pkg/discoverer/k8s/handler/grpc/handler.go index 650acc8eb0..8635e20124 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler.go +++ b/pkg/discoverer/k8s/handler/grpc/handler.go @@ -224,7 +224,7 @@ func (s *server) Nodes(ctx context.Context, req *payload.Discoverer_Request) (*p return cn, nil } -// Services returns the services infomation that match the request. +// Services returns the services information that match the request. func (s *server) Services(ctx context.Context, req *payload.Discoverer_Request) (*payload.Info_Services, error) { ctx, span := trace.StartSpan(ctx, apiName+".Services") defer func() { diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index aac64ad8d2..b0d72595ad 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -182,31 +182,31 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithLabels(selector.GetNodeLabels()), )), // Only required when service reconciation is required like read replica. - k8s.WithResourceController(service.New( - service.WithControllerName("service discoverer"), - service.WithOnErrorFunc(func(err error) { - log.Error("failed to reconcile:", err) - }), - service.WithOnReconcileFunc(func(svcs []service.Service) { - log.Debugf("svc resource reconciled\t%#v", svcs) - svcsmap := make(map[string]struct{}, len(svcs)) - for i := range svcs { - svc := &svcs[i] - svcsmap[svc.Name] = struct{}{} - d.services.Store(svc.Name, svc) - } - d.services.Range(func(name string, _ *service.Service) bool { - _, ok := svcsmap[name] - if !ok { - d.services.Delete(name) - } - return true - }) - }), - service.WithNamespace(d.namespace), - service.WithFields(selector.GetServiceFields()), - service.WithLabels(selector.GetServiceLabels()), - )), + // k8s.WithResourceController(service.New( + // service.WithControllerName("service discoverer"), + // service.WithOnErrorFunc(func(err error) { + // log.Error("failed to reconcile:", err) + // }), + // service.WithOnReconcileFunc(func(svcs []service.Service) { + // log.Debugf("svc resource reconciled\t%#v", svcs) + // svcsmap := make(map[string]struct{}, len(svcs)) + // for i := range svcs { + // svc := &svcs[i] + // svcsmap[svc.Name] = struct{}{} + // d.services.Store(svc.Name, svc) + // } + // d.services.Range(func(name string, _ *service.Service) bool { + // _, ok := svcsmap[name] + // if !ok { + // d.services.Delete(name) + // } + // return true + // }) + // }), + // service.WithNamespace(d.namespace), + // service.WithFields(selector.GetServiceFields()), + // service.WithLabels(selector.GetServiceLabels()), + // )), ) d.ctrl, err = k8s.New(k8sOpts...)