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
9060fc6e
Commit
9060fc6e
authored
Oct 01, 2018
by
Chris O'Haver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add opt to track dns pods
parent
e9a3aaa4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
framework.go
test/e2e/framework/framework.go
+12
-2
resource_usage_gatherer.go
test/e2e/framework/resource_usage_gatherer.go
+21
-3
nvidia-gpus.go
test/e2e/scheduling/nvidia-gpus.go
+1
-1
No files found.
test/e2e/framework/framework.go
View file @
9060fc6e
...
...
@@ -251,9 +251,19 @@ func (f *Framework) BeforeEach() {
if
TestContext
.
GatherKubeSystemResourceUsageData
!=
"false"
&&
TestContext
.
GatherKubeSystemResourceUsageData
!=
"none"
{
var
err
error
var
nodeMode
NodesSet
switch
TestContext
.
GatherKubeSystemResourceUsageData
{
case
"master"
:
nodeMode
=
MasterNodes
case
"masteranddns"
:
nodeMode
=
MasterAndDNSNodes
default
:
nodeMode
=
AllNodes
}
f
.
gatherer
,
err
=
NewResourceUsageGatherer
(
f
.
ClientSet
,
ResourceGathererOptions
{
InKubemark
:
ProviderIs
(
"kubemark"
),
MasterOnly
:
TestContext
.
GatherKubeSystemResourceUsageData
==
"master"
,
InKubemark
:
ProviderIs
(
"kubemark"
),
Nodes
:
nodeMode
,
ResourceDataGatheringPeriod
:
60
*
time
.
Second
,
ProbeDuration
:
15
*
time
.
Second
,
PrintVerboseLogs
:
false
,
...
...
test/e2e/framework/resource_usage_gatherer.go
View file @
9060fc6e
...
...
@@ -202,12 +202,20 @@ type ContainerResourceGatherer struct {
type
ResourceGathererOptions
struct
{
InKubemark
bool
MasterOnly
bool
Nodes
NodesSet
ResourceDataGatheringPeriod
time
.
Duration
ProbeDuration
time
.
Duration
PrintVerboseLogs
bool
}
type
NodesSet
int
const
(
AllNodes
NodesSet
=
0
// All containers on all nodes
MasterNodes
NodesSet
=
1
// All containers on Master nodes only
MasterAndDNSNodes
NodesSet
=
2
// All containers on Master nodes and DNS containers on other nodes
)
func
NewResourceUsageGatherer
(
c
clientset
.
Interface
,
options
ResourceGathererOptions
,
pods
*
v1
.
PodList
)
(
*
ContainerResourceGatherer
,
error
)
{
g
:=
ContainerResourceGatherer
{
client
:
c
,
...
...
@@ -237,13 +245,23 @@ func NewResourceUsageGatherer(c clientset.Interface, options ResourceGathererOpt
return
nil
,
err
}
}
dnsNodes
:=
make
(
map
[
string
]
bool
)
for
_
,
pod
:=
range
pods
.
Items
{
if
(
options
.
Nodes
==
MasterNodes
)
&&
!
system
.
IsMasterNode
(
pod
.
Spec
.
NodeName
)
{
continue
}
if
(
options
.
Nodes
==
MasterAndDNSNodes
)
&&
!
system
.
IsMasterNode
(
pod
.
Spec
.
NodeName
)
&&
pod
.
Labels
[
"k8s-app"
]
!=
"kube-dns"
{
continue
}
for
_
,
container
:=
range
pod
.
Status
.
InitContainerStatuses
{
g
.
containerIDs
=
append
(
g
.
containerIDs
,
container
.
Name
)
}
for
_
,
container
:=
range
pod
.
Status
.
ContainerStatuses
{
g
.
containerIDs
=
append
(
g
.
containerIDs
,
container
.
Name
)
}
if
options
.
Nodes
==
MasterAndDNSNodes
{
dnsNodes
[
pod
.
Spec
.
NodeName
]
=
true
}
}
nodeList
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
...
...
@@ -252,7 +270,7 @@ func NewResourceUsageGatherer(c clientset.Interface, options ResourceGathererOpt
}
for
_
,
node
:=
range
nodeList
.
Items
{
if
!
options
.
MasterOnly
||
system
.
IsMasterNode
(
node
.
Name
)
{
if
options
.
Nodes
==
AllNodes
||
system
.
IsMasterNode
(
node
.
Name
)
||
dnsNodes
[
node
.
Name
]
{
g
.
workerWg
.
Add
(
1
)
g
.
workers
=
append
(
g
.
workers
,
resourceGatherWorker
{
c
:
c
,
...
...
@@ -266,7 +284,7 @@ func NewResourceUsageGatherer(c clientset.Interface, options ResourceGathererOpt
probeDuration
:
options
.
ProbeDuration
,
printVerboseLogs
:
options
.
PrintVerboseLogs
,
})
if
options
.
MasterOnly
{
if
options
.
Nodes
==
MasterNodes
{
break
}
}
...
...
test/e2e/scheduling/nvidia-gpus.go
View file @
9060fc6e
...
...
@@ -137,7 +137,7 @@ func SetupNVIDIAGPUNode(f *framework.Framework, setupResourceGatherer bool) *fra
var
rsgather
*
framework
.
ContainerResourceGatherer
if
setupResourceGatherer
{
framework
.
Logf
(
"Starting ResourceUsageGather for the created DaemonSet pods."
)
rsgather
,
err
=
framework
.
NewResourceUsageGatherer
(
f
.
ClientSet
,
framework
.
ResourceGathererOptions
{
InKubemark
:
false
,
MasterOnly
:
false
,
ResourceDataGatheringPeriod
:
2
*
time
.
Second
,
ProbeDuration
:
2
*
time
.
Second
,
PrintVerboseLogs
:
true
},
pods
)
rsgather
,
err
=
framework
.
NewResourceUsageGatherer
(
f
.
ClientSet
,
framework
.
ResourceGathererOptions
{
InKubemark
:
false
,
Nodes
:
framework
.
AllNodes
,
ResourceDataGatheringPeriod
:
2
*
time
.
Second
,
ProbeDuration
:
2
*
time
.
Second
,
PrintVerboseLogs
:
true
},
pods
)
framework
.
ExpectNoError
(
err
,
"creating ResourceUsageGather for the daemonset pods"
)
go
rsgather
.
StartGatheringData
()
}
...
...
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