Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
autoscaler
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
kubernetes
autoscaler
Commits
8d608ac0
Commit
8d608ac0
authored
3 years ago
by
David Morrison
Browse files
Options
Downloads
Patches
Plain Diff
check all scaling activities instead of just the last one
parent
aebd984e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go
+6
-5
6 additions, 5 deletions
cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go
cluster-autoscaler/cloudprovider/aws/auto_scaling_groups_test.go
+5
-5
5 additions, 5 deletions
...-autoscaler/cloudprovider/aws/auto_scaling_groups_test.go
with
11 additions
and
10 deletions
cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go
+
6
−
5
View file @
8d608ac0
...
@@ -67,7 +67,7 @@ type asg struct {
...
@@ -67,7 +67,7 @@ type asg struct {
minSize
int
minSize
int
maxSize
int
maxSize
int
curSize
int
curSize
int
lastUpdateTime
*
time
.
Time
lastUpdateTime
time
.
Time
AvailabilityZones
[]
string
AvailabilityZones
[]
string
LaunchConfigurationName
string
LaunchConfigurationName
string
...
@@ -254,7 +254,7 @@ func (m *asgCache) setAsgSizeNoLock(asg *asg, size int) error {
...
@@ -254,7 +254,7 @@ func (m *asgCache) setAsgSizeNoLock(asg *asg, size int) error {
}
}
// Proactively set the ASG size so autoscaler makes better decisions
// Proactively set the ASG size so autoscaler makes better decisions
asg
.
lastUpdateTime
=
&
start
asg
.
lastUpdateTime
=
start
asg
.
curSize
=
size
asg
.
curSize
=
size
return
nil
return
nil
...
@@ -489,12 +489,13 @@ func (m *asgCache) isNodeGroupAvailable(group *autoscaling.Group) (bool, error)
...
@@ -489,12 +489,13 @@ func (m *asgCache) isNodeGroupAvailable(group *autoscaling.Group) (bool, error)
return
true
,
err
// If we can't describe the scaling activities we assume the node group is available
return
true
,
err
// If we can't describe the scaling activities we assume the node group is available
}
}
if
len
(
response
.
Activities
)
>
0
{
for
_
,
activity
:=
range
response
.
Activities
{
activity
:=
response
.
Activities
[
0
]
asgRef
:=
AwsRef
{
Name
:
*
group
.
AutoScalingGroupName
}
asgRef
:=
AwsRef
{
Name
:
*
group
.
AutoScalingGroupName
}
if
a
,
ok
:=
m
.
registeredAsgs
[
asgRef
];
ok
{
if
a
,
ok
:=
m
.
registeredAsgs
[
asgRef
];
ok
{
lut
:=
a
.
lastUpdateTime
lut
:=
a
.
lastUpdateTime
if
lut
!=
nil
&&
activity
.
StartTime
.
After
(
*
lut
)
&&
*
activity
.
StatusCode
==
"Failed"
{
if
activity
.
StartTime
.
Before
(
lut
)
{
break
}
else
if
*
activity
.
StatusCode
==
"Failed"
{
return
false
,
nil
return
false
,
nil
}
}
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
cluster-autoscaler/cloudprovider/aws/auto_scaling_groups_test.go
+
5
−
5
View file @
8d608ac0
...
@@ -59,7 +59,7 @@ func TestCreatePlaceholders(t *testing.T) {
...
@@ -59,7 +59,7 @@ func TestCreatePlaceholders(t *testing.T) {
name
string
name
string
desiredCapacity
*
int64
desiredCapacity
*
int64
activities
[]
*
autoscaling
.
Activity
activities
[]
*
autoscaling
.
Activity
groupLastUpdateTime
*
time
.
Time
groupLastUpdateTime
time
.
Time
describeErr
error
describeErr
error
asgToCheck
*
string
asgToCheck
*
string
}{
}{
...
@@ -85,7 +85,7 @@ func TestCreatePlaceholders(t *testing.T) {
...
@@ -85,7 +85,7 @@ func TestCreatePlaceholders(t *testing.T) {
StartTime
:
aws
.
Time
(
time
.
Unix
(
10
,
0
)),
StartTime
:
aws
.
Time
(
time
.
Unix
(
10
,
0
)),
},
},
},
},
groupLastUpdateTime
:
aws
.
Time
(
time
.
Unix
(
9
,
0
)
)
,
groupLastUpdateTime
:
time
.
Unix
(
9
,
0
),
},
},
{
{
name
:
"AWS scaling failed event before CA scale_up"
,
name
:
"AWS scaling failed event before CA scale_up"
,
...
@@ -96,7 +96,7 @@ func TestCreatePlaceholders(t *testing.T) {
...
@@ -96,7 +96,7 @@ func TestCreatePlaceholders(t *testing.T) {
StartTime
:
aws
.
Time
(
time
.
Unix
(
9
,
0
)),
StartTime
:
aws
.
Time
(
time
.
Unix
(
9
,
0
)),
},
},
},
},
groupLastUpdateTime
:
aws
.
Time
(
time
.
Unix
(
10
,
0
)
)
,
groupLastUpdateTime
:
time
.
Unix
(
10
,
0
),
},
},
{
{
name
:
"asg not registered"
,
name
:
"asg not registered"
,
...
@@ -107,7 +107,7 @@ func TestCreatePlaceholders(t *testing.T) {
...
@@ -107,7 +107,7 @@ func TestCreatePlaceholders(t *testing.T) {
StartTime
:
aws
.
Time
(
time
.
Unix
(
10
,
0
)),
StartTime
:
aws
.
Time
(
time
.
Unix
(
10
,
0
)),
},
},
},
},
groupLastUpdateTime
:
aws
.
Time
(
time
.
Unix
(
9
,
0
)
)
,
groupLastUpdateTime
:
time
.
Unix
(
9
,
0
),
asgToCheck
:
aws
.
String
(
"unregisteredAsgName"
),
asgToCheck
:
aws
.
String
(
"unregisteredAsgName"
),
},
},
}
}
...
@@ -158,7 +158,7 @@ func TestCreatePlaceholders(t *testing.T) {
...
@@ -158,7 +158,7 @@ func TestCreatePlaceholders(t *testing.T) {
}
}
asgCache
.
createPlaceholdersForDesiredNonStartedInstances
(
groups
)
asgCache
.
createPlaceholdersForDesiredNonStartedInstances
(
groups
)
assert
.
Equal
(
t
,
int64
(
len
(
groups
[
0
]
.
Instances
)),
*
tc
.
desiredCapacity
)
assert
.
Equal
(
t
,
int64
(
len
(
groups
[
0
]
.
Instances
)),
*
tc
.
desiredCapacity
)
if
tc
.
activities
!=
nil
&&
*
tc
.
activities
[
0
]
.
StatusCode
==
"Failed"
&&
tc
.
activities
[
0
]
.
StartTime
.
After
(
*
tc
.
groupLastUpdateTime
)
&&
asgName
==
registeredAsgName
{
if
tc
.
activities
!=
nil
&&
*
tc
.
activities
[
0
]
.
StatusCode
==
"Failed"
&&
tc
.
activities
[
0
]
.
StartTime
.
After
(
tc
.
groupLastUpdateTime
)
&&
asgName
==
registeredAsgName
{
assert
.
Equal
(
t
,
*
groups
[
0
]
.
Instances
[
0
]
.
HealthStatus
,
placeholderUnfulfillableStatus
)
assert
.
Equal
(
t
,
*
groups
[
0
]
.
Instances
[
0
]
.
HealthStatus
,
placeholderUnfulfillableStatus
)
}
else
if
len
(
groups
[
0
]
.
Instances
)
>
0
{
}
else
if
len
(
groups
[
0
]
.
Instances
)
>
0
{
assert
.
Equal
(
t
,
*
groups
[
0
]
.
Instances
[
0
]
.
HealthStatus
,
""
)
assert
.
Equal
(
t
,
*
groups
[
0
]
.
Instances
[
0
]
.
HealthStatus
,
""
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment