Description
/kind bug
What steps did you take and what happened:
Creating cluster on existing network (Spec.Network), with this network having 2+ subnets, controller chooses 1st subnet of this network, regardless of supplied subnet id in OpenStackCluster (Spec.Subnets). Created OpenStackServer resource only has network id specified in its' ports.
What did you expect to happen:
I expect that default network target is properly choosing subnet ID supplied in OpenStackCluster, regardless of how many subnets this network has.
Anything else you would like to add:
Looking at the code I can see that defaultNetworkTarget iterates over subnets array from OpenStackCluster network status, which is correct for eg.:
...
status:
...
network:
id: cec9d181-9573-4c6e-a230-4ab3d51a025f
name: existing-network-test
subnets:
- cidr: 192.168.30.0/24
id: 8e9ce69b-d6ac-4de6-b674-09e1d34dc571
name: existing-subnet-2
I understand that I am able to explicitly provide fixed IPs field with this subnet at OpenStackMachine ports, but every other scenario I tested works with those defaults. I would not have to implement mechanism from my side that uses those exact parameters I supplied in OpenStackCluster network&subnet to explictly create that default port.
Environment:
- Cluster API Provider OpenStack version (Or
git rev-parse HEAD
if manually built): v0.11.4 - Cluster-API version: v1.9.1
- OpenStack version: 2024.1
- Minikube/KIND version: 0.20.0
- Kubernetes version (use
kubectl version
): 1.28.11 - OS (e.g. from
/etc/os-release
): Ubuntu 22.04
Metadata
Metadata
Assignees
Type
Projects
Status