Skip to content

Commit

Permalink
removing worker nodes - they dont join the cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
jerowe committed Sep 9, 2021
1 parent 185439a commit 538e0fd
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 92 deletions.
120 changes: 60 additions & 60 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,66 +70,66 @@ module "eks_cluster" {
context = module.this.context
}

module "eks_workers" {
depends_on = [module.eks_cluster]
source = "cloudposse/eks-workers/aws"
version = "0.19.2"


# for_each = tomap(var.eks_worker_groups)
for_each = { for eks_worker_group in var.eks_worker_groups : eks_worker_group.name => eks_worker_group }

vpc_id = var.vpc_id
subnet_ids = var.subnet_ids
cluster_name = data.null_data_source.wait_for_cluster_and_kubernetes_configmap.outputs["cluster_name"]
cluster_endpoint = module.eks_cluster.eks_cluster_endpoint
cluster_certificate_authority_data = module.eks_cluster.eks_cluster_certificate_authority_data

name = "${module.label.id}-${each.value.name}"
instance_type = each.value.instance_type
min_size = each.value.min_size
max_size = each.value.max_size

tags = local.tags

autoscaling_group_tags = {
"k8s.io/cluster-autoscaler/${module.this.id}-cluster" = "owned"
"k8s.io/cluster-autoscaler/${module.this.id}" = "owned"
"kubernetes.io/cluster/${module.this.id}-cluster" = "owned"
"k8s.io/cluster-autoscaler/enabled" = "true"
}
# bootstrap_extra_args = "--use-max-pods false"
# kubelet_extra_args = "--node-labels=purpose=ci-worker"

context = module.this.context

security_group_rules = [
{
type = "egress"
from_port = 0
to_port = 65535
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
source_security_group_id = null
description = "Allow all outbound traffic"
},
{
type = "ingress"
from_port = 0
to_port = 65535
protocol = "-1"
cidr_blocks = []
# source_security_group_id = var.eks_worker_security_group_id
source_security_group_id = module.eks_cluster.security_group_id
description = "Allow all inbound traffic from Security Group ID of the EKS cluster"
}
]

# Auto-scaling policies and CloudWatch metric alarms
autoscaling_policies_enabled = var.eks_worker_group_autoscaling_policies_enabled
# cpu_utilization_high_threshold_percent = var.cpu_utilization_high_threshold_percent
# cpu_utilization_low_threshold_percent = var.cpu_utilization_low_threshold_percent
}
# module "eks_workers" {
# depends_on = [module.eks_cluster]
# source = "cloudposse/eks-workers/aws"
# version = "0.19.2"


# # for_each = tomap(var.eks_worker_groups)
# for_each = { for eks_worker_group in var.eks_worker_groups : eks_worker_group.name => eks_worker_group }

# vpc_id = var.vpc_id
# subnet_ids = var.subnet_ids
# cluster_name = data.null_data_source.wait_for_cluster_and_kubernetes_configmap.outputs["cluster_name"]
# cluster_endpoint = module.eks_cluster.eks_cluster_endpoint
# cluster_certificate_authority_data = module.eks_cluster.eks_cluster_certificate_authority_data

# name = "${module.label.id}-${each.value.name}"
# instance_type = each.value.instance_type
# min_size = each.value.min_size
# max_size = each.value.max_size

# tags = local.tags

# autoscaling_group_tags = {
# "k8s.io/cluster-autoscaler/${module.this.id}-cluster" = "owned"
# "k8s.io/cluster-autoscaler/${module.this.id}" = "owned"
# "kubernetes.io/cluster/${module.this.id}-cluster" = "owned"
# "k8s.io/cluster-autoscaler/enabled" = "true"
# }
# # bootstrap_extra_args = "--use-max-pods false"
# # kubelet_extra_args = "--node-labels=purpose=ci-worker"

# context = module.this.context

# security_group_rules = [
# {
# type = "egress"
# from_port = 0
# to_port = 65535
# protocol = "-1"
# cidr_blocks = ["0.0.0.0/0"]
# source_security_group_id = null
# description = "Allow all outbound traffic"
# },
# {
# type = "ingress"
# from_port = 0
# to_port = 65535
# protocol = "-1"
# cidr_blocks = []
# # source_security_group_id = var.eks_worker_security_group_id
# source_security_group_id = module.eks_cluster.security_group_id
# description = "Allow all inbound traffic from Security Group ID of the EKS cluster"
# }
# ]

# # Auto-scaling policies and CloudWatch metric alarms
# autoscaling_policies_enabled = var.eks_worker_group_autoscaling_policies_enabled
# # cpu_utilization_high_threshold_percent = var.cpu_utilization_high_threshold_percent
# # cpu_utilization_low_threshold_percent = var.cpu_utilization_low_threshold_percent
# }

data "null_data_source" "wait_for_cluster_and_kubernetes_configmap" {
inputs = {
Expand Down
16 changes: 3 additions & 13 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,13 @@ output "eks_cluster_identity_oidc_issuer" {
value = module.eks_cluster.eks_cluster_identity_oidc_issuer
}

# output "eks_cluster_identity_oidc_issuer" {
# description = "The OIDC Identity issuer for the cluster"
# value = join("", aws_eks_cluster.default.*.identity.0.oidc.0.issuer)
# }

# output "cluster_oidc_issuer_url" {
# description = "The URL on the EKS cluster OIDC Issuer"
# value = flatten(concat(aws_eks_cluster.this[*].identity[*].oidc.0.issuer, [""]))[0]
# }

output "eks_cluster_node_groups" {
value = module.eks_node_group
}

output "eks_cluster_workers" {
value = module.eks_workers
}
# output "eks_cluster_workers" {
# value = module.eks_workers
# }

output "get_kubectl" {
description = "Get your kubectl "
Expand Down
40 changes: 21 additions & 19 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,27 @@ variable "eks_worker_group_autoscaling_policies_enabled" {
}


variable "eks_worker_groups" {
description = "EKS Worker Groups"
type = list(object({
name = string
instance_type = string
desired_size = number
min_size = number
max_size = number
}))
default = [
# {
# name = "t3a_medium"
# instance_type = "t3a.medium"
# desired_size = 1
# min_size = 1
# max_size = 2
# }
]
}
# Worker group nodes are not joining the cluster.
# Will fix in later release
# variable "eks_worker_groups" {
# description = "EKS Worker Groups"
# type = list(object({
# name = string
# instance_type = string
# desired_size = number
# min_size = number
# max_size = number
# }))
# default = [
# # {
# # name = "t3a_medium"
# # instance_type = "t3a.medium"
# # desired_size = 1
# # min_size = 1
# # max_size = 2
# # }
# ]
# }

####################################################################
# EKS Node Groups
Expand Down

0 comments on commit 538e0fd

Please sign in to comment.