Update node group min/max on cloud provider refresh
This commit is contained in:
parent
f5c2ab7328
commit
3ac32b817c
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/estimator"
|
"k8s.io/autoscaler/cluster-autoscaler/estimator"
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/expander"
|
"k8s.io/autoscaler/cluster-autoscaler/expander"
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/expander/factory"
|
"k8s.io/autoscaler/cluster-autoscaler/expander/factory"
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/metrics"
|
|
||||||
ca_processors "k8s.io/autoscaler/cluster-autoscaler/processors"
|
ca_processors "k8s.io/autoscaler/cluster-autoscaler/processors"
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/simulator"
|
"k8s.io/autoscaler/cluster-autoscaler/simulator"
|
||||||
"k8s.io/autoscaler/cluster-autoscaler/utils/backoff"
|
"k8s.io/autoscaler/cluster-autoscaler/utils/backoff"
|
||||||
|
|
@ -67,13 +66,6 @@ func NewAutoscaler(opts AutoscalerOptions) (Autoscaler, errors.AutoscalerError)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ToAutoscalerError(errors.InternalError, err)
|
return nil, errors.ToAutoscalerError(errors.InternalError, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// These metrics should be published only once.
|
|
||||||
for _, nodeGroup := range opts.CloudProvider.NodeGroups() {
|
|
||||||
metrics.UpdateNodeGroupMin(nodeGroup.Id(), nodeGroup.MinSize())
|
|
||||||
metrics.UpdateNodeGroupMax(nodeGroup.Id(), nodeGroup.MaxSize())
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewStaticAutoscaler(
|
return NewStaticAutoscaler(
|
||||||
opts.AutoscalingOptions,
|
opts.AutoscalingOptions,
|
||||||
opts.PredicateChecker,
|
opts.PredicateChecker,
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,12 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
|
||||||
return errors.ToAutoscalerError(errors.CloudProviderError, err)
|
return errors.ToAutoscalerError(errors.CloudProviderError, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update node groups min/max after cloud provider refresh
|
||||||
|
for _, nodeGroup := range a.AutoscalingContext.CloudProvider.NodeGroups() {
|
||||||
|
metrics.UpdateNodeGroupMin(nodeGroup.Id(), nodeGroup.MinSize())
|
||||||
|
metrics.UpdateNodeGroupMax(nodeGroup.Id(), nodeGroup.MaxSize())
|
||||||
|
}
|
||||||
|
|
||||||
nonExpendableScheduledPods := core_utils.FilterOutExpendablePods(originalScheduledPods, a.ExpendablePodsPriorityCutoff)
|
nonExpendableScheduledPods := core_utils.FilterOutExpendablePods(originalScheduledPods, a.ExpendablePodsPriorityCutoff)
|
||||||
// Initialize cluster state to ClusterSnapshot
|
// Initialize cluster state to ClusterSnapshot
|
||||||
if typedErr := a.initializeClusterSnapshot(allNodes, nonExpendableScheduledPods); typedErr != nil {
|
if typedErr := a.initializeClusterSnapshot(allNodes, nonExpendableScheduledPods); typedErr != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue