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


##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1384,7 +1384,15 @@ private String[] getServiceUserKeys(KubernetesClusterVO 
kubernetesCluster) {
         if (owner == null || owner.getType() == Account.Type.PROJECT) {
             owner = CallContext.current().getCallingAccount();
         }
-        String username = owner.getAccountName() + "-" + 
KUBEADMIN_ACCOUNT_NAME;
+        
+        String projectId = "default";
+        Account account = 
ApiDBUtils.findAccountById(kubernetesCluster.getAccountId());
+        Project project = 
ApiDBUtils.findProjectByProjectAccountId(account.getId());
+        if ( project != null ) {
+          projectId = project.getUuid();
+        }
+
+        String username = owner.getAccountName() + "-" + projectId + "-" + 
KUBEADMIN_ACCOUNT_NAME;

Review Comment:
   does this mean accounts cannot have a kubernetes instance without being part 
of a project? I would expect something like 
   ```suggestion
           String projectId = null;
           Account account = 
ApiDBUtils.findAccountById(kubernetesCluster.getAccountId());
           Project project = 
ApiDBUtils.findProjectByProjectAccountId(account.getId());
           if ( project != null ) {
             projectId = project.getUuid();
           }
   
           String username = owner.getAccountName() + (projectId == null ? : "" 
: "-" + projectId) + "-" + KUBEADMIN_ACCOUNT_NAME;
   ```



-- 
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