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
092429be
Commit
092429be
authored
Oct 26, 2017
by
Rohit Agarwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better error messages and logging while registering device plugins.
parent
7914aed8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
manager.go
pkg/kubelet/cm/deviceplugin/manager.go
+8
-5
types.go
pkg/kubelet/cm/deviceplugin/types.go
+2
-2
No files found.
pkg/kubelet/cm/deviceplugin/manager.go
View file @
092429be
...
@@ -169,15 +169,18 @@ func (m *ManagerImpl) Allocate(resourceName string, devs []string) (*pluginapi.A
...
@@ -169,15 +169,18 @@ func (m *ManagerImpl) Allocate(resourceName string, devs []string) (*pluginapi.A
}
}
// Register registers a device plugin.
// Register registers a device plugin.
func
(
m
*
ManagerImpl
)
Register
(
ctx
context
.
Context
,
func
(
m
*
ManagerImpl
)
Register
(
ctx
context
.
Context
,
r
*
pluginapi
.
RegisterRequest
)
(
*
pluginapi
.
Empty
,
error
)
{
r
*
pluginapi
.
RegisterRequest
)
(
*
pluginapi
.
Empty
,
error
)
{
glog
.
Infof
(
"Got registration request from device plugin with resource name %q"
,
r
.
ResourceName
)
glog
.
V
(
2
)
.
Infof
(
"Got request for Device Plugin %s"
,
r
.
ResourceName
)
if
r
.
Version
!=
pluginapi
.
Version
{
if
r
.
Version
!=
pluginapi
.
Version
{
return
&
pluginapi
.
Empty
{},
fmt
.
Errorf
(
errUnsuportedVersion
)
errorString
:=
fmt
.
Sprintf
(
errUnsuportedVersion
,
r
.
Version
,
pluginapi
.
Version
)
glog
.
Infof
(
"Bad registration request from device plugin with resource name %q: %v"
,
r
.
ResourceName
,
errorString
)
return
&
pluginapi
.
Empty
{},
fmt
.
Errorf
(
errorString
)
}
}
if
!
v1helper
.
IsExtendedResourceName
(
v1
.
ResourceName
(
r
.
ResourceName
))
{
if
!
v1helper
.
IsExtendedResourceName
(
v1
.
ResourceName
(
r
.
ResourceName
))
{
return
&
pluginapi
.
Empty
{},
fmt
.
Errorf
(
errInvalidResourceName
,
r
.
ResourceName
)
errorString
:=
fmt
.
Sprintf
(
errInvalidResourceName
,
r
.
ResourceName
)
glog
.
Infof
(
"Bad registration request from device plugin: %v"
,
errorString
)
return
&
pluginapi
.
Empty
{},
fmt
.
Errorf
(
errorString
)
}
}
// TODO: for now, always accepts newest device plugin. Later may consider to
// TODO: for now, always accepts newest device plugin. Later may consider to
...
...
pkg/kubelet/cm/deviceplugin/types.go
View file @
092429be
...
@@ -64,13 +64,13 @@ const (
...
@@ -64,13 +64,13 @@ const (
errFailedToDialDevicePlugin
=
"failed to dial device plugin:"
errFailedToDialDevicePlugin
=
"failed to dial device plugin:"
// errUnsuportedVersion is the error raised when the device plugin uses an API version not
// errUnsuportedVersion is the error raised when the device plugin uses an API version not
// supported by the Kubelet registry
// supported by the Kubelet registry
errUnsuportedVersion
=
"
unsupported API version by the Kubelet registry
"
errUnsuportedVersion
=
"
requested API version %q is not supported by kubelet. Supported version is %q
"
// errDevicePluginAlreadyExists is the error raised when a device plugin with the
// errDevicePluginAlreadyExists is the error raised when a device plugin with the
// same Resource Name tries to register itself
// same Resource Name tries to register itself
errDevicePluginAlreadyExists
=
"another device plugin already registered this Resource Name"
errDevicePluginAlreadyExists
=
"another device plugin already registered this Resource Name"
// errInvalidResourceName is the error raised when a device plugin is registering
// errInvalidResourceName is the error raised when a device plugin is registering
// itself with an invalid ResourceName
// itself with an invalid ResourceName
errInvalidResourceName
=
"the ResourceName %
s
is invalid"
errInvalidResourceName
=
"the ResourceName %
q
is invalid"
// errEmptyResourceName is the error raised when the resource name field is empty
// errEmptyResourceName is the error raised when the resource name field is empty
errEmptyResourceName
=
"invalid Empty ResourceName"
errEmptyResourceName
=
"invalid Empty ResourceName"
...
...
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