Skip to content

Commit 35cd30d

Browse files
committed
Improve handling of missing load balancer permissions
Currently, when a user tries to create a cluster using OpenStack credentials which are missing the load balancer permissions, CAPO adds the finalized to the OpenStackCluster resource then fails to create the load balancer. When the user then tries to delete the cluster, CAPO makes a GET request to the Octavia API to get the load balancer details and receives a 403 (permission denied) response, so the only way to allow the cluster deletion to proceed is to manually remove the finalizer from the OpenStackCluster resource. This change prevents the above edge case by only attempting to delete the API server load balancer if the load balancer ID is populated in the OpenStackCluster's status field.
1 parent 57ae27e commit 35cd30d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

controllers/openstackcluster_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (r *OpenStackClusterReconciler) reconcileDelete(ctx context.Context, scope
177177
return reconcile.Result{}, err
178178
}
179179

180-
if openStackCluster.Spec.APIServerLoadBalancer.IsEnabled() {
180+
if (openStackCluster.Spec.APIServerLoadBalancer.IsEnabled() && openStackCluster.Status.APIServerLoadBalancer.ID != "") {
181181
loadBalancerService, err := loadbalancer.NewService(scope)
182182
if err != nil {
183183
return reconcile.Result{}, err

0 commit comments

Comments
 (0)