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
b73f4acd
Commit
b73f4acd
authored
Oct 02, 2017
by
Jiaying Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes test/e2e_node/gpu_device_plugin.go test failure.
parent
65b76f36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
gpu_device_plugin.go
test/e2e_node/gpu_device_plugin.go
+13
-7
No files found.
test/e2e_node/gpu_device_plugin.go
View file @
b73f4acd
...
@@ -18,6 +18,7 @@ package e2e_node
...
@@ -18,6 +18,7 @@ package e2e_node
import
(
import
(
"os/exec"
"os/exec"
"path/filepath"
"regexp"
"regexp"
"time"
"time"
...
@@ -59,7 +60,7 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi
...
@@ -59,7 +60,7 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi
By
(
"Waiting for GPUs to become available on the local node"
)
By
(
"Waiting for GPUs to become available on the local node"
)
Eventually
(
func
()
bool
{
Eventually
(
func
()
bool
{
return
framework
.
NumberOfNVIDIAGPUs
(
getLocalNode
(
f
))
>
0
return
framework
.
NumberOfNVIDIAGPUs
(
getLocalNode
(
f
))
>
0
},
10
*
time
.
Second
,
time
.
Second
)
.
Should
(
BeTrue
())
},
10
*
time
.
Second
,
framework
.
Poll
)
.
Should
(
BeTrue
())
if
framework
.
NumberOfNVIDIAGPUs
(
getLocalNode
(
f
))
<
2
{
if
framework
.
NumberOfNVIDIAGPUs
(
getLocalNode
(
f
))
<
2
{
Skip
(
"Not enough GPUs to execute this test (at least two needed)"
)
Skip
(
"Not enough GPUs to execute this test (at least two needed)"
)
...
@@ -138,6 +139,9 @@ func newDecimalResourceList(name v1.ResourceName, quantity int64) v1.ResourceLis
...
@@ -138,6 +139,9 @@ func newDecimalResourceList(name v1.ResourceName, quantity int64) v1.ResourceLis
// TODO: Find a uniform way to deal with systemctl/initctl/service operations. #34494
// TODO: Find a uniform way to deal with systemctl/initctl/service operations. #34494
func
restartKubelet
(
f
*
framework
.
Framework
)
{
func
restartKubelet
(
f
*
framework
.
Framework
)
{
beforeSocks
,
err
:=
filepath
.
Glob
(
"/var/lib/kubelet/device-plugins/nvidiaGPU*.sock"
)
framework
.
ExpectNoError
(
err
)
Expect
(
len
(
beforeSocks
))
.
NotTo
(
BeZero
())
stdout
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"list-units"
,
"kubelet*"
,
"--state=running"
)
.
CombinedOutput
()
stdout
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"list-units"
,
"kubelet*"
,
"--state=running"
)
.
CombinedOutput
()
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
regex
:=
regexp
.
MustCompile
(
"(kubelet-[0-9]+)"
)
regex
:=
regexp
.
MustCompile
(
"(kubelet-[0-9]+)"
)
...
@@ -146,19 +150,21 @@ func restartKubelet(f *framework.Framework) {
...
@@ -146,19 +150,21 @@ func restartKubelet(f *framework.Framework) {
kube
:=
matches
[
0
]
kube
:=
matches
[
0
]
framework
.
Logf
(
"Get running kubelet with systemctl: %v, %v"
,
string
(
stdout
),
kube
)
framework
.
Logf
(
"Get running kubelet with systemctl: %v, %v"
,
string
(
stdout
),
kube
)
stdout
,
err
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"restart"
,
kube
)
.
CombinedOutput
()
stdout
,
err
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"restart"
,
kube
)
.
CombinedOutput
()
if
err
==
nil
{
framework
.
ExpectNoError
(
err
,
"Failed to restart kubelet with systemctl: %v, %v"
,
err
,
stdout
)
return
Eventually
(
func
()
([]
string
,
error
)
{
}
return
filepath
.
Glob
(
"/var/lib/kubelet/device-plugins/nvidiaGPU*.sock"
)
framework
.
Failf
(
"Failed to restart kubelet with systemctl: %v, %v"
,
err
,
stdout
)
},
5
*
time
.
Minute
,
framework
.
Poll
)
.
ShouldNot
(
ConsistOf
(
beforeSocks
)
)
}
}
func
getDeviceId
(
f
*
framework
.
Framework
,
podName
string
,
contName
string
,
restartCount
int32
)
string
{
func
getDeviceId
(
f
*
framework
.
Framework
,
podName
string
,
contName
string
,
restartCount
int32
)
string
{
// Wait till pod has been restarted at least restartCount times.
// Wait till pod has been restarted at least restartCount times.
Eventually
(
func
()
bool
{
Eventually
(
func
()
bool
{
p
,
err
:=
f
.
PodClient
()
.
Get
(
podName
,
metav1
.
GetOptions
{})
p
,
err
:=
f
.
PodClient
()
.
Get
(
podName
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
)
if
err
!=
nil
||
len
(
p
.
Status
.
ContainerStatuses
)
<
1
{
return
false
}
return
p
.
Status
.
ContainerStatuses
[
0
]
.
RestartCount
>=
restartCount
return
p
.
Status
.
ContainerStatuses
[
0
]
.
RestartCount
>=
restartCount
},
time
.
Minute
,
time
.
Second
)
.
Should
(
BeTrue
())
},
5
*
time
.
Minute
,
framework
.
Poll
)
.
Should
(
BeTrue
())
logs
,
err
:=
framework
.
GetPodLogs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
podName
,
contName
)
logs
,
err
:=
framework
.
GetPodLogs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
podName
,
contName
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"GetPodLogs for pod %q failed: %v"
,
podName
,
err
)
framework
.
Failf
(
"GetPodLogs for pod %q failed: %v"
,
podName
,
err
)
...
...
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