Add support for cluster autoscaler 1.20.x

Update upup/models/cloudup/resources/addons/cluster-autoscaler.addons.k8s.io/k8s-1.15.yaml.template

Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
This commit is contained in:
Ole Markus With 2021-02-17 09:09:45 +01:00
parent dbd503f4c6
commit 8486650c33
10 changed files with 38 additions and 5 deletions

View File

@ -25,7 +25,7 @@ spec:
Read more in the [official documentation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/).
#### Cluster autoscaler
{{ kops_feature_table(kops_added_default='1.19', k8s_min='1.15') }}
{{ kops_feature_table(kops_added_default='1.19') }}
Cluster autoscaler can be enabled to automatically adjust the size of the kubernetes cluster.
@ -41,6 +41,15 @@ spec:
Read more about cluster autoscaler in the [official documentation](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler).
##### Disabling cluster autoscaler for a given instance group
{{ kops_feature_table(kops_added_default='1.20') }}
You can disable the autoscaler for a given instance group by adding the following to the instance group spec.
```yaml
spec:
autoscale: false
```
#### Cert-manager
{{ kops_feature_table(kops_added_default='1.20', k8s_min='1.16') }}

View File

@ -87,6 +87,10 @@ spec:
description: AssociatePublicIP is true if we want instances to have
a public IP
type: boolean
autoscale:
description: Autoscale determines if autoscaling will be enabled for
the group if cluster autoscaler is enabled
type: boolean
cloudLabels:
additionalProperties:
type: string

View File

@ -92,6 +92,8 @@ type InstanceGroupSpec struct {
MinSize *int32 `json:"minSize,omitempty"`
// MaxSize is the maximum size of the pool
MaxSize *int32 `json:"maxSize,omitempty"`
// Autoscale determines if autoscaling will be enabled for the group if cluster autoscaler is enabled
Autoscale *bool `json:"autoscale,omitempty"`
// MachineType is the instance class
MachineType string `json:"machineType,omitempty"`
// RootVolumeSize is the size of the EBS root volume to use, in GB

View File

@ -89,6 +89,8 @@ type InstanceGroupSpec struct {
MinSize *int32 `json:"minSize,omitempty"`
// MaxSize is the maximum size of the pool
MaxSize *int32 `json:"maxSize,omitempty"`
// Autoscale determines if autoscaling will be enabled for the group if cluster autoscaler is enabled
Autoscale *bool `json:"autoscale,omitempty"`
// MachineType is the instance class
MachineType string `json:"machineType,omitempty"`
// RootVolumeSize is the size of the EBS root volume to use, in GB

View File

@ -3813,6 +3813,7 @@ func autoConvert_v1alpha2_InstanceGroupSpec_To_kops_InstanceGroupSpec(in *Instan
out.Image = in.Image
out.MinSize = in.MinSize
out.MaxSize = in.MaxSize
out.Autoscale = in.Autoscale
out.MachineType = in.MachineType
out.RootVolumeSize = in.RootVolumeSize
out.RootVolumeType = in.RootVolumeType
@ -3963,6 +3964,7 @@ func autoConvert_kops_InstanceGroupSpec_To_v1alpha2_InstanceGroupSpec(in *kops.I
out.Image = in.Image
out.MinSize = in.MinSize
out.MaxSize = in.MaxSize
out.Autoscale = in.Autoscale
out.MachineType = in.MachineType
out.RootVolumeSize = in.RootVolumeSize
out.RootVolumeType = in.RootVolumeType

View File

@ -1975,6 +1975,11 @@ func (in *InstanceGroupSpec) DeepCopyInto(out *InstanceGroupSpec) {
*out = new(int32)
**out = **in
}
if in.Autoscale != nil {
in, out := &in.Autoscale, &out.Autoscale
*out = new(bool)
**out = **in
}
if in.RootVolumeSize != nil {
in, out := &in.RootVolumeSize, &out.RootVolumeSize
*out = new(int32)

View File

@ -2141,6 +2141,11 @@ func (in *InstanceGroupSpec) DeepCopyInto(out *InstanceGroupSpec) {
*out = new(int32)
**out = **in
}
if in.Autoscale != nil {
in, out := &in.Autoscale, &out.Autoscale
*out = new(bool)
**out = **in
}
if in.RootVolumeSize != nil {
in, out := &in.RootVolumeSize, &out.RootVolumeSize
*out = new(int32)

View File

@ -43,6 +43,8 @@ func (b *ClusterAutoscalerOptionsBuilder) BuildOptions(o interface{}) error {
v, err := util.ParseKubernetesVersion(clusterSpec.KubernetesVersion)
if err == nil {
switch v.Minor {
case 20:
image = "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.20.0"
case 19:
image = "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.19.1"
case 18:

View File

@ -28285,7 +28285,7 @@ func cloudupResourcesAddonsCertmanagerIoK8s116YamlTemplate() (*asset, error) {
}
var _cloudupResourcesAddonsClusterAutoscalerAddonsK8sIoK8s115YamlTemplate = []byte(`{{ with .ClusterAutoscaler }}
# Sourced from https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/cloudprovider/aws/examples
# Sourced from https://github.com/kubernetes/autoscaler/blob/cluster-autoscaler-release-1.20/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-multi-asg.yaml
---
apiVersion: v1
kind: ServiceAccount
@ -28421,7 +28421,6 @@ spec:
labels:
app: cluster-autoscaler
annotations:
prometheus.io/path: "/metrics"
prometheus.io/port: "8085"
prometheus.io/scrape: "true"
spec:
@ -28444,8 +28443,10 @@ spec:
- --cloud-provider={{ $.CloudProvider }}
- --expander={{ .Expander }}
{{ range $name, $spec := GetNodeInstanceGroups }}
{{ if WithDefaultBool $spec.Autoscale true }}
- --nodes={{ $spec.MinSize }}:{{ $spec.MaxSize }}:{{ $name }}.{{ ClusterName }}
{{ end }}
{{ end }}
- --scale-down-utilization-threshold={{ .ScaleDownUtilizationThreshold }}
- --skip-nodes-with-local-storage={{ .SkipNodesWithLocalStorage }}
- --skip-nodes-with-system-pods={{ .SkipNodesWithSystemPods }}

View File

@ -1,5 +1,5 @@
{{ with .ClusterAutoscaler }}
# Sourced from https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/cloudprovider/aws/examples
# Sourced from https://github.com/kubernetes/autoscaler/blob/cluster-autoscaler-release-1.20/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-multi-asg.yaml
---
apiVersion: v1
kind: ServiceAccount
@ -135,7 +135,6 @@ spec:
labels:
app: cluster-autoscaler
annotations:
prometheus.io/path: "/metrics"
prometheus.io/port: "8085"
prometheus.io/scrape: "true"
spec:
@ -158,8 +157,10 @@ spec:
- --cloud-provider={{ $.CloudProvider }}
- --expander={{ .Expander }}
{{ range $name, $spec := GetNodeInstanceGroups }}
{{ if WithDefaultBool $spec.Autoscale true }}
- --nodes={{ $spec.MinSize }}:{{ $spec.MaxSize }}:{{ $name }}.{{ ClusterName }}
{{ end }}
{{ end }}
- --scale-down-utilization-threshold={{ .ScaleDownUtilizationThreshold }}
- --skip-nodes-with-local-storage={{ .SkipNodesWithLocalStorage }}
- --skip-nodes-with-system-pods={{ .SkipNodesWithSystemPods }}