Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
529135dd
Commit
529135dd
authored
May 21, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #25863 from ping035627/ping035627-patch-2
Automatic merge from submit-queue Fix the bug of the "removePod" function in node_info.go
parents
a385ee13
901011f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
node_info.go
plugin/pkg/scheduler/schedulercache/node_info.go
+8
-8
No files found.
plugin/pkg/scheduler/schedulercache/node_info.go
View file @
529135dd
...
@@ -132,13 +132,6 @@ func (n *NodeInfo) removePod(pod *api.Pod) error {
...
@@ -132,13 +132,6 @@ func (n *NodeInfo) removePod(pod *api.Pod) error {
return
err
return
err
}
}
cpu
,
mem
,
nvidia_gpu
,
non0_cpu
,
non0_mem
:=
calculateResource
(
pod
)
n
.
requestedResource
.
MilliCPU
-=
cpu
n
.
requestedResource
.
Memory
-=
mem
n
.
requestedResource
.
NvidiaGPU
-=
nvidia_gpu
n
.
nonzeroRequest
.
MilliCPU
-=
non0_cpu
n
.
nonzeroRequest
.
Memory
-=
non0_mem
for
i
:=
range
n
.
pods
{
for
i
:=
range
n
.
pods
{
k2
,
err
:=
getPodKey
(
n
.
pods
[
i
])
k2
,
err
:=
getPodKey
(
n
.
pods
[
i
])
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -149,10 +142,17 @@ func (n *NodeInfo) removePod(pod *api.Pod) error {
...
@@ -149,10 +142,17 @@ func (n *NodeInfo) removePod(pod *api.Pod) error {
// delete the element
// delete the element
n
.
pods
[
i
]
=
n
.
pods
[
len
(
n
.
pods
)
-
1
]
n
.
pods
[
i
]
=
n
.
pods
[
len
(
n
.
pods
)
-
1
]
n
.
pods
=
n
.
pods
[
:
len
(
n
.
pods
)
-
1
]
n
.
pods
=
n
.
pods
[
:
len
(
n
.
pods
)
-
1
]
// reduce the resource data
cpu
,
mem
,
nvidia_gpu
,
non0_cpu
,
non0_mem
:=
calculateResource
(
pod
)
n
.
requestedResource
.
MilliCPU
-=
cpu
n
.
requestedResource
.
Memory
-=
mem
n
.
requestedResource
.
NvidiaGPU
-=
nvidia_gpu
n
.
nonzeroRequest
.
MilliCPU
-=
non0_cpu
n
.
nonzeroRequest
.
Memory
-=
non0_mem
return
nil
return
nil
}
}
}
}
return
fmt
.
Errorf
(
"no corresponding pod
in pods"
)
return
fmt
.
Errorf
(
"no corresponding pod
%s in pods of node %s"
,
pod
.
Name
,
n
.
node
.
Name
)
}
}
func
calculateResource
(
pod
*
api
.
Pod
)
(
cpu
int64
,
mem
int64
,
nvidia_gpu
int64
,
non0_cpu
int64
,
non0_mem
int64
)
{
func
calculateResource
(
pod
*
api
.
Pod
)
(
cpu
int64
,
mem
int64
,
nvidia_gpu
int64
,
non0_cpu
int64
,
non0_mem
int64
)
{
...
...
Write
Preview
Markdown
is supported
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