BryanMLima commented on code in PR #8801: URL: https://github.com/apache/cloudstack/pull/8801#discussion_r1577900824
########## plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java: ########## @@ -537,6 +521,7 @@ protected void removePortForwardingRules(final IpAddress publicIp, final Network for (PortForwardingRuleVO pfRule : pfRules) { if (pfRule.getVirtualMachineId() == vmId) { portForwardingRulesDao.remove(pfRule.getId()); + logger.debug(String.format("The Port forwarding rule [%s] with the id [%s] was removed.", pfRule.getName(), pfRule.getId())); Review Comment: No need to use `String.format()` here, with the updated log4j. ########## 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: No need to use `String.format()` here, with the updated log4j. ########## plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java: ########## @@ -511,6 +493,7 @@ protected FirewallRule removeApiFirewallRule(final IpAddress publicIp) { firewallRule.getSourcePortEnd() == CLUSTER_API_PORT) { rule = firewallRule; firewallService.revokeIngressFwRule(firewallRule.getId(), true); + logger.debug(String.format("The API firewall rule [%s] with the id [%s] was revoked",firewallRule.getName(),firewallRule.getId())); Review Comment: No need to use `String.format()` here, with the updated log4j. ########## 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())); Review Comment: No need to use `String.format()` here, with the updated log4j. ########## plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java: ########## @@ -524,6 +507,7 @@ protected FirewallRule removeSshFirewallRule(final IpAddress publicIp) { if (firewallRule.getSourcePortStart() == CLUSTER_NODES_DEFAULT_START_SSH_PORT) { rule = firewallRule; firewallService.revokeIngressFwRule(firewallRule.getId(), true); + logger.debug(String.format("The SSH firewall rule [%s] with the id [%s] was revoked",firewallRule.getName(),firewallRule.getId())); Review Comment: No need to use `String.format()` here, with the updated log4j. -- 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