-
Notifications
You must be signed in to change notification settings - Fork 583
Loadbalancer create fully populated LB broken for empty subnet id in members #2559
Description
When creating a fully populated loadbalancer, the listener, health-manager as well as the pool with its members can be declared in one API call.
However in some cases the API call can include subnet_id: "" for the members, which results in an failed API call, since it is not a valid UUID as expected by octavia.
I would like to propose changing the datatype of the Members variable in the pool CreateOpts in openstack/loadbalancer/v2/pools/requests.go to be of type CreateMemberOpts instead of BatchUpdateMemberOpts.
For more explanation:
In the kubernetes openstack-cloud-provider (https://github.com/kubernetes/cloud-provider-openstack/blob/88ddaa260bf2b2f9a7cf60ab2fb41086f87b3e6e/pkg/openstack/loadbalancer.go#L1229) a subnet-id with empty string is passed in case the value is not defined.
gophercloud uses the BatchUpdateMemberOpts in the pool CreateOpts struct instead of CreateMemberOpts.
The difference between CreateMemberOpts and BatchUpdateMemberOpts are three strings, that are declared as pointers in order to be able to delete those values during an update call.
In order to still support an empty string, the BatchUpdateMemberOpts have a secondary method called ToBatchMemberUpdateMap, which should translate an empty subnet_id to nil.
Since the ToBatchMemberUpdateMap is not called in all cases, it can happen, that the subnet_id is transmitted to the octavia API with value "" (empty string). This is not recognised as a valid UUID and thus the API call to octavia fails.