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
c9b6e89a
Commit
c9b6e89a
authored
Apr 06, 2016
by
Saad Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23929 from mikedanese/pending-running-ds
only include running and pending pods in daemonset should place calculation
parents
a437b8c7
14284291
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
controller.go
pkg/controller/daemon/controller.go
+3
-0
controller_test.go
pkg/controller/daemon/controller_test.go
+29
-0
No files found.
pkg/controller/daemon/controller.go
View file @
c9b6e89a
...
...
@@ -674,6 +674,9 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *api.Node, ds *exte
if
pod
.
Spec
.
NodeName
!=
node
.
Name
{
continue
}
if
pod
.
Status
.
Phase
==
api
.
PodSucceeded
||
pod
.
Status
.
Phase
==
api
.
PodFailed
{
continue
}
// ignore pods that belong to the daemonset when taking into account wheter
// a daemonset should bind to a node.
if
pds
:=
dsc
.
getPodDaemonSet
(
pod
);
pds
!=
nil
&&
ds
.
Name
==
pds
.
Name
{
...
...
pkg/controller/daemon/controller_test.go
View file @
c9b6e89a
...
...
@@ -240,6 +240,35 @@ func TestInsufficentCapacityNodeDaemonDoesNotLaunchPod(t *testing.T) {
syncAndValidateDaemonSets
(
t
,
manager
,
ds
,
podControl
,
0
,
0
)
}
func
TestSufficentCapacityWithTerminatedPodsDaemonLaunchesPod
(
t
*
testing
.
T
)
{
podSpec
:=
api
.
PodSpec
{
NodeName
:
"too-much-mem"
,
Containers
:
[]
api
.
Container
{{
Resources
:
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
api
.
ResourceMemory
:
resource
.
MustParse
(
"75M"
),
api
.
ResourceCPU
:
resource
.
MustParse
(
"75m"
),
},
},
}},
}
manager
,
podControl
:=
newTestController
()
node
:=
newNode
(
"too-much-mem"
,
nil
)
node
.
Status
.
Allocatable
=
api
.
ResourceList
{
api
.
ResourceMemory
:
resource
.
MustParse
(
"100M"
),
api
.
ResourceCPU
:
resource
.
MustParse
(
"200m"
),
}
manager
.
nodeStore
.
Add
(
node
)
manager
.
podStore
.
Add
(
&
api
.
Pod
{
Spec
:
podSpec
,
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodSucceeded
},
})
ds
:=
newDaemonSet
(
"foo"
)
ds
.
Spec
.
Template
.
Spec
=
podSpec
manager
.
dsStore
.
Add
(
ds
)
syncAndValidateDaemonSets
(
t
,
manager
,
ds
,
podControl
,
1
,
0
)
}
// DaemonSets should place onto nodes with sufficient free resource
func
TestSufficentCapacityNodeDaemonLaunchesPod
(
t
*
testing
.
T
)
{
podSpec
:=
api
.
PodSpec
{
...
...
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