From 7e37e5bd6ea8dd5876c1cf9ad7c3aa5c4ea83700 Mon Sep 17 00:00:00 2001 From: Michael Cristina Date: Thu, 10 Dec 2020 17:59:15 -0600 Subject: [PATCH] Reduce logging when creating placeholder instances --- .../cloudprovider/aws/auto_scaling_groups.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go b/cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go index 4915fe1b27aa..36b645ea7949 100644 --- a/cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go +++ b/cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go @@ -399,15 +399,15 @@ func (m *asgCache) regenerate() error { func (m *asgCache) createPlaceholdersForDesiredNonStartedInstances(groups []*autoscaling.Group) []*autoscaling.Group { for _, g := range groups { desired := *g.DesiredCapacity - real := int64(len(g.Instances)) - if desired <= real { + realInstances := int64(len(g.Instances)) + if desired <= realInstances { continue } - for i := real; i < desired; i++ { + klog.V(4).Infof("Instance group %s has only %d instances created while requested count is %d. "+ + "Creating placeholder instances.", *g.AutoScalingGroupName, realInstances, desired) + for i := realInstances; i < desired; i++ { id := fmt.Sprintf("%s-%s-%d", placeholderInstanceNamePrefix, *g.AutoScalingGroupName, i) - klog.V(4).Infof("Instance group %s has only %d instances created while requested count is %d. "+ - "Creating placeholder instance with ID %s.", *g.AutoScalingGroupName, real, desired, id) g.Instances = append(g.Instances, &autoscaling.Instance{ InstanceId: &id, AvailabilityZone: g.AvailabilityZones[0],