Skip to content

Commit

Permalink
Merge pull request #186 from cloudnativedaysjp/prod/delete-eks_on-k8s
Browse files Browse the repository at this point in the history
[dreamkast-prod] delete some states on EKS
  • Loading branch information
ShotaKitazawa authored Oct 20, 2024
2 parents eec4a17 + e4a5478 commit 8464eac
Showing 1 changed file with 0 additions and 98 deletions.
98 changes: 0 additions & 98 deletions dreamkast_infra/prod/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -322,101 +322,3 @@ module "vpc_cni_irsa" {
}
}
}

# ------------------------------------------------------------#
# aws loadbalancer controller
# ------------------------------------------------------------#

module "lb_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"

role_name = "${var.prj_prefix}-eks-lb-irsa"
attach_load_balancer_controller_policy = true

oidc_providers = {
main = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:aws-load-balancer-controller"]
}
}
}

resource "kubernetes_service_account" "lb_sa" {
metadata {
name = "aws-load-balancer-controller"
namespace = "kube-system"
labels = {
"app.kubernetes.io/name" = "aws-load-balancer-controller"
"app.kubernetes.io/component" = "controller"
}
annotations = {
"eks.amazonaws.com/role-arn" = module.lb_irsa.iam_role_arn
"eks.amazonaws.com/sts-regional-endpoints" = "true"
}
}
}

# ------------------------------------------------------------#
# EBS CSI Driver
# ------------------------------------------------------------#

module "ebs_csi_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"

role_name = "${var.prj_prefix}-eks-ebs-irsa"
attach_ebs_csi_policy = true

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

resource "kubernetes_service_account" "ebs_csi_controller_sa" {
metadata {
name = "ebs-csi-controller-sa"
namespace = "kube-system"
labels = {
"app.kubernetes.io/name" = "ebs-csi-controller-sa"
"app.kubernetes.io/component" = "controller"
}
annotations = {
"eks.amazonaws.com/role-arn" = module.ebs_csi_irsa.iam_role_arn
}
}
}

# ------------------------------------------------------------#
# cluster autoscaler
# ------------------------------------------------------------#

module "cluster_autoscaler_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"

role_name = "${var.prj_prefix}-cluster-autoscaler-irsa"
attach_cluster_autoscaler_policy = true
cluster_autoscaler_cluster_ids = [module.eks.cluster_name]

oidc_providers = {
main = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:cluster-autoscaler"]
}
}
}

resource "kubernetes_service_account" "cluster_autoscaler_sa" {
metadata {
name = "cluster-autoscaler"
namespace = "kube-system"
labels = {
"app.kubernetes.io/name" = "cluster-autoscaler"
"app.kubernetes.io/component" = "controller"
}
annotations = {
"eks.amazonaws.com/role-arn" = module.cluster_autoscaler_irsa.iam_role_arn
}
}
}

0 comments on commit 8464eac

Please sign in to comment.