Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add svc discoverer for readreplica svc #2263

Merged
merged 30 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8179df3
Add svc discoverer for readreplica svc
ykadowak Dec 7, 2023
9ead671
Build with buf
ykadowak Dec 7, 2023
f21ed68
Rename
ykadowak Dec 8, 2023
73cd94a
Update configmap
ykadowak Dec 8, 2023
a3b3ba5
Removed unnecessary indexing
ykadowak Dec 8, 2023
5ca7edf
Lint
ykadowak Dec 8, 2023
2e826ba
Remove memo
ykadowak Dec 8, 2023
71b1b9c
Allow apimachinery errors since it is currently used in internal/k8s
ykadowak Dec 8, 2023
a82b045
Fix copy of large value inside loop
ykadowak Dec 8, 2023
432e169
Skip unavoidable warning
ykadowak Dec 8, 2023
9ed36b6
fix nits
ykadowak Dec 11, 2023
f008c0a
Merge branch 'main' into feature/discoverer/svc
ykadowak Dec 11, 2023
ee902b0
Validate option
ykadowak Dec 11, 2023
6d870f1
Gen tests
ykadowak Dec 11, 2023
2725af5
Make read replica svc reconciler more generic
ykadowak Dec 12, 2023
9541de5
Make it possible to disable readreplica discoverer
ykadowak Dec 12, 2023
7d91ada
Fix config test
ykadowak Dec 12, 2023
ff76ef8
rename svcs to rrsvcs
ykadowak Dec 12, 2023
4b05280
Merge branch 'main' into feature/discoverer/svc
ykadowak Dec 13, 2023
03b9505
Update discoverer decoupled from readreplica
ykadowak Dec 13, 2023
90e579c
Add extractAPIPorts test
ykadowak Dec 13, 2023
f0e2e00
Add t.Parallel on the top level
ykadowak Dec 13, 2023
725e288
style: format code with Gofumpt and Prettier
deepsource-autofix[bot] Dec 13, 2023
a16b1e5
rename rrsvcs to services
ykadowak Dec 13, 2023
38c9af6
style: format code with Gofumpt and Prettier
deepsource-autofix[bot] Dec 13, 2023
354ab81
Add Labels and Annotations field in payload
ykadowak Dec 14, 2023
2b7c55e
Use map type as Labels and Annotations payload
ykadowak Dec 14, 2023
4bd9c35
Add godoc comments
ykadowak Dec 14, 2023
ad1be28
Merge branch 'main' into feature/discoverer/svc
ykadowak Dec 14, 2023
b5de93d
Disable service controller for now
ykadowak Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
90 changes: 86 additions & 4 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@
- [Filter.Config](#payload-v1-Filter-Config)
- [Filter.Target](#payload-v1-Filter-Target)
- [Info](#payload-v1-Info)
- [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)
- [Info.Index.Count](#payload-v1-Info-Index-Count)
- [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.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)
- [Info.Pod](#payload-v1-Info-Pod)
- [Info.Pods](#payload-v1-Info-Pods)
- [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)
Expand Down Expand Up @@ -208,6 +215,25 @@ Represent the target filter server.

Info related messages.

<a name="payload-v1-Info-Annotations"></a>

### Info.Annotations

Represent the kubernetes annotations.

| Field | Type | Label | Description |
| ----------- | ---------------------------------------------------------------------------------- | -------- | ----------- |
| annotations | [Info.Annotations.AnnotationsEntry](#payload-v1-Info-Annotations-AnnotationsEntry) | repeated | |

<a name="payload-v1-Info-Annotations-AnnotationsEntry"></a>

### Info.Annotations.AnnotationsEntry

| Field | Type | Label | Description |
| ----- | ----------------- | ----- | ----------- |
| key | [string](#string) | | |
| value | [string](#string) | | |

<a name="payload-v1-Info-CPU"></a>

### Info.CPU
Expand Down Expand Up @@ -275,6 +301,25 @@ The uncommitted UUID.
| ----- | ----------------- | ----- | ----------- |
| uuid | [string](#string) | | |

<a name="payload-v1-Info-Labels"></a>

### Info.Labels

Represent the kubernetes labels.

| Field | Type | Label | Description |
| ------ | -------------------------------------------------------------- | -------- | ----------- |
| labels | [Info.Labels.LabelsEntry](#payload-v1-Info-Labels-LabelsEntry) | repeated | |

<a name="payload-v1-Info-Labels-LabelsEntry"></a>

### Info.Labels.LabelsEntry

| Field | Type | Label | Description |
| ----- | ----------------- | ----- | ----------- |
| key | [string](#string) | | |
| value | [string](#string) | | |

<a name="payload-v1-Info-Memory"></a>

### Info.Memory
Expand Down Expand Up @@ -338,6 +383,42 @@ Represent the multiple pod information message.
| ----- | -------------------------------- | -------- | ----------------------------- |
| pods | [Info.Pod](#payload-v1-Info-Pod) | repeated | The multiple pod information. |

<a name="payload-v1-Info-Service"></a>

### 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. |
| labels | [Info.Labels](#payload-v1-Info-Labels) | | The labels of the service. |
| annotations | [Info.Annotations](#payload-v1-Info-Annotations) | | The annotations of the service. |

<a name="payload-v1-Info-ServicePort"></a>

### Info.ServicePort

Represets the service port information message.

| Field | Type | Label | Description |
| ----- | ----------------- | ----- | --------------------- |
| name | [string](#string) | | The name of the port. |
| port | [int32](#int32) | | The port number |

<a name="payload-v1-Info-Services"></a>

### Info.Services

Represent the multiple service information message.

| Field | Type | Label | Description |
| -------- | ---------------------------------------- | -------- | --------------------------------- |
| services | [Info.Service](#payload-v1-Info-Service) | repeated | The multiple service information. |

<a name="payload-v1-Insert"></a>

### Insert
Expand Down Expand Up @@ -976,10 +1057,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. |
| 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. |

<a name="v1_filter_egress_egress_filter-proto"></a>

Expand Down
35 changes: 22 additions & 13 deletions apis/grpc/v1/discoverer/discoverer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions apis/grpc/v1/discoverer/discoverer_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Services(ctx context.Context, in *payload.Discoverer_Request, opts ...grpc.CallOption) (*payload.Info_Services, error)
}

type discovererClient struct {
Expand Down Expand Up @@ -74,6 +76,15 @@ func (c *discovererClient) Nodes(ctx context.Context, in *payload.Discoverer_Req
return out, nil
}

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
}
return out, nil
}

// DiscovererServer is the server API for Discoverer service.
// All implementations must embed UnimplementedDiscovererServer
// for forward compatibility
Expand All @@ -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.
Services(context.Context, *payload.Discoverer_Request) (*payload.Info_Services, error)
mustEmbedUnimplementedDiscovererServer()
}

Expand All @@ -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) Services(context.Context, *payload.Discoverer_Request) (*payload.Info_Services, error) {
return nil, status.Errorf(codes.Unimplemented, "method Services not implemented")
}
func (UnimplementedDiscovererServer) mustEmbedUnimplementedDiscovererServer() {}

// UnsafeDiscovererServer may be embedded to opt out of forward compatibility for this service.
Expand Down Expand Up @@ -144,6 +160,24 @@ func _Discoverer_Nodes_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}

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).Services(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/discoverer.v1.Discoverer/Services",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DiscovererServer).Services(ctx, req.(*payload.Discoverer_Request))
}
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)
Expand All @@ -159,6 +193,10 @@ var Discoverer_ServiceDesc = grpc.ServiceDesc{
MethodName: "Nodes",
Handler: _Discoverer_Nodes_Handler,
},
{
MethodName: "Services",
Handler: _Discoverer_Services_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/discoverer/discoverer.proto",
Expand Down
Loading
Loading