Skip to content

Commit

Permalink
Fix nebula discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheinblum committed Nov 2, 2023
1 parent 7b789f5 commit 654f76d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ var (
//

type DiscoveryHost struct {
Address string
Grpc string
AZ_Id string `json:az_id`
Type string
Address string
NebulaAddress string `json:"nebula_address"`
Grpc string
AZId string `json:"az_id"`
Type string
}

type JSONGateConfigDiscovery struct {
Expand Down Expand Up @@ -132,14 +133,14 @@ func (r *resolveJSONGateConfig) loadConfig() (*[]resolver.Address, error) {
}

if r.filters.az_id != "" {
if r.filters.az_id != s.AZ_Id {
fmt.Printf("Dropped non matching az: %v\n", s.AZ_Id)
if r.filters.az_id != s.AZId {
fmt.Printf("Dropped non matching az: %v\n", s.AZId)
continue
}
}
// Add matching hosts to registration list
fmt.Printf("selected host for discovery: %v %v\n", fmt.Sprintf("%s:%s", s.Address, s.Grpc), s)
addrs = append(addrs, resolver.Address{Addr: fmt.Sprintf("%s:%s", s.Address, s.Grpc)})
fmt.Printf("selected host for discovery: %v %v\n", fmt.Sprintf("%s:%s", s.NebulaAddress, s.Grpc), s)
addrs = append(addrs, resolver.Address{Addr: fmt.Sprintf("%s:%s", s.NebulaAddress, s.Grpc)})
}

// Shuffle to ensure every host has a different order to iterate through
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgateproxy/vtgateproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
defaultDDLStrategy = flag.String("ddl_strategy", string(schema.DDLStrategyDirect), "Set default strategy for DDL statements. Override with @@ddl_strategy session variable")
sysVarSetEnabled = flag.Bool("enable_system_settings", true, "This will enable the system settings to be changed per session at the database connection level")

vtGateProxy *VTGateProxy
vtGateProxy *VTGateProxy = &VTGateProxy{}
)

type VTGateProxy struct {
Expand Down

0 comments on commit 654f76d

Please sign in to comment.