Skip to content

Commit

Permalink
fix: update karpenter module with the right config
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Glotov committed Nov 6, 2024
1 parent 8ace456 commit b3016bf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
27 changes: 18 additions & 9 deletions terraform/modules/k8s-karpenter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ locals {
karpenter = {
name = try(var.helm.release_name, "karpenter")
enabled = true
chart = try(var.helm.chart_name, "oci://public.ecr.aws/karpenter/karpenter")
repository = try(var.helm.repository, "")
chart_version = try(var.helm.chart_version, "1.0.3")
chart = try(var.helm.chart_name, "karpenter")
repository = try(var.helm.repository, "oci://public.ecr.aws/karpenter")
chart_version = try(var.helm.chart_version, "1.0.6")
namespace = try(var.helm.namespace, "karpenter")
}

Expand Down Expand Up @@ -136,14 +136,23 @@ resource "kubectl_manifest" "nodepool" {
resource "helm_release" "this" {
count = local.karpenter.enabled ? 1 : 0

name = local.karpenter.name
chart = local.karpenter.chart
repository = local.karpenter.repository
version = local.karpenter.chart_version
namespace = module.namespace[count.index].name
max_history = 3
name = local.karpenter.name
chart = local.karpenter.chart
repository = local.karpenter.repository
version = local.karpenter.chart_version
namespace = module.namespace[count.index].name
max_history = 3

repository_username = data.aws_ecrpublic_authorization_token.token.user_name
repository_password = data.aws_ecrpublic_authorization_token.token.password

values = [
local.karpenter_values
]

lifecycle {
ignore_changes = [
repository_password
]
}
}
9 changes: 9 additions & 0 deletions terraform/modules/k8s-karpenter/providers.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
provider "aws" {
alias = "ecr"
region = "us-east-1"
}

provider "kubernetes" {
host = data.aws_eks_cluster.main.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.main.certificate_authority.0.data)
Expand Down Expand Up @@ -31,3 +36,7 @@ data "aws_eks_cluster_auth" "main" {
}

data "aws_caller_identity" "current" {}

data "aws_ecrpublic_authorization_token" "token" {
provider = aws.ecr
}

0 comments on commit b3016bf

Please sign in to comment.