Support setting cluster-autoscaler's skip-nodes-with-custom-controller-pods parameter

This commit is contained in:
shapirus 2023-10-25 12:27:49 +03:00
parent 419b93b9e9
commit dd665fbe1e
21 changed files with 49 additions and 0 deletions

View File

@ -73,6 +73,7 @@ spec:
balanceSimilarNodeGroups: false
awsUseStaticInstanceList: false
scaleDownUtilizationThreshold: 0.5
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
newPodScaleUpDelay: 0s

View File

@ -780,6 +780,11 @@ spec:
description: 'ScaleDownUtilizationThreshold determines the utilization
threshold for node scale-down. Default: 0.5'
type: string
skipNodesWithCustomControllerPods:
description: 'SkipNodesWithCustomControllerPods makes the cluster
autoscaler skip scale-down of nodes with pods owned by custom
controllers. Default: true'
type: boolean
skipNodesWithLocalStorage:
description: 'SkipNodesWithLocalStorage makes the cluster autoscaler
skip scale-down of nodes with local storage. Default: true'

View File

@ -1028,6 +1028,9 @@ type ClusterAutoscalerConfig struct {
// ScaleDownUtilizationThreshold determines the utilization threshold for node scale-down.
// Default: 0.5
ScaleDownUtilizationThreshold *string `json:"scaleDownUtilizationThreshold,omitempty"`
// SkipNodesWithCustomControllerPods makes the cluster autoscaler skip scale-down of nodes with pods owned by custom controllers.
// Default: true
SkipNodesWithCustomControllerPods *bool `json:"skipNodesWithCustomControllerPods,omitempty"`
// SkipNodesWithSystemPods makes the cluster autoscaler skip scale-down of nodes with non-DaemonSet pods in the kube-system namespace.
// Default: true
SkipNodesWithSystemPods *bool `json:"skipNodesWithSystemPods,omitempty"`

View File

@ -1091,6 +1091,9 @@ type ClusterAutoscalerConfig struct {
// ScaleDownUtilizationThreshold determines the utilization threshold for node scale-down.
// Default: 0.5
ScaleDownUtilizationThreshold *string `json:"scaleDownUtilizationThreshold,omitempty"`
// SkipNodesWithCustomControllerPods makes the cluster autoscaler skip scale-down of nodes with pods owned by custom controllers.
// Default: true
SkipNodesWithCustomControllerPods *bool `json:"skipNodesWithCustomControllerPods,omitempty"`
// SkipNodesWithSystemPods makes the cluster autoscaler skip scale-down of nodes with non-DaemonSet pods in the kube-system namespace.
// Default: true
SkipNodesWithSystemPods *bool `json:"skipNodesWithSystemPods,omitempty"`

View File

@ -2308,6 +2308,7 @@ func autoConvert_v1alpha2_ClusterAutoscalerConfig_To_kops_ClusterAutoscalerConfi
out.AWSUseStaticInstanceList = in.AWSUseStaticInstanceList
out.IgnoreDaemonSetsUtilization = in.IgnoreDaemonSetsUtilization
out.ScaleDownUtilizationThreshold = in.ScaleDownUtilizationThreshold
out.SkipNodesWithCustomControllerPods = in.SkipNodesWithCustomControllerPods
out.SkipNodesWithSystemPods = in.SkipNodesWithSystemPods
out.SkipNodesWithLocalStorage = in.SkipNodesWithLocalStorage
out.NewPodScaleUpDelay = in.NewPodScaleUpDelay
@ -2337,6 +2338,7 @@ func autoConvert_kops_ClusterAutoscalerConfig_To_v1alpha2_ClusterAutoscalerConfi
out.AWSUseStaticInstanceList = in.AWSUseStaticInstanceList
out.IgnoreDaemonSetsUtilization = in.IgnoreDaemonSetsUtilization
out.ScaleDownUtilizationThreshold = in.ScaleDownUtilizationThreshold
out.SkipNodesWithCustomControllerPods = in.SkipNodesWithCustomControllerPods
out.SkipNodesWithSystemPods = in.SkipNodesWithSystemPods
out.SkipNodesWithLocalStorage = in.SkipNodesWithLocalStorage
out.NewPodScaleUpDelay = in.NewPodScaleUpDelay

View File

@ -938,6 +938,11 @@ func (in *ClusterAutoscalerConfig) DeepCopyInto(out *ClusterAutoscalerConfig) {
*out = new(string)
**out = **in
}
if in.SkipNodesWithCustomControllerPods != nil {
in, out := &in.SkipNodesWithCustomControllerPods, &out.SkipNodesWithCustomControllerPods
*out = new(bool)
**out = **in
}
if in.SkipNodesWithSystemPods != nil {
in, out := &in.SkipNodesWithSystemPods, &out.SkipNodesWithSystemPods
*out = new(bool)

View File

@ -1020,6 +1020,9 @@ type ClusterAutoscalerConfig struct {
// ScaleDownUtilizationThreshold determines the utilization threshold for node scale-down.
// Default: 0.5
ScaleDownUtilizationThreshold *string `json:"scaleDownUtilizationThreshold,omitempty"`
// SkipNodesWithCustomControllerPods makes the cluster autoscaler skip scale-down of nodes with pods owned by custom controllers.
// Default: true
SkipNodesWithCustomControllerPods *bool `json:"skipNodesWithCustomControllerPods,omitempty"`
// SkipNodesWithSystemPods makes the cluster autoscaler skip scale-down of nodes with non-DaemonSet pods in the kube-system namespace.
// Default: true
SkipNodesWithSystemPods *bool `json:"skipNodesWithSystemPods,omitempty"`

View File

@ -2554,6 +2554,7 @@ func autoConvert_v1alpha3_ClusterAutoscalerConfig_To_kops_ClusterAutoscalerConfi
out.AWSUseStaticInstanceList = in.AWSUseStaticInstanceList
out.IgnoreDaemonSetsUtilization = in.IgnoreDaemonSetsUtilization
out.ScaleDownUtilizationThreshold = in.ScaleDownUtilizationThreshold
out.SkipNodesWithCustomControllerPods = in.SkipNodesWithCustomControllerPods
out.SkipNodesWithSystemPods = in.SkipNodesWithSystemPods
out.SkipNodesWithLocalStorage = in.SkipNodesWithLocalStorage
out.NewPodScaleUpDelay = in.NewPodScaleUpDelay
@ -2583,6 +2584,7 @@ func autoConvert_kops_ClusterAutoscalerConfig_To_v1alpha3_ClusterAutoscalerConfi
out.AWSUseStaticInstanceList = in.AWSUseStaticInstanceList
out.IgnoreDaemonSetsUtilization = in.IgnoreDaemonSetsUtilization
out.ScaleDownUtilizationThreshold = in.ScaleDownUtilizationThreshold
out.SkipNodesWithCustomControllerPods = in.SkipNodesWithCustomControllerPods
out.SkipNodesWithSystemPods = in.SkipNodesWithSystemPods
out.SkipNodesWithLocalStorage = in.SkipNodesWithLocalStorage
out.NewPodScaleUpDelay = in.NewPodScaleUpDelay

View File

@ -900,6 +900,11 @@ func (in *ClusterAutoscalerConfig) DeepCopyInto(out *ClusterAutoscalerConfig) {
*out = new(string)
**out = **in
}
if in.SkipNodesWithCustomControllerPods != nil {
in, out := &in.SkipNodesWithCustomControllerPods, &out.SkipNodesWithCustomControllerPods
*out = new(bool)
**out = **in
}
if in.SkipNodesWithSystemPods != nil {
in, out := &in.SkipNodesWithSystemPods, &out.SkipNodesWithSystemPods
*out = new(bool)

View File

@ -997,6 +997,11 @@ func (in *ClusterAutoscalerConfig) DeepCopyInto(out *ClusterAutoscalerConfig) {
*out = new(string)
**out = **in
}
if in.SkipNodesWithCustomControllerPods != nil {
in, out := &in.SkipNodesWithCustomControllerPods, &out.SkipNodesWithCustomControllerPods
*out = new(bool)
**out = **in
}
if in.SkipNodesWithSystemPods != nil {
in, out := &in.SkipNodesWithSystemPods, &out.SkipNodesWithSystemPods
*out = new(bool)

View File

@ -69,6 +69,9 @@ func (b *ClusterAutoscalerOptionsBuilder) BuildOptions(o interface{}) error {
if cas.ScaleDownUtilizationThreshold == nil {
cas.ScaleDownUtilizationThreshold = fi.PtrTo("0.5")
}
if cas.SkipNodesWithCustomControllerPods == nil {
cas.SkipNodesWithCustomControllerPods = fi.PtrTo(true)
}
if cas.SkipNodesWithLocalStorage == nil {
cas.SkipNodesWithLocalStorage = fi.PtrTo(true)
}

View File

@ -44,6 +44,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -37,6 +37,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -40,6 +40,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -41,6 +41,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -40,6 +40,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -40,6 +40,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -40,6 +40,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -41,6 +41,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -41,6 +41,7 @@ spec:
scaleDownUnneededTime: 10m0s
scaleDownUnreadyTime: 20m0s
scaleDownUtilizationThreshold: "0.5"
skipNodesWithCustomControllerPods: true
skipNodesWithLocalStorage: true
skipNodesWithSystemPods: true
clusterDNSDomain: cluster.local

View File

@ -344,6 +344,9 @@ spec:
{{ end }}
- --ignore-daemonsets-utilization={{ .IgnoreDaemonSetsUtilization }}
- --scale-down-utilization-threshold={{ .ScaleDownUtilizationThreshold }}
{{ if IsKubernetesGTE "1.27.0" }}
- --skip-nodes-with-custom-controller-pods={{ .SkipNodesWithCustomControllerPods }}
{{ end }}
- --skip-nodes-with-local-storage={{ .SkipNodesWithLocalStorage }}
- --skip-nodes-with-system-pods={{ .SkipNodesWithSystemPods }}
- --scale-down-delay-after-add={{ .ScaleDownDelayAfterAdd }}