Skip to content

Commit

Permalink
Add FSX CSI plugin and required storage class
Browse files Browse the repository at this point in the history
  • Loading branch information
jpolchlo committed Jan 17, 2023
1 parent 96e6e2b commit cdb8f0f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
20 changes: 20 additions & 0 deletions deployment/aws-terraform/1-services/fsx-csi.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "helm_release" "fsx_csi_driver" {
namespace = "kube-system"

name = "aws-fsx-csi-driver"
repository = "https://kubernetes-sigs.github.io/aws-fsx-csi-driver/"
chart = "aws-fsx-csi-driver"
}

resource "kubernetes_storage_class_v1" "fsx_sc" {
metadata {
name = "fsx-sc"
}
storage_provisioner = "fsx.csi.aws.com"
parameters = {
subnetId = tolist(module.eks.vpc_private_subnet_ids)[0]
securityGroupIds = module.eks.cluster_security_group
deploymentType = "PERSISTENT_2"
}
depends_on = [ helm_release.fsx_csi_driver ]
}
29 changes: 29 additions & 0 deletions deployment/aws-terraform/1-services/irsa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,32 @@ resource "kubernetes_annotations" "ebs_csi_iam_annotation" {
"eks.amazonaws.com/role-arn": module.ebs_csi_irsa.iam_role_arn
}
}
module "fsx_csi_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"

role_name_prefix = "fsx-csi-${local.cluster_name}"
attach_fsx_lustre_csi_policy = true

oidc_providers = {
main = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = [
"kube-system:fsx-csi-controller-sa"
]
}
}

tags = local.tags
}

resource "kubernetes_annotations" "fsx_csi_controller_annotation" {
api_version = "v1"
kind = "ServiceAccount"
metadata {
name = "fsx-csi-controller-sa"
namespace = "kube-system"
}
annotations = {
"eks.amazonaws.com/role-arn": module.fsx_csi_irsa.iam_role_arn
}
}

0 comments on commit cdb8f0f

Please sign in to comment.