Skip to content
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

[IBCDPE-1005] eks developer role #17

Merged
merged 14 commits into from
Aug 16, 2024
Merged

Conversation

BryanFauble
Copy link
Contributor

@BryanFauble BryanFauble commented Aug 15, 2024

Problem:

  1. As a user with a Developer level role I do not have access to the EKS cluster in any way.

Solution:

  1. Creating an access entry for both Administrator and Developer SSO roles that have an EKS policy to access resources on the cluster
  2. This gives cluster level read access: https://docs.aws.amazon.com/eks/latest/userguide/access-policies.html

Testing:

  1. I updated my kube config and verified I could access resources from both sso roles
  2. I tested that I was able to view all resources and perform port-forwarding sessions
    image

Copy link
Contributor

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 LGTM! Going to pre-approve - not sure if @BWMac had some comments!

@BWMac BWMac self-requested a review August 15, 2024 18:16
Copy link

@zaro0508 zaro0508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is the wrong approach, see my comments in PR Sage-Bionetworks-IT/organizations-infra#1191

@BryanFauble
Copy link
Contributor Author

BryanFauble commented Aug 15, 2024

i think this is the wrong approach, see my comments in PR Sage-Bionetworks-IT/organizations-infra#1191

@zaro0508 You bring up an excellent point that I didn't think of until you brought this up.

I actually don't need to create a new role for one to assume in this case. What I can do instead is to add these existing assumed roles as an IAM access entry to the cluster. This prevents the need to assume another role with these permissions, and instead I can directly grant these permissions like:
image

I will update this PR accordingly

}
eks_admin_role_entries = {
for idx, role_arn in zipmap(range(length(local.eks_admin_roles)), local.eks_admin_roles) :
"eks_admin_role_${idx}" => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this syntax was a bit complex, in part because:

  1. data.aws_iam_roles.administrator-roles.arns is a set that needs to be converted to a list for some of these other functions to work
  2. zipmap is used here to allow getting the index in the for loop
  3. The index was added to the for loop in the event we were going to add multiple ARNs for each of these access entries the key would conflict if we didn't have a unique index

@spacelift-int-sagebionetworks spacelift-int-sagebionetworks bot temporarily deployed to spacelift/root-spacelift-administrative-stack August 15, 2024 22:02 Inactive
Copy link
Contributor

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes and thanks for the review khai!

Base automatically changed from ibcdpe-1034-argocd to main August 16, 2024 00:06
@BryanFauble BryanFauble merged commit e052722 into main Aug 16, 2024
6 of 7 checks passed
@BryanFauble BryanFauble deleted the ibcdpe-1005-eks-developer-role branch August 16, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants