Skip to content

Commit

Permalink
Fix test infra EKS code (#2179)
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev authored Jul 10, 2023
1 parent 51fbb83 commit d7a1d6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
20 changes: 8 additions & 12 deletions kubernetes/test-infra/eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "random_string" "rand" {
}

locals {
cluster_name = "test-cluster-${random_string.rand.result}"
cluster_name = var.cluster_name != "" ? var.cluster_name : "test-cluster-${random_string.rand.result}"
cidr = "10.0.0.0/16"
az_count = min(var.az_span, length(data.aws_availability_zones.available.names))
azs = slice(data.aws_availability_zones.available.names, 0, local.az_count)
Expand All @@ -28,7 +28,7 @@ data "aws_availability_zones" "available" {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 18.11"
version = "~> 19.15"

cluster_name = local.cluster_name
cluster_version = var.cluster_version
Expand All @@ -38,17 +38,13 @@ module "eks" {
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets

eks_managed_node_group_defaults = {
instance_types = [var.instance_type]
min_size = 1
max_size = local.node_count
desired_size = local.node_count
}

eks_managed_node_groups = {
default_node_group = {
create_launch_template = false
launch_template_name = ""
desired_size = local.node_count
min_size = 1
max_size = local.node_count
instance_types = [var.instance_type]
use_custom_launch_template = false
}
}

Expand All @@ -57,7 +53,7 @@ module "eks" {

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"
version = "~> 5.0"

name = local.cluster_name
cidr = local.cidr
Expand Down
7 changes: 6 additions & 1 deletion kubernetes/test-infra/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: MPL-2.0

variable "cluster_version" {
default = "1.23"
default = "1.27"
}

variable "nodes_per_az" {
Expand All @@ -22,3 +22,8 @@ variable "az_span" {
error_message = "Cluster must span at least 2 AZs"
}
}


variable "cluster_name" {
default = ""
}

0 comments on commit d7a1d6b

Please sign in to comment.