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
7b1ae664
Commit
7b1ae664
authored
Aug 02, 2018
by
Jiaying Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail container start if its requested device plugin resource doesn't
have cached option state to make sure the device plugin resource is in ready state when we start the container.
parent
d9493156
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
manager.go
pkg/kubelet/cm/devicemanager/manager.go
+3
-8
manager_test.go
pkg/kubelet/cm/devicemanager/manager_test.go
+4
-0
No files found.
pkg/kubelet/cm/devicemanager/manager.go
View file @
7b1ae664
...
@@ -378,9 +378,7 @@ func (m *ManagerImpl) addEndpointProbeMode(resourceName string, socketPath strin
...
@@ -378,9 +378,7 @@ func (m *ManagerImpl) addEndpointProbeMode(resourceName string, socketPath strin
func
(
m
*
ManagerImpl
)
registerEndpoint
(
resourceName
string
,
options
*
pluginapi
.
DevicePluginOptions
,
e
*
endpointImpl
)
{
func
(
m
*
ManagerImpl
)
registerEndpoint
(
resourceName
string
,
options
*
pluginapi
.
DevicePluginOptions
,
e
*
endpointImpl
)
{
m
.
mutex
.
Lock
()
m
.
mutex
.
Lock
()
defer
m
.
mutex
.
Unlock
()
defer
m
.
mutex
.
Unlock
()
if
options
!=
nil
{
m
.
pluginOpts
[
resourceName
]
=
options
m
.
pluginOpts
[
resourceName
]
=
options
}
m
.
endpoints
[
resourceName
]
=
e
m
.
endpoints
[
resourceName
]
=
e
glog
.
V
(
2
)
.
Infof
(
"Registered endpoint %v"
,
e
)
glog
.
V
(
2
)
.
Infof
(
"Registered endpoint %v"
,
e
)
}
}
...
@@ -721,11 +719,8 @@ func (m *ManagerImpl) callPreStartContainerIfNeeded(podUID, contName, resource s
...
@@ -721,11 +719,8 @@ func (m *ManagerImpl) callPreStartContainerIfNeeded(podUID, contName, resource s
opts
,
ok
:=
m
.
pluginOpts
[
resource
]
opts
,
ok
:=
m
.
pluginOpts
[
resource
]
if
!
ok
{
if
!
ok
{
m
.
mutex
.
Unlock
()
m
.
mutex
.
Unlock
()
glog
.
V
(
4
)
.
Infof
(
"Plugin options not found in cache for resource: %s. Skip PreStartContainer"
,
resource
)
return
fmt
.
Errorf
(
"Plugin options not found in cache for resource: %s"
,
resource
)
return
nil
}
else
if
opts
==
nil
||
!
opts
.
PreStartRequired
{
}
if
!
opts
.
PreStartRequired
{
m
.
mutex
.
Unlock
()
m
.
mutex
.
Unlock
()
glog
.
V
(
4
)
.
Infof
(
"Plugin options indicate to skip PreStartContainer for resource, %v"
,
resource
)
glog
.
V
(
4
)
.
Infof
(
"Plugin options indicate to skip PreStartContainer for resource, %v"
,
resource
)
return
nil
return
nil
...
...
pkg/kubelet/cm/devicemanager/manager_test.go
View file @
7b1ae664
...
@@ -670,6 +670,8 @@ func TestPodContainerDeviceAllocation(t *testing.T) {
...
@@ -670,6 +670,8 @@ func TestPodContainerDeviceAllocation(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
defer
os
.
RemoveAll
(
tmpDir
)
nodeInfo
:=
getTestNodeInfo
(
v1
.
ResourceList
{})
nodeInfo
:=
getTestNodeInfo
(
v1
.
ResourceList
{})
pluginOpts
:=
make
(
map
[
string
]
*
pluginapi
.
DevicePluginOptions
)
pluginOpts
:=
make
(
map
[
string
]
*
pluginapi
.
DevicePluginOptions
)
pluginOpts
[
res1
.
resourceName
]
=
nil
pluginOpts
[
res2
.
resourceName
]
=
nil
testManager
,
err
:=
getTestManager
(
tmpDir
,
podsStub
.
getActivePods
,
testResources
,
pluginOpts
)
testManager
,
err
:=
getTestManager
(
tmpDir
,
podsStub
.
getActivePods
,
testResources
,
pluginOpts
)
as
.
Nil
(
err
)
as
.
Nil
(
err
)
...
@@ -766,6 +768,8 @@ func TestInitContainerDeviceAllocation(t *testing.T) {
...
@@ -766,6 +768,8 @@ func TestInitContainerDeviceAllocation(t *testing.T) {
as
.
Nil
(
err
)
as
.
Nil
(
err
)
defer
os
.
RemoveAll
(
tmpDir
)
defer
os
.
RemoveAll
(
tmpDir
)
pluginOpts
:=
make
(
map
[
string
]
*
pluginapi
.
DevicePluginOptions
)
pluginOpts
:=
make
(
map
[
string
]
*
pluginapi
.
DevicePluginOptions
)
pluginOpts
[
res1
.
resourceName
]
=
nil
pluginOpts
[
res2
.
resourceName
]
=
nil
testManager
,
err
:=
getTestManager
(
tmpDir
,
podsStub
.
getActivePods
,
testResources
,
pluginOpts
)
testManager
,
err
:=
getTestManager
(
tmpDir
,
podsStub
.
getActivePods
,
testResources
,
pluginOpts
)
as
.
Nil
(
err
)
as
.
Nil
(
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