Skip to content

Commit

Permalink
fix(main.tf): update node class to remove resource reservations for m…
Browse files Browse the repository at this point in the history
…in scale
  • Loading branch information
morga471 committed Sep 4, 2024
1 parent b0a84a4 commit fb55019
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
15 changes: 2 additions & 13 deletions ec2_node_class.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@ kind: EC2NodeClass
metadata:
name: ${cluster_name}-karpenter-node-class
annotations:
kubernetes.io/description: "EC2NodeClass for running Bottlerocket nodes"
kubernetes.io/description: "EC2NodeClass for running ${amd_ami_family} nodes"
spec:
kubelet:
podsPerCore: 2
maxPods: 20
systemReserved:
cpu: 100m
memory: 100Mi
ephemeral-storage: 1Gi
kubeReserved:
cpu: 200m
memory: 100Mi
ephemeral-storage: 3Gi
evictionHard:
memory.available: 5%
nodefs.available: 10%
Expand All @@ -32,12 +22,11 @@ spec:
evictionMaxPodGracePeriod: 60
imageGCHighThresholdPercent: 85
imageGCLowThresholdPercent: 80
cpuCFSQuota: true

# Required, resolves a default ami and userdata
amiFamily: ${amd_ami_family}
amiSelectorTerms:
- alias: bottlerocket@latest # Bottlerocket
- alias: ${amd_ami_alias}@latest # Bottlerocket
# Required, discovers subnets to attach to instances
# Each term in the array of subnetSelectorTerms is ORed together
# Within a single term, all conditions are ANDed
Expand Down
34 changes: 17 additions & 17 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ resource "helm_release" "karpenter" {
name = "controller.env[0].value"
value = var.region
}
set {
name = "resources.requests.cpu"
value = 1
}
set {
name = "resources.requests.memory"
value = "1Gi"
}
set {
name = "resources.limits.cpu"
value = 1
}
set {
name = "resources.limits.memory"
value = "1Gi"
}
# set {
# name = "resources.requests.cpu"
# value = 1
# }
# set {
# name = "resources.requests.memory"
# value = "1Gi"
# }
# set {
# name = "resources.limits.cpu"
# value = 1
# }
# set {
# name = "resources.limits.memory"
# value = "1Gi"
# }
set {
name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = module.karpenter_resources.iam_role_arn
Expand All @@ -192,7 +192,6 @@ resource "aws_iam_service_linked_role" "ec2_spot" {
aws_service_name = "spot.amazonaws.com"
}


# SHOULD PROBABLY PUT THESE OBJECTS INTO A HELM CHART
# Create karpenter default
resource "kubectl_manifest" "karpenter_ec2_node_class" {
Expand All @@ -202,6 +201,7 @@ resource "kubectl_manifest" "karpenter_ec2_node_class" {
yaml_body = templatefile("${path.module}/ec2_node_class.yaml.tpl", {
cluster_name = var.cluster_name
amd_ami_family = "Bottlerocket"
amd_ami_alias = "bottlerocket"
})
}

Expand Down

0 comments on commit fb55019

Please sign in to comment.