Skip to content

Commit b6fbc65

Browse files
committed
scale kube_aws_iam_controller VPA dynamically
1. Replaces `memory_max` config-item with `memory` and sets the default to a reasonable 50Mi. 2. Adds dynamic scaling relative to master instance size for `maxAllowed` in the VPA.
1 parent 4c9a67b commit b6fbc65

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cluster/config-defaults.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ metrics_service_mem_max: "4Gi"
417417
metrics_server_metric_resolution: "15s"
418418

419419
kube_aws_iam_controller_cpu: "5m"
420-
kube_aws_iam_controller_mem_max: "1Gi"
420+
kube_aws_iam_controller_mem: "50Mi"
421421

422422
kube_state_metrics_cpu: "100m"
423423
kube_state_metrics_mem_max: "4Gi"

cluster/manifests/02-kube-aws-iam-controller/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ spec:
3434
resources:
3535
limits:
3636
cpu: "{{.Cluster.ConfigItems.kube_aws_iam_controller_cpu}}"
37-
memory: "{{.Cluster.ConfigItems.kube_aws_iam_controller_mem_max}}"
37+
memory: "{{.Cluster.ConfigItems.kube_aws_iam_controller_mem}}"
3838
requests:
3939
cpu: "{{.Cluster.ConfigItems.kube_aws_iam_controller_cpu}}"
40-
memory: "{{.Cluster.ConfigItems.kube_aws_iam_controller_mem_max}}"
40+
memory: "{{.Cluster.ConfigItems.kube_aws_iam_controller_mem}}"
4141
tolerations:
4242
- key: node.kubernetes.io/role
4343
value: master

cluster/manifests/02-kube-aws-iam-controller/vpa.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ spec:
1717
containerPolicies:
1818
- containerName: kube-aws-iam-controller
1919
maxAllowed:
20-
memory: {{.Cluster.ConfigItems.kube_aws_iam_controller_mem_max}}
20+
{{ range $NodePool := .Cluster.NodePools }}
21+
{{ if eq $NodePool.name "default-master" }}
22+
# Scaling is relative to r6g.large (smallest master node)
23+
# 0.014 -> 25m CPU, 0.003 -> 50Mi memory
24+
cpu: {{ scaleQuantity ( instanceTypeCPU ( index .InstanceTypes 0 )) 0.014 }}
25+
memory: {{ scaleQuantity ( instanceTypeMemory ( index .InstanceTypes 0 )) 0.003 }}
26+
{{ end }}
27+
{{ end }}

0 commit comments

Comments
 (0)