Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Crane
Commits
7d8cb3d0
Commit
7d8cb3d0
authored
3 years ago
by
zounengren
Browse files
Options
Download
Email Patches
Plain Diff
using map instead
Signed-off-by:
zounengren
<
zouyee1989@gmail.com
>
parent
abdb63c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/controller/evpa/container_policy.go
+3
-1
pkg/controller/evpa/container_policy.go
with
3 additions
and
1 deletion
+3
-1
pkg/controller/evpa/container_policy.go
+
3
-
1
View file @
7d8cb3d0
...
...
@@ -29,6 +29,7 @@ func (c *EffectiveVPAController) ReconcileContainerPolicies(evpa *autoscalingapi
rankedEstimators
:=
RankEstimators
(
resourceEstimators
)
needReconciledContainers
:=
make
(
map
[
string
]
autoscalingapi
.
ContainerResourcePolicy
)
containerResourceRequirement
:=
make
(
map
[
string
]
*
corev1
.
ResourceRequirements
)
for
_
,
container
:=
range
podTemplate
.
Spec
.
Containers
{
for
_
,
containerPolicy
:=
range
evpa
.
Spec
.
ResourcePolicy
.
ContainerPolicies
{
if
containerPolicy
.
ContainerName
==
"*"
||
containerPolicy
.
ContainerName
==
container
.
Name
{
...
...
@@ -37,10 +38,11 @@ func (c *EffectiveVPAController) ReconcileContainerPolicies(evpa *autoscalingapi
needReconciledContainers
[
container
.
Name
]
=
*
out
}
}
containerResourceRequirement
[
container
.
Name
]
=
&
container
.
Resources
}
for
container
,
containerPolicy
:=
range
needReconciledContainers
{
// get current resource by pod template
resourceRequirement
,
found
:=
utils
.
GetResourceByPodTemplate
(
podTemplate
,
container
)
resourceRequirement
,
found
:=
containerResourceRequirement
[
container
]
if
!
found
{
klog
.
Warningf
(
"ContainerName %s not found"
,
containerPolicy
.
ContainerName
)
continue
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help