Skip to content

Commit 548a67b

Browse files
seanlongnycgoruha
andauthored
Add feature gates to settings (#47)
* add featureGate option to helm chart * update usage example * optional dynamic settings * remove removed var * use additional_settings for featureGates and more * update readme source * v0.35+ drops the v * move additional_settings to be lowest priority in merge * added indent --------- Co-authored-by: Igor Rodionov <[email protected]>
1 parent b4cfbb3 commit 548a67b

File tree

8 files changed

+92
-12
lines changed

8 files changed

+92
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ usage: |-
2727
# https://github.com/aws/karpenter/tree/main/charts/karpenter
2828
chart_repository: "oci://public.ecr.aws/karpenter"
2929
chart: "karpenter"
30-
chart_version: "v0.36.0"
30+
chart_version: "1.6.0"
3131
# Enable Karpenter to get advance notice of spot instances being terminated
3232
# See https://karpenter.sh/docs/concepts/#interruption
3333
interruption_handler_enabled: true
@@ -41,7 +41,6 @@ usage: |-
4141
cleanup_on_fail: true
4242
atomic: true
4343
wait: true
44-
rbac_enabled: true
4544
# "karpenter-crd" can be installed as an independent helm chart to manage the lifecycle of Karpenter CRDs
4645
crd_chart_enabled: true
4746
crd_chart: "karpenter-crd"
@@ -52,6 +51,12 @@ usage: |-
5251
settings:
5352
batch_idle_duration: "1s"
5453
batch_max_duration: "10s"
54+
# (Optional) "settings" which do not have an explicit mapping and may be subject to change between helm chart versions
55+
additional_settings:
56+
featureGates:
57+
nodeRepair: false
58+
reservedCapacity: true
59+
spotToSpotConsolidation: true
5560
# The logging settings for the Karpenter controller
5661
logging:
5762
enabled: true

src/README.md

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ module "karpenter" {
119119
webhook = var.logging.level.webhook
120120
}
121121
}
122-
settings = merge({
123-
batchIdleDuration = var.settings.batch_idle_duration
124-
batchMaxDuration = var.settings.batch_max_duration
125-
clusterName = local.eks_cluster_id
122+
settings = merge(
123+
var.additional_settings,
124+
{
125+
batchIdleDuration = var.settings.batch_idle_duration
126+
batchMaxDuration = var.settings.batch_max_duration
127+
clusterName = local.eks_cluster_id
126128
},
127129
local.interruption_handler_enabled ? {
128130
interruptionQueue = local.interruption_handler_queue_name

src/variables.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,27 @@ variable "settings" {
141141
nullable = false
142142
}
143143

144+
variable "additional_settings" {
145+
type = any
146+
description = <<-EOT
147+
Additional settings to merge into the Karpenter controller settings.
148+
This is useful for setting featureGates or other advanced settings that may
149+
vary by chart version. These settings will be merged with the base settings
150+
and take precedence over any conflicting keys.
151+
152+
Example:
153+
additional_settings = {
154+
featureGates = {
155+
nodeRepair = false
156+
reservedCapacity = true
157+
spotToSpotConsolidation = false
158+
}
159+
}
160+
EOT
161+
default = {}
162+
nullable = false
163+
}
164+
144165
variable "logging" {
145166
type = object({
146167
enabled = optional(bool, true)

test/fixtures/stacks/catalog/usecase/basic.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ components:
2424
cleanup_on_fail: true
2525
atomic: true
2626
wait: true
27-
rbac_enabled: true
2827
# "karpenter-crd" can be installed as an independent helm chart to manage the lifecycle of Karpenter CRDs
2928
crd_chart_enabled: true
3029
crd_chart: "karpenter-crd"

test/fixtures/stacks/catalog/usecase/disabled.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ components:
1010
# https://github.com/aws/karpenter/tree/main/charts/karpenter
1111
chart_repository: "oci://public.ecr.aws/karpenter"
1212
chart: "karpenter"
13-
chart_version: "v0.36.0"
13+
chart_version: "0.36.0"
1414
# Enable Karpenter to get advance notice of spot instances being terminated
1515
# See https://karpenter.sh/docs/concepts/#interruption
1616
interruption_handler_enabled: true
@@ -24,7 +24,6 @@ components:
2424
cleanup_on_fail: true
2525
atomic: true
2626
wait: true
27-
rbac_enabled: true
2827
# "karpenter-crd" can be installed as an independent helm chart to manage the lifecycle of Karpenter CRDs
2928
crd_chart_enabled: true
3029
crd_chart: "karpenter-crd"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
components:
2+
terraform:
3+
eks/karpenter-controller/basic:
4+
metadata:
5+
component: eks/karpenter-controller
6+
vars:
7+
enabled: true
8+
kube_exec_auth_role_arn_enabled: false
9+
name: "karpenter"
10+
# https://github.com/aws/karpenter/tree/main/charts/karpenter
11+
chart_repository: "oci://public.ecr.aws/karpenter"
12+
chart: "karpenter"
13+
chart_version: "1.6.0"
14+
# Enable Karpenter to get advance notice of spot instances being terminated
15+
# See https://karpenter.sh/docs/concepts/#interruption
16+
interruption_handler_enabled: true
17+
resources:
18+
limits:
19+
cpu: "100m"
20+
memory: "512Mi"
21+
requests:
22+
cpu: "100m"
23+
memory: "512Mi"
24+
cleanup_on_fail: true
25+
atomic: true
26+
wait: true
27+
# "karpenter-crd" can be installed as an independent helm chart to manage the lifecycle of Karpenter CRDs
28+
crd_chart_enabled: true
29+
crd_chart: "karpenter-crd"
30+
# replicas set the number of Karpenter controller replicas to run
31+
replicas: 2
32+
# "settings" controls a subset of the settings for the Karpenter controller regarding batch idle and max duration.
33+
# you can read more about these settings here: https://karpenter.sh/docs/reference/settings/
34+
settings:
35+
batch_idle_duration: "1s"
36+
batch_max_duration: "10s"
37+
# "additional_settings" allows for chart version-specific settings like featureGates
38+
additional_settings:
39+
featureGates:
40+
nodeRepair: false
41+
reservedCapacity: true
42+
spotToSpotConsolidation: true
43+
# The logging settings for the Karpenter controller
44+
logging:
45+
enabled: true
46+
level:
47+
controller: "info"
48+
global: "info"
49+
webhook: "error"

0 commit comments

Comments
 (0)