weizhouapache commented on a change in pull request #6132:
URL: https://github.com/apache/cloudstack/pull/6132#discussion_r837172783



##########
File path: 
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
##########
@@ -1035,17 +1043,34 @@ public KubernetesCluster 
createKubernetesCluster(CreateKubernetesClusterCmd cmd)
             logAndThrow(Level.ERROR, String.format("Creating Kubernetes 
cluster failed due to error while finding suitable deployment plan for cluster 
in zone : %s", zone.getName()));
         }
 
+        SecurityGroupVO securityGroupVO = null;
+        if (zone.isSecurityGroupEnabled()) {
+            securityGroupVO = 
securityGroupManager.createSecurityGroup(KubernetesClusterActionWorker.CKS_CLUSTER_SECURITY_GROUP_NAME.concat(Long.toHexString(System.currentTimeMillis())),
 "Security group for CKS nodes", owner.getDomainId(), owner.getId(), 
owner.getAccountName());
+            if (securityGroupVO == null) {
+                throw new CloudRuntimeException(String.format("Failed to 
create security group: %s", 
KubernetesClusterActionWorker.CKS_CLUSTER_SECURITY_GROUP_NAME));
+            }
+            List<String> cidrList = new ArrayList<>();
+            cidrList.add(NetUtils.ALL_IP4_CIDRS);
+            
securityGroupService.authorizeSecurityGroupRule(securityGroupVO.getId(), 
NetUtils.TCP_PROTO, 22, 22, null, null, cidrList, null, 
SecurityRule.SecurityRuleType.IngressRule);

Review comment:
       @Pearl1594 
   can you define a constant in KubernetesClusterActionWorker  and use 
KubernetesClusterActionWorker.CLUSTER_API_PORT (6443) ?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to