kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
275 stars 253 forks source link

`GetInstanceStatusByName` doesn't return an error when > 1 instance if found #2088

Closed EmilienM closed 4 weeks ago

EmilienM commented 1 month ago

/kind bug

What steps did you take and what happened:

GetInstanceStatusByName doesn't return an error when > 1 instance if found and this can lead to cluster problems if we have two instances with the same name. Could be a leftover or a staled resource, that needs to be removed before creating a new one.

What did you expect to happen:

An error should be returned.

Environment:

EmilienM commented 1 month ago

/assign EmilienM

EmilienM commented 1 month ago

@mdbooth so in the current state of things, if two instances have the same name, cleanup will never happen. This will likely change once we have the OpenStackServer controller that I'm working on at the moment; so I wonder if we want to provide a "fix" for this into 0.10 or if we're fine with that behaviour now and we'll improve with the new controller.

mdbooth commented 1 month ago

I think if we have 2 instances with the same name and can't distinguish between them we're just going to have to report an error to the user. I'm not sure we can safely do anything about it, now or with OpenStackServer.

EmilienM commented 1 month ago

ok so i'll submit a PR that just reports an error for now, gotcha.