-
Notifications
You must be signed in to change notification settings - Fork 261
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
feat: add configurable loadbalancer network #1922
feat: add configurable loadbalancer network #1922
Conversation
|
Welcome @oblazek! |
Hi @oblazek. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/ok-to-test |
api/v1alpha6/conversion_test.go
Outdated
// None of these fields exist in v1alpha6 | ||
spec.APIServerLoadBalancer.Network = nil | ||
spec.APIServerLoadBalancer.Subnets = 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.
Same here.
api/v1beta1/types.go
Outdated
// Network defines which network should the load balancer be allocated on. | ||
//+optional | ||
Network *NetworkFilter `json:"network,omitempty"` | ||
// Subnet defines which network(s) should the load balancer be allocated on. |
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'm guessing that all these subnets must be in the same network, which is described by Network
?
Is it permitted to specify Subnets without network?
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.
yeah that's a good point, tbh we will most likely end up in specifying just the Network
(by its name) and it won't matter to us which subnet will be chosen as far as I get 1 IPv4 and 1 IPv6 VIP
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 this is good in principal, but there are a few things to straighten out.
cd7ab5b
to
1b68d37
Compare
1b68d37
to
96c0bb0
Compare
this should be ready for another round |
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.
/lgtm
This looks pretty good to me, some small remarks inline.
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.
A few comments, but this is close. Thanks!
return fmt.Errorf("no subnet match was found in the specified network (specified subnet: %v, available subnets: %v)", s, lbNetList[0].Subnets) | ||
} | ||
} | ||
} |
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.
How about making the default explicit and copying in the cluster network in the else branch? Then we could just make the creation code assume it's set. We could also shortcut the lookup at the top of this function if it's already set.
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 it looks better now.
var vipNetworkID, vipSubnetID string | ||
if openStackCluster.Status.APIServerLoadBalancer != nil { | ||
if openStackCluster.Status.APIServerLoadBalancer.LoadBalancerNetwork != 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.
If we made the suggested change above where we copy in the cluster network when resolving the vip network, this block becomes unconditional. Also, when we add dual stack support here we get it in the non-custom case too, for free. You'll just want to return an error if APIServerLB or APIServerLB.Network are nil in the status, which will also mean we don't need all the nesting.
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.
good call, should be fixed now if I am not mistaken
96c0bb0
to
af1eccb
Compare
af1eccb
to
884c175
Compare
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.
Just a question inline.
go.mod
Outdated
@@ -16,7 +16,7 @@ require ( | |||
github.com/onsi/gomega v1.30.0 | |||
github.com/prometheus/client_golang v1.17.0 | |||
github.com/spf13/pflag v1.0.5 | |||
golang.org/x/crypto v0.16.0 |
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.
Why the deps bump?
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.
probably by running some go mod tidy
.. will remove
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.
fixed
Previously when loadbalacer was created it used the same network/subnet as the control plane nodes for the VIP. This was not always the right assumption as some users might want to be able to customize this according to their env. This commit fixes the above by adding two fields into OpenStackClusterSpec/Status two fields `network` and `subnets` under `APIServerLoadBalancer` so that user can define which network/subnet to use for allocation of the loadbalancer. Signed-off-by: Ondrej Blazek <[email protected]>
884c175
to
e2897fb
Compare
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.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dulek, mdbooth The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Previously when loadbalacer was created it used the same network/subnet as the control plane nodes for the VIP. This was not always the right assumption as some users might want to be able to customize this according to their env.
This commit fixes the above by adding two fields into OpenStackClusterSpec/Status two fields
network
andsubnets
underAPIServerLoadBalancer
so that user can define which network/subnet to use for allocation of the loadbalancer.Fixes: #1809
Signed-off-by: Ondrej Blazek [email protected]