From 46ef783c1237cd83342018bebfd9f1298125f1f5 Mon Sep 17 00:00:00 2001 From: Hans Rakers Date: Fri, 16 Aug 2024 00:15:35 +0200 Subject: [PATCH] fix: Use async cs client for lb rule deletion --- pkg/cloud/isolated_network.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/cloud/isolated_network.go b/pkg/cloud/isolated_network.go index 65a9e60c..70ec7308 100644 --- a/pkg/cloud/isolated_network.go +++ b/pkg/cloud/isolated_network.go @@ -286,9 +286,12 @@ func (c *client) ReconcileLoadBalancerRules(isoNet *infrav1.CloudStackIsolatedNe if !slices.Contains(ports, intport) { success, err := c.DeleteLoadBalancerRule(ruleID) - if err != nil || !success { + if err != nil { return errors.Wrap(err, "deleting load balancer rule") } + if !success { + return errors.New("delete load balancer rule returned unsuccessful") + } } } // Update isoNet status with the current list of loadbalancer rule ID's. @@ -326,8 +329,8 @@ func (c *client) CreateLoadBalancerRule(isoNet *infrav1.CloudStackIsolatedNetwor // DeleteLoadBalancerRule deletes an existing load balancer rule. func (c *client) DeleteLoadBalancerRule(id string) (bool, error) { - p := c.cs.LoadBalancer.NewDeleteLoadBalancerRuleParams(id) - resp, err := c.cs.LoadBalancer.DeleteLoadBalancerRule(p) + p := c.csAsync.LoadBalancer.NewDeleteLoadBalancerRuleParams(id) + resp, err := c.csAsync.LoadBalancer.DeleteLoadBalancerRule(p) if err != nil { c.customMetrics.EvaluateErrorAndIncrementAcsReconciliationErrorCounter(err)