-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added project id to kubeadmin user for Kubernetes service #10362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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; | ||||||||||||||||||||||||||||||||||
Comment on lines
+1388
to
+1395
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean accounts cannot have a kubernetes instance without being part of a project? I would expect something like
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea. Will update the code as such. In our case, we always have projectId. |
||||||||||||||||||||||||||||||||||
UserAccount kubeadmin = accountService.getActiveUserAccount(username, owner.getDomainId()); | ||||||||||||||||||||||||||||||||||
String[] keys = null; | ||||||||||||||||||||||||||||||||||
if (kubeadmin == null) { | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parkinr
can you explain more ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this PR, the username is: flexcloud-admin-account-kubeadmin
With this PR, the username is flexcloud-admin-account-f316789i-2bgg-4r87-95h7-58j5327892ef-kubeadmin with sample projectId=f316789i-2bgg-4r87-95h7-58j5327892ef. And you can see this projectId in cloudstack-secret on the Kubernetes cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @parkinr for the reply.
However, the security issue is not resolved I think.
@DaanHoogland
we may need to treat this as a serious security issue.