-
Notifications
You must be signed in to change notification settings - Fork 260
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
Regression: Specifying subnet filter without network fails when it previously did not #993
Comments
Here's the old cluster-api-provider-openstack/pkg/cloud/services/networking/network.go Lines 342 to 364 in 649fcf5
On line 354, if In any case, I don't think it matters how, when or why this stopped working. Sounds like we should support this use case to find a subnet without specifying its network, and even better when there's both API usage efficiency gains and the unit tests to guard against this getting missed in future. |
Ouch! That code's a headscratcher. You may well be right. It definitely did regress, but I may have |
/kind bug
What steps did you take and what happened:
In OpenShift we add default networks to machines by subnet tag, e.g.:
This now returns an error. It previously succeeded.
What did you expect to happen:
We should find the requested subnet in any network, which was the previous behaviour.
Anything else you would like to add:
This was regressed by #935 in an interesting way. It turns out that the previous behaviour in this case was to list networks with an empty filter, which returns all networks, then execute a separate subnet query per-network and add all matches subnets. This worked, but was obviously also incredibly inefficient.
#935 was principally about adding a mock interface, but incidentally also modified GetSubnetsByFilter and GetNetworksByFilter to return an error if there were no results. This breaks us, because we're querying every network individually, but only one of them contains the subnet we're looking for. The first network we query which doesn't contain the target subnet will return an error.
I'm not 100% convinced this is a desirable change, but it did highlight a very inefficient use of the OpenStack REST API. We can address this just by making a more efficient API call.
Environment:
git rev-parse HEAD
if manually built): ac9c503The text was updated successfully, but these errors were encountered: