Skip to content

Commit

Permalink
Allow for HPA Autoscaling delay times to be configured in cluster.yaml (
Browse files Browse the repository at this point in the history
#10)

* Allow for HPA Autoscaling delay times to be configured in cluster.yaml
* Reformat
  • Loading branch information
Daniel Whelan authored Feb 6, 2018
1 parent 51808b8 commit 9adc47b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
28 changes: 15 additions & 13 deletions core/controlplane/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,21 @@ type Experimental struct {
AwsNodeLabels AwsNodeLabels `yaml:"awsNodeLabels"`
// When cluster-autoscaler support is enabled, not only controller nodes but this node pool is also given
// a node label and IAM permissions to run cluster-autoscaler
ClusterAutoscalerSupport model.ClusterAutoscalerSupport `yaml:"clusterAutoscalerSupport"`
TLSBootstrap TLSBootstrap `yaml:"tlsBootstrap"`
NodeAuthorizer NodeAuthorizer `yaml:"nodeAuthorizer"`
EphemeralImageStorage EphemeralImageStorage `yaml:"ephemeralImageStorage"`
Kube2IamSupport Kube2IamSupport `yaml:"kube2IamSupport,omitempty"`
KubeletOpts string `yaml:"kubeletOpts,omitempty"`
LoadBalancer LoadBalancer `yaml:"loadBalancer"`
TargetGroup TargetGroup `yaml:"targetGroup"`
NodeDrainer model.NodeDrainer `yaml:"nodeDrainer"`
Oidc model.Oidc `yaml:"oidc"`
DisableSecurityGroupIngress bool `yaml:"disableSecurityGroupIngress"`
NodeMonitorGracePeriod string `yaml:"nodeMonitorGracePeriod"`
model.UnknownKeys `yaml:",inline"`
ClusterAutoscalerSupport model.ClusterAutoscalerSupport `yaml:"clusterAutoscalerSupport"`
TLSBootstrap TLSBootstrap `yaml:"tlsBootstrap"`
NodeAuthorizer NodeAuthorizer `yaml:"nodeAuthorizer"`
EphemeralImageStorage EphemeralImageStorage `yaml:"ephemeralImageStorage"`
Kube2IamSupport Kube2IamSupport `yaml:"kube2IamSupport,omitempty"`
KubeletOpts string `yaml:"kubeletOpts,omitempty"`
LoadBalancer LoadBalancer `yaml:"loadBalancer"`
TargetGroup TargetGroup `yaml:"targetGroup"`
NodeDrainer model.NodeDrainer `yaml:"nodeDrainer"`
Oidc model.Oidc `yaml:"oidc"`
DisableSecurityGroupIngress bool `yaml:"disableSecurityGroupIngress"`
NodeMonitorGracePeriod string `yaml:"nodeMonitorGracePeriod"`
HorizontalPodAutoscalerDownscaleDelay string `yaml:"horizontalPodAutoscalerDownscaleDelay"`
HorizontalPodAutoscalerUpscaleDelay string `yaml:"horizontalPodAutoscalerUpscaleDelay"`
model.UnknownKeys `yaml:",inline"`
}

type Admission struct {
Expand Down
6 changes: 6 additions & 0 deletions core/controlplane/config/templates/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,12 @@ write_files:
{{if .Experimental.DisableSecurityGroupIngress}}
- --cloud-config=/etc/kubernetes/additional-configs/cloud.config
{{end}}
{{if .Experimental.HorizontalPodAutoscalerDownscaleDelay}}
- --horizontal-pod-autoscaler-downscale-delay={{ .Experimental.HorizontalPodAutoscalerDownscaleDelay }}
{{end}}
{{if .Experimental.HorizontalPodAutoscalerUpscaleDelay}}
- --horizontal-pod-autoscaler-upscale-delay={{ .Experimental.HorizontalPodAutoscalerUpscaleDelay }}
{{end}}
resources:
requests:
cpu: 200m
Expand Down
2 changes: 2 additions & 0 deletions core/controlplane/config/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,8 @@ experimental:
# This is the amount of time which we allow running Node to be unresponsive before marking it unhealthy.
# Must be N times more than kubelet's nodeStatusUpdateFrequency (default 10s).
# nodeMonitorGracePeriod: "40s"
# horizontalPodAutoscalerDownscaleDelay: "5m0s"
# horizontalPodAutoscalerUpscaleDelay: "3m0s"

kubelet:
# Tell Kubelet to renew its certificate as its expiration time is approaching
Expand Down
14 changes: 14 additions & 0 deletions docs/advanced-topics/hpa-scaling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# HPA Autoscaling

The controller-manager manages the autoscaling of pods across the cluster.
It uses the following parameters to manage the cooldown/delays.

- --horizontal-pod-autoscaler-downscale-delay (default 5m0s)
- --horizontal-pod-autoscaler-upscale-delay (default 3m0s)

For example if you want to override these values you can do the following:
```yaml
experimental:
horizontalPodAutoscalerDownscaleDelay: 1m0s
horizontalPodAutoscalerUpscaleDelay: 30s
```

0 comments on commit 9adc47b

Please sign in to comment.