Skip to content

Commit

Permalink
Merge pull request #1680 from shiftstack/cluster-port-deletion
Browse files Browse the repository at this point in the history
πŸ› Only delete all ports when deleting cluster network
  • Loading branch information
k8s-ci-robot authored Sep 26, 2023
2 parents 00db21a + 7c9b173 commit 3a621fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ func (r *OpenStackClusterReconciler) reconcileDelete(ctx context.Context, scope

clusterName := fmt.Sprintf("%s-%s", cluster.Namespace, cluster.Name)

if err = networkingService.DeletePorts(openStackCluster); err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to delete ports: %w", err))
return reconcile.Result{}, fmt.Errorf("failed to delete ports: %w", err)
}

if openStackCluster.Spec.APIServerLoadBalancer.Enabled {
loadBalancerService, err := loadbalancer.NewService(scope)
if err != nil {
Expand All @@ -184,6 +179,11 @@ func (r *OpenStackClusterReconciler) reconcileDelete(ctx context.Context, scope
return ctrl.Result{}, fmt.Errorf("failed to delete router: %w", err)
}

if err = networkingService.DeletePorts(openStackCluster); err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to delete ports: %w", err))
return reconcile.Result{}, fmt.Errorf("failed to delete ports: %w", err)
}

if err = networkingService.DeleteNetwork(openStackCluster, clusterName); err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to delete network: %w", err))
return ctrl.Result{}, fmt.Errorf("failed to delete network: %w", err)
Expand Down

0 comments on commit 3a621fb

Please sign in to comment.