DaanHoogland commented on code in PR #8801:
URL: https://github.com/apache/cloudstack/pull/8801#discussion_r1639481356


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java:
##########
@@ -551,60 +536,58 @@ protected void removePortForwardingRules(final IpAddress 
publicIp, final Network
         for (PortForwardingRuleVO pfRule : pfRules) {
             if (startPort <= pfRule.getSourcePortStart() && 
pfRule.getSourcePortStart() <= endPort) {
                 portForwardingRulesDao.remove(pfRule.getId());
+                logger.debug(String.format("The Port forwarding rule [%s] with 
the id [%s] was removed.", pfRule.getName(), pfRule.getId()));
             }
         }
         rulesService.applyPortForwardingRules(publicIp.getId(), account);
     }
 
     protected void removeLoadBalancingRule(final IpAddress publicIp, final 
Network network,
                                            final Account account) throws 
ResourceUnavailableException {
-        List<LoadBalancerVO> rules = 
loadBalancerDao.listByIpAddress(publicIp.getId());
-        for (LoadBalancerVO rule : rules) {
-            if (rule.getNetworkId() == network.getId() &&
-                    rule.getAccountId() == account.getId() &&
-                    rule.getSourcePortStart() == CLUSTER_API_PORT &&
-                    rule.getSourcePortEnd() == CLUSTER_API_PORT) {
-                lbService.deleteLoadBalancerRule(rule.getId(), true);
-                break;
-            }
-        }
+        List<LoadBalancerVO> loadBalancerRules = 
loadBalancerDao.listByIpAddress(publicIp.getId());
+        loadBalancerRules.stream().filter(lbRules -> lbRules.getNetworkId() == 
network.getId() && lbRules.getAccountId() == account.getId() && 
lbRules.getSourcePortStart() == CLUSTER_API_PORT
+        && lbRules.getSourcePortEnd() == CLUSTER_API_PORT).forEach(lbRule -> {
+            lbService.deleteLoadBalancerRule(lbRule.getId(), true);
+            logger.debug(String.format("The load balancing rule with the Id: 
%s was removed",lbRule.getId()));

Review Comment:
   ```suggestion
               logger.debug("The load balancing rule with the Id: {} was 
removed",lbRule.getId());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to