Skip to content

Commit

Permalink
[tf/helm] defaults for scaling config
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin authored and aptos-bot committed May 5, 2022
1 parent 768f544 commit 23996a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions terraform/helm/k8s-metrics/templates/autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ spec:
- --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/{{ .Values.autoscaler.clusterName }}
- --balance-similar-node-groups
- --skip-nodes-with-system-pods=false
- --scale-down-unneeded-time={{ .Values.autoscaler.scaleDownUnneededTime }}
- --scale-down-delay-after-add={{ .Values.autoscaler.scaleDownDelayAfterAdd }}
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs/ca-certificates.crt #/etc/ssl/certs/ca-bundle.crt for Amazon Linux Worker Nodes
Expand Down
2 changes: 2 additions & 0 deletions terraform/helm/k8s-metrics/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ coredns:
autoscaler:
enabled:
clusterName:
scaleDownUnneededTime: 15m
scaleDownDelayAfterAdd: 5m
image:
repo: k8s.gcr.io/autoscaling/cluster-autoscaler
tag: v1.21.0
Expand Down
8 changes: 7 additions & 1 deletion terraform/validator/aws/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ resource "aws_launch_template" "nodes" {
for_each = local.pools
name = "aptos-${local.workspace_name}/${each.key}"
instance_type = each.value.instance_type
user_data = base64encode(
user_data = base64encode(
templatefile("${path.module}/templates/eks_user_data.sh", {
taints = each.value.taint ? "aptos.org/nodepool=${each.key}:NoExecute" : ""
})
Expand All @@ -71,6 +71,12 @@ resource "aws_eks_node_group" "nodes" {
subnet_ids = [aws_subnet.private[0].id]
tags = local.default_tags

lifecycle {
ignore_changes = [
scaling_config[0].desired_size
]
}

launch_template {
id = aws_launch_template.nodes[each.key].id
version = aws_launch_template.nodes[each.key].latest_version
Expand Down

0 comments on commit 23996a1

Please sign in to comment.