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

Enable ebs-csi driver on AWS, add region + kubernetes_version vars #1494

Merged
merged 2 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qhub/template/stages/02-infrastructure/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ module "efs" {
module "kubernetes" {
source = "./modules/kubernetes"

name = local.cluster_name
tags = local.additional_tags
name = local.cluster_name
tags = local.additional_tags
region = var.region
kubernetes_version = var.kubernetes_version

cluster_subnets = module.network.subnet_ids
cluster_security_groups = [module.network.security_group_id]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
locals {
cluster_policies = concat([
"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
"arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy",
], var.cluster_additional_policies)

node_group_policies = concat([
"arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy",
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy",
"arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy",
aws_iam_policy.worker_autoscaling.arn
], var.node_group_additional_policies)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resource "aws_eks_cluster" "main" {
name = var.name
role_arn = aws_iam_role.cluster.arn
version = var.kubernetes_version

vpc_config {
security_group_ids = var.cluster_security_groups
Expand Down Expand Up @@ -48,3 +49,15 @@ resource "aws_eks_node_group" "main" {
data "aws_eks_cluster_auth" "main" {
name = aws_eks_cluster.main.name
}

resource "aws_eks_addon" "aws-ebs-csi-driver" {
# required for Kubernetes v1.23+ on AWS
addon_name = "aws-ebs-csi-driver"
cluster_name = aws_eks_cluster.main.name
resolve_conflicts = "OVERWRITE"
# Ensure cluster and node groups are created
depends_on = [
aws_eks_cluster.main,
aws_eks_node_group.main,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ variable "cluster_subnets" {
type = list(string)
}

variable "region" {
description = "AWS region for EKS cluster"
type = string
}

variable "kubernetes_version" {
description = "AWS kubernetes version for EKS cluster"
type = string
}

variable "cluster_security_groups" {
description = "AWS security groups to use for EKS cluster"
type = list(string)
Expand Down
10 changes: 10 additions & 0 deletions qhub/template/stages/02-infrastructure/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ variable "environment" {
type = string
}

variable "region" {
description = "AWS region for EKS cluster"
type = string
}

variable "kubernetes_version" {
description = "AWS kubernetes version for EKS cluster"
type = string
}

variable "node_groups" {
description = "AWS node groups"
type = list(object({
Expand Down