Skip to content

Commit

Permalink
Add mirror gateway component (#1949)
Browse files Browse the repository at this point in the history
* add mirror component

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix mirror dockerfile path

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix deepsource warning

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix insert rpc handler

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* deleted unused file

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix api resource name

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add mirror service and fix handler logic

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix values and helm template for new configuration

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Format code with gofumpt and prettier

* fix template rendering bug of mirror configmap

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix nil pointer error

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* bugfix to advertize different address

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* returns error when there is no other mirror gateways

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add info log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* extract only mirror addresses

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix log variable

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add logging

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* bugfix mirror connection logic

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add remove api proxy implementation

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add error handling for register API

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix debug message

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor discover logic

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add remove api

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Format code with prettier and gofumpt

* add remove api and remove api rollback logic

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add update rpc handler

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor context variable for grpc method

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix trace span name

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add getObjects method

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor update and remove handler

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Apply suggestions from code review

Co-authored-by: Kiichiro YUKAWA <kyukawa315@gmail.com>

* add multi handler implementation

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix mirror client trace span

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* rename discover service to mirror service

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix build error of bidirectional stream

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add more error handling to search handler

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add debug comment

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add status code log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add status code log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add status code log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix named return bug

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add debug log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add debug command

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add debug command

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add debug command

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add force status wrap

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* execute upsert method to local cluster's lb

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add target debug log

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix delete unwrap of circuitbreaker

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor error handling for new status parse function

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Format code with prettier and gofumpt

* refactor error handling

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* style: Format code with prettier and gofumpt

* fix error handling for broadcast operation of getobject

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix error join bug of getobject

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* deleted unused code

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix status handling and add address to resource name

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* use vald client for update operation

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add rollback test for mirror crud

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* style: Format code with prettier and gofumpt

* fix variable name

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* refactor mirror servie

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* deleted unused code

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix trace attribute and refactor variable name

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* add error handling when crud rpc fails

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* deleted unused value

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* make format

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Revert "make format"

This reverts commit f605563.

* Apply suggestions from code review

Co-authored-by: Kiichiro YUKAWA <kyukawa315@gmail.com>

* apply suggestion

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* bugfix and refactor mirror client

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

---------

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Kiichiro YUKAWA <kyukawa315@gmail.com>
  • Loading branch information
3 people committed Jun 27, 2023
1 parent 8006334 commit ac70c4a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/dockers-gateway-mirror-image.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#
<<<<<<< HEAD
# Copyright (C) 2019-2023 vdaas.org vald team <vald@vdaas.org>
=======
# Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
>>>>>>> c989103b2 (Add mirror gateway component (#1949))
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions cmd/gateway/mirror/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ gateway:
write_buffer_size: 0
tls:
enabled: false
<<<<<<< HEAD
ca: /path/to/ca
=======
ca: /path/to/ca
>>>>>>> c989103b2 (Add mirror gateway component (#1949))
cert: /path/to/cert
key: /path/to/key
8 changes: 4 additions & 4 deletions internal/config/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ package config
// Mirror represents the Mirror Gateway configuration.
type Mirror struct {
// Client represents the gRPC client configuration for connecting the LB Gateway.
Client *GRPCClient `json:"client" yaml:"client"`
Client *GRPCClient `json:"client" yaml:"client"`
// SelfMirrorAddr represents the address for the self Mirror Gateway.
SelfMirrorAddr string `json:"self_mirror_addr" yaml:"self_mirror_addr"`
SelfMirrorAddr string `json:"self_mirror_addr" yaml:"self_mirror_addr"`
// GatewayAddr represents the address for the Vald Gateway (e.g lb-gateway).
GatewayAddr string `json:"gateway_addr" yaml:"gateway_addr"`
GatewayAddr string `json:"gateway_addr" yaml:"gateway_addr"`
// PodName represents self Mirror Gateway Pod name.
PodName string `json:"pod_name" yaml:"pod_name"`
PodName string `json:"pod_name" yaml:"pod_name"`
// AdvertiseInterval represents interval to advertise Mirror Gateway information to other mirror gateway.
AdvertiseInterval string `json:"advertise_interval" yaml:"advertise_interval"`
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/gateway/mirror/handler/grpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,7 @@ func (s *server) StreamLinearSearch(stream vald.Search_StreamLinearSearchServer)
}

func (s *server) StreamLinearSearchByID(stream vald.Search_StreamLinearSearchByIDServer) (err error) {
ctx, span := trace.StartSpan(
grpc.WithGRPCMethod(stream.Context(), vald.PackageName+"."+vald.SearchRPCServiceName+"/"+vald.StreamLinearSearchByIDRPCName),
apiName+"/"+vald.StreamLinearSearchByIDRPCName,
)
ctx, span := trace.StartSpan(grpc.WithGRPCMethod(stream.Context(), vald.PackageName+"."+vald.SearchRPCServiceName+"/"+vald.StreamLinearSearchByIDRPCName), apiName+"/"+vald.StreamLinearSearchByIDRPCName)
defer func() {
if span != nil {
span.End()
Expand Down

0 comments on commit ac70c4a

Please sign in to comment.