Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 99cfc47

Browse files
Luke Humphreysdavidmccormick
Luke Humphreys
authored andcommitted
Make cluster-autoscaler resource request/limit configurable (#1556)
* make cluster autoscaler configurable * Making autoscaler configurable * Removing code that isn't required
1 parent 4f36c14 commit 99cfc47

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

core/controlplane/config/templates/cloud-config-controller

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,11 +4143,11 @@ write_files:
41434143
name: cluster-autoscaler
41444144
resources:
41454145
limits:
4146-
cpu: 100m
4147-
memory: 300Mi
4146+
cpu: {{ if .Addons.ClusterAutoscaler.ComputeResources.Limits.Cpu }}{{ .Addons.ClusterAutoscaler.ComputeResources.Limits.Cpu }}{{ else }}100m{{ end }}
4147+
memory: {{ if .Addons.ClusterAutoscaler.ComputeResources.Limits.Memory }}{{ .Addons.ClusterAutoscaler.ComputeResources.Limits.Memory }}{{ else }}300Mi{{ end }}
41484148
requests:
4149-
cpu: 100m
4150-
memory: 300Mi
4149+
cpu: {{ if .Addons.ClusterAutoscaler.ComputeResources.Requests.Cpu }}{{ .Addons.ClusterAutoscaler.ComputeResources.Requests.Cpu }}{{ else }}100m{{ end }}
4150+
memory: {{ if .Addons.ClusterAutoscaler.ComputeResources.Requests.Memory }}{{ .Addons.ClusterAutoscaler.ComputeResources.Requests.Memory }}{{ else }}300Mi{{ end }}
41514151
command:
41524152
- ./cluster-autoscaler
41534153
- --v=4

core/root/config/templates/cluster.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,14 @@ addons:
13521352
# If you want to run CA on worker nodes, turn on `worker.nodePools[].clusterAutoscalerSupport.enabled` for the node pool.
13531353
clusterAutoscaler:
13541354
enabled: false
1355+
resources:
1356+
# Increase these values substantially if running a cluster of 50+ nodes
1357+
limits:
1358+
cpu: 100m
1359+
memory: 300Mi
1360+
requests:
1361+
cpu: 100m
1362+
memory: 300Mi
13551363
# Options below can be used to inject custom settings for the autoscaler.
13561364
# Sensible defaults are already configured in the controller-cloud-config but if you wish to override them simply
13571365
# add them here and they'll take precedence.

model/addons.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ type Addons struct {
1010
}
1111

1212
type ClusterAutoscalerSupport struct {
13-
Enabled bool `yaml:"enabled"`
14-
Options map[string]string `yaml:"options"`
15-
UnknownKeys `yaml:",inline"`
13+
Enabled bool `yaml:"enabled"`
14+
ComputeResources ComputeResources `yaml:"resources,omitempty"`
15+
Options map[string]string `yaml:"options"`
16+
UnknownKeys `yaml:",inline"`
1617
}
1718

1819
type Rescheduler struct {
@@ -33,3 +34,13 @@ type Prometheus struct {
3334
type APIServerAggregator struct {
3435
Enabled bool `yaml:"enabled"`
3536
}
37+
38+
type ComputeResources struct {
39+
Limits ResourceQuota `yaml:"limits,omitempty"`
40+
Requests ResourceQuota `yaml:"requests,omitempty"`
41+
}
42+
43+
type ResourceQuota struct {
44+
Cpu string `yaml:"cpu"`
45+
Memory string `yaml:"memory"`
46+
}

test/integration/maincluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ experimental:
16421642
image:
16431643
repo: quay.io/uswitch/kiam
16441644
tag: v2.6
1645-
sessionDuration: 30m
1645+
sessionDuration: 30m
16461646
serverAddresses:
16471647
serverAddress: localhost
16481648
agentAddress: kiam-server

0 commit comments

Comments
 (0)