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

karpenter version upgrade & deprecated Provisioner support #55

Open
wants to merge 2 commits into
base: release-3.0.1
Choose a base branch
from
Open
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
17 changes: 0 additions & 17 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,6 @@ module "eks-addons" {
values = [file("${path.module}/config/karpenter.yaml")]
}

## KARPENTER-PROVISIONER
karpenter_provisioner_enabled = false # to enable provisioning nodes with Karpenter in the EKS cluster
karpenter_provisioner_config = {
provisioner_name = format("karpenter-provisioner-%s", local.name)
karpenter_label = ["Mgt-Services", "Monitor-Services", "ECK-Services"]
provisioner_values = file("./config/karpenter-management.yaml")
instance_capacity_type = ["spot"]
excluded_instance_type = ["nano", "micro", "small"]
ec2_instance_family = ["t3"]
ec2_instance_type = ["t3.medium"]
private_subnet_selector_key = "Karpenter"
private_subnet_selector_value = "${local.name}-${local.region}a"
security_group_selector_key = "aws:eks:cluster-name"
security_group_selector_value = "${local.environment}-${local.name}"
instance_hypervisor = ["nitro"]
kms_key_arn = local.kms_key_arn
}
## coreDNS-HPA (cluster-proportional-autoscaler)
coredns_hpa_enabled = false # to enable core-dns HPA
coredns_hpa_helm_config = {
Expand Down
11 changes: 0 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,6 @@ module "karpenter" {
kms_key_arn = var.karpenter_enabled ? var.kms_key_arn : ""
}

## Karpenter-provisioner
module "karpenter-provisioner" {
source = "./modules/karpenter-provisioner"
count = var.karpenter_provisioner_enabled ? 1 : 0
depends_on = [module.karpenter]
ipv6_enabled = var.ipv6_enabled
karpenter_config = var.karpenter_provisioner_config
tag_product = var.tag_product
tag_environment = var.tag_environment
}

## KUBERNETES DASHBOARD
module "kubernetes-dashboard" {
source = "./modules/kubernetes-dashboard"
Expand Down
8 changes: 2 additions & 6 deletions modules/karpenter/config/karpenter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ nodeSelector:
kubernetes.io/os: linux

settings:
aws:
defaultInstanceProfile: ${node_iam_instance_profile}
clusterName: ${eks_cluster_id}
clusterEndpoint: ${eks_cluster_endpoint}
featureGates:
driftEnabled: true
clusterName: ${eks_cluster_id}
clusterEndpoint: ${eks_cluster_endpoint}

controller:
resources:
Expand Down
6 changes: 6 additions & 0 deletions modules/karpenter/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ data "aws_iam_policy_document" "karpenter" {
"iam:PassRole",
"pricing:GetProducts",
"ssm:GetParameter",
"iam:CreateInstanceProfile",
"iam:TagInstanceProfile",
"iam:AddRoleToInstanceProfile",
"iam:RemoveRoleFromInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:GetInstanceProfile",
]
}

Expand Down
5 changes: 1 addition & 4 deletions modules/karpenter/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ locals {
template_values = templatefile("${path.module}/config/karpenter.yaml", {
eks_cluster_id = var.addon_context.eks_cluster_id,
eks_cluster_endpoint = var.addon_context.aws_eks_cluster_endpoint,
node_iam_instance_profile = local.node_module_profile_id # enter profile name for kubernetes iam profile
})

template_values_map = yamldecode(local.template_values)
Expand All @@ -27,14 +26,12 @@ locals {
name = local.name
chart = local.name
repository = "oci://public.ecr.aws/karpenter"
version = "v0.32.10"
version = "1.0.0"
namespace = local.name
values = [yamlencode(merge(
yamldecode(<<-EOT
clusterName: ${var.addon_context.eks_cluster_id}
clusterEndpoint: ${var.addon_context.aws_eks_cluster_endpoint}
aws:
defaultInstanceProfile: ${local.node_iam_instance_profile}
EOT
), local.template_values_map, var.karpenter_helm_config))]
description = "karpenter Helm Chart for Node Autoscaling"
Expand Down