Skip to content

Commit

Permalink
fix: some fixes for karpenter deploy (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
kvvit authored Sep 30, 2024
1 parent dde6003 commit 8ace456
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
14 changes: 5 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, "karpenter")
repository = try(var.helm.repository, "oci://public.ecr.aws/karpenter")
chart_version = try(var.helm.chart_version, "1.0.0")
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")
namespace = try(var.helm.namespace, "karpenter")
}

Expand All @@ -30,8 +30,6 @@ controller:
VALUES
}

data "aws_ecrpublic_authorization_token" "token" {}

module "this" {
count = local.karpenter.enabled ? 1 : 0

Expand Down Expand Up @@ -66,7 +64,7 @@ resource "kubectl_manifest" "ec2nodeclass_private" {
count = local.karpenter.enabled ? 1 : 0

yaml_body = <<EOF
apiVersion: karpenter.sh/v1
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: private
Expand Down Expand Up @@ -98,7 +96,7 @@ resource "kubectl_manifest" "ec2nodeclass_public" {
count = local.karpenter.enabled ? 1 : 0

yaml_body = <<EOF
apiVersion: karpenter.sh/v1
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: public
Expand Down Expand Up @@ -144,8 +142,6 @@ resource "helm_release" "this" {
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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions terragrunt/ACCOUNT_ID/us-east-1/demo/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ eks_karpenter_nodepools:

spec:
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: private

requirements:
Expand Down Expand Up @@ -68,6 +70,7 @@ eks_karpenter_nodepools:

disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m

limits:
cpu: "1000"
Expand All @@ -85,6 +88,8 @@ eks_karpenter_nodepools:

spec:
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: public

taints:
Expand Down Expand Up @@ -130,6 +135,7 @@ eks_karpenter_nodepools:

disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m

limits:
cpu: "1000"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ace456

Please sign in to comment.