Skip to content

Commit

Permalink
new(ebs-csi-controller): ad-hoc iam role for ebs-csi-controller
Browse files Browse the repository at this point in the history
Signed-off-by: Aldo Lacuku <[email protected]>
  • Loading branch information
alacuku committed Jul 18, 2024
1 parent d48ea60 commit 8723f66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
24 changes: 19 additions & 5 deletions config/clusters/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ data "aws_canonical_user_id" "current_user" {}

data "aws_caller_identity" "current" {}

##### EBS CSI controller

module "ebs_csi_controller" {
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc"
version = "4.1.0"
create_role = true
role_name = "${local.cluster_name}-ebs-csi-controller"
provider_url = replace(module.eks.cluster_oidc_issuer_url, "https://", "")
role_policy_arns = [aws_iam_policy.ebs_controller_policy.arn]
oidc_fully_qualified_subjects = [
"system:serviceaccount:kube-system:ebs-csi-controller-sa",
]
}

resource "aws_iam_policy" "ebs_controller_policy" {
name_prefix = "${local.cluster_name}-ebs-csi-driver"
policy = data.aws_iam_policy_document.ebs_controller_policy_doc.json
}

data "aws_iam_policy_document" "ebs_controller_policy_doc" {
statement {
effect = "Allow"
Expand All @@ -26,11 +45,6 @@ data "aws_iam_policy_document" "ebs_controller_policy_doc" {
}
}

resource "aws_iam_policy" "ebs_controller_policy" {
name_prefix = "${local.cluster_name}-ebs-csi-driver"
policy = data.aws_iam_policy_document.ebs_controller_policy_doc.json
}

##### Cluster-autoscaler

module "cluster_autoscaler" {
Expand Down
2 changes: 2 additions & 0 deletions config/prow/ebs-csi-driver/ebs-csi-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: aws-ebs-csi-driver
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::292999226676:role/falco-prow-test-infra-ebs-csi-controller
name: ebs-csi-controller-sa
namespace: kube-system
---
Expand Down

0 comments on commit 8723f66

Please sign in to comment.