-
-
Notifications
You must be signed in to change notification settings - Fork 310
Port network_load_balancers to database generator #2068
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
Port network_load_balancers to database generator #2068
Conversation
d46395d
to
49eaa2e
Compare
Hi @davidbockelman . Your pull request has been super helpful to me, guiding me on how to tackle the database generator issue I was assigned. I'm working on One thing I think you missed is calling As I'm working through mine and comparing against yours, I'll let you know if I find anything else. |
for _, lb := range loadBalancers { | ||
// memberSpecific requirements | ||
if !memberSpecific || !lb.NodeID.Valid || (lb.NodeID.Valid && lb.NodeID.Int64 == tx.GetNodeID()) { | ||
if projectNetworksLoadBalancersOnUplink[projectName] == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize projectNetworksLoadBalancersOnUplink = make(map[string]map[string][]string)
if err != nil { | ||
return nil, fmt.Errorf("Failed loading network forward listen addresses: %w", err) | ||
return nil, fmt.Errorf("Failed loading network load balancer listen addresses: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be using this logic for retrieving the network forward listen addresses too, so maybe we can have it more generic like return nil, err
?
ListenAddress: loadBalancer.ListenAddress, | ||
Description: loadBalancer.Description, | ||
Backends: loadBalancer.Backends, | ||
Ports: loadBalancer.Ports, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should check these two fields if they're null or not, and assign Backends/Ports to []. Otherwise, I believe this messes up the JSON marshalling and unmarshalling.
9a10703
to
2bb65e9
Compare
Did a first pass of cleanup on this one. Other than some formatting issues and other static analysis stuff, this is looking pretty good. |
Signed-off-by: Stéphane Graber <[email protected]>
Signed-off-by: David Bockelman <[email protected]>
Signed-off-by: David Bockelman <[email protected]>
2bb65e9
to
3a811e0
Compare
Created
internal/server/db/cluster/networks_load_balancers.go
which allows for the network_load_balancers SQL code to be auto-generated withmake update-schema
. Changed the call sites to functions ininternal/server/db/network_load_balancers.go
to use the new auto-generated functions. Functions ininternal/server/db/network_network_load_balancers.go
are no longer used.Fixes #1800