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
00e4e9b6
Unverified
Commit
00e4e9b6
authored
Sep 4, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Sep 4, 2019
Browse files
Options
Downloads
Plain Diff
Merge pull request #2294 from bskiba/vpa-release-0.5
Don't attempt to delete aggregation from VPA if it doesn't exist
parents
026ea0af
771906da
Loading
Loading
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
vertical-pod-autoscaler/pkg/recommender/model/vpa.go
+4
-1
4 additions, 1 deletion
vertical-pod-autoscaler/pkg/recommender/model/vpa.go
vertical-pod-autoscaler/pkg/recommender/model/vpa_test.go
+44
-0
44 additions, 0 deletions
vertical-pod-autoscaler/pkg/recommender/model/vpa_test.go
with
48 additions
and
1 deletion
vertical-pod-autoscaler/pkg/recommender/model/vpa.go
+
4
−
1
View file @
00e4e9b6
...
...
@@ -155,7 +155,10 @@ func (vpa *Vpa) UsesAggregation(aggregationKey AggregateStateKey) bool {
// DeleteAggregation deletes aggregation used by this container
func
(
vpa
*
Vpa
)
DeleteAggregation
(
aggregationKey
AggregateStateKey
)
{
state
:=
vpa
.
aggregateContainerStates
[
aggregationKey
]
state
,
ok
:=
vpa
.
aggregateContainerStates
[
aggregationKey
]
if
!
ok
{
return
}
state
.
MarkNotAutoscaled
()
delete
(
vpa
.
aggregateContainerStates
,
aggregationKey
)
}
...
...
This diff is collapsed.
Click to expand it.
vertical-pod-autoscaler/pkg/recommender/model/vpa_test.go
+
44
−
0
View file @
00e4e9b6
...
...
@@ -336,6 +336,50 @@ func TestUseAggregationIfMatching(t *testing.T) {
}
}
func
TestDeleteAggregation
(
t
*
testing
.
T
)
{
cases
:=
[]
struct
{
name
string
aggregateContainerStates
aggregateContainerStatesMap
delet
AggregateStateKey
}{
{
name
:
"delet dis"
,
aggregateContainerStates
:
aggregateContainerStatesMap
{
aggregateStateKey
{
namespace
:
"ns"
,
containerName
:
"container"
,
labelSetKey
:
"labelSetKey"
,
labelSetMap
:
nil
,
}
:
&
AggregateContainerState
{},
},
delet
:
aggregateStateKey
{
namespace
:
"ns"
,
containerName
:
"container"
,
labelSetKey
:
"labelSetKey"
,
labelSetMap
:
nil
,
},
},
{
name
:
"no delet"
,
delet
:
aggregateStateKey
{
namespace
:
"ns"
,
containerName
:
"container"
,
labelSetKey
:
"labelSetKey"
,
labelSetMap
:
nil
,
},
},
}
for
_
,
tc
:=
range
cases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
vpa
:=
Vpa
{
aggregateContainerStates
:
tc
.
aggregateContainerStates
,
}
vpa
.
DeleteAggregation
(
tc
.
delet
)
assert
.
Equal
(
t
,
0
,
len
(
vpa
.
aggregateContainerStates
))
})
}
}
type
mockAggregateStateKey
struct
{
namespace
string
containerName
string
...
...
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
sign in
to comment