Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

fix: cleanup IRSA for EKS #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gazal-k
Copy link

@gazal-k gazal-k commented Mar 28, 2020

  • correct SA names
  • remove unnecessary permissions
  • add IRSA for cluster-autoscaler

@ghost ghost added the size/M label Mar 28, 2020
- iam:GetPolicy
- iam:CreatePolicy
- iam:DeleteRole
- iam:GetOpenIDConnectProvider
Copy link
Author

Choose a reason for hiding this comment

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

would tekton have ever needed these permissions ?

Choose a reason for hiding this comment

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

I guess when running the boot job

Copy link
Author

Choose a reason for hiding this comment

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

I can't be sure of this. But in EKS with regular jx boot, I imagine the SA was getting overwritten anyway and didn't get any of these permissions but just the node permissions. We have been creating EKS clusters with the node having almost full ECR permissions which is why tekton didn't have any trouble.

In any case, at least the jxl boot run job I think doesn't really need to deal with IAM or cloudformation stacks or EKS roles. I would imagine it needs ECR permissions and S3 (logs, test reports etc)

Copy link
Author

Choose a reason for hiding this comment

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

we've verified and the only role tekton-bot needs is elevated ECR access (https://github.com/jenkins-x-labs/jenkins-x-versions/pull/39/files#diff-75c8c8fbc6a827a3d9818b81a608fc2dL17) which cannot be leveraged yet because of: jenkins-x-labs/issues#21.

Action:
- route53:ListHostedZones
- route53:ListResourceRecordSets
Resource: "*"
CFNCertManagerPolicies:
Type: AWS::IAM::ManagedPolicy
Properties:
Copy link
Author

Choose a reason for hiding this comment

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

does certmanager really need Route53 permissions?

Choose a reason for hiding this comment

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

it could be externaldns needing that? cc @rawlingsj

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

looks like cert-manager does need these route53 permissions, but cert-manager-cainjector might not

@jstrachan
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign pmuir
You can assign the PR to them by writing /assign @pmuir in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gazal-k
Copy link
Author

gazal-k commented Apr 1, 2020

we don't use this cloudformation & eksctl config, but for other EKS users who may want to use it.

namespace: jx
labels: {aws-usage: "jenkins-x"}
attachPolicyARNs:
- "arn:aws:iam::aws:policy/AmazonS3FullAccess"
- metadata:
name: jxui
name: jxl-boot
namespace: jx
labels: {aws-usage: "jenkins-x"}
attachPolicyARNs:
- "arn:aws:iam::aws:policy/AmazonS3FullAccess"
Copy link
Author

Choose a reason for hiding this comment

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

AmazonS3ReadOnlyAccess might be enough. Will verify and change later

Copy link
Author

Choose a reason for hiding this comment

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

during jx step verify preinstall it verifies the presence of the storage buckets

- metadata:
name: jenkins-x-controllerbuild
name: jxui
namespace: jx
labels: {aws-usage: "jenkins-x"}
attachPolicyARNs:
- "arn:aws:iam::aws:policy/AmazonS3FullAccess"
Copy link
Author

Choose a reason for hiding this comment

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

AmazonS3ReadOnlyAccess might be enough. Will verify and change later

- metadata:
name: cert-manager-cainjector
Copy link
Author

Choose a reason for hiding this comment

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

cert-manager-cainjector does not need route53 or any IAM access that cert-manager needs

@gazal-k
Copy link
Author

gazal-k commented Apr 1, 2020

we can probably tweak these further later.
example: only give access to the buckets jx actual needs

- correct SA names
- remove unnecessary permissions
- add IRSA for cluster-autoscaler
@ghost
Copy link

ghost commented Apr 7, 2020

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign pmuir
You can assign the PR to them by writing /assign @pmuir in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants