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
b01657d0
Commit
b01657d0
authored
Apr 24, 2018
by
Andy Xie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor device plugin grpc dial with dialcontext
parent
e7ed9b40
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
device_plugin_stub.go
pkg/kubelet/cm/devicemanager/device_plugin_stub.go
+4
-2
endpoint.go
pkg/kubelet/cm/devicemanager/endpoint.go
+4
-2
No files found.
pkg/kubelet/cm/devicemanager/device_plugin_stub.go
View file @
b01657d0
...
@@ -106,8 +106,10 @@ func (m *Stub) Stop() error {
...
@@ -106,8 +106,10 @@ func (m *Stub) Stop() error {
// Register registers the device plugin for the given resourceName with Kubelet.
// Register registers the device plugin for the given resourceName with Kubelet.
func
(
m
*
Stub
)
Register
(
kubeletEndpoint
,
resourceName
string
,
preStartContainerFlag
bool
)
error
{
func
(
m
*
Stub
)
Register
(
kubeletEndpoint
,
resourceName
string
,
preStartContainerFlag
bool
)
error
{
conn
,
err
:=
grpc
.
Dial
(
kubeletEndpoint
,
grpc
.
WithInsecure
(),
grpc
.
WithBlock
(),
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
grpc
.
WithTimeout
(
10
*
time
.
Second
),
defer
cancel
()
conn
,
err
:=
grpc
.
DialContext
(
ctx
,
kubeletEndpoint
,
grpc
.
WithInsecure
(),
grpc
.
WithBlock
(),
grpc
.
WithDialer
(
func
(
addr
string
,
timeout
time
.
Duration
)
(
net
.
Conn
,
error
)
{
grpc
.
WithDialer
(
func
(
addr
string
,
timeout
time
.
Duration
)
(
net
.
Conn
,
error
)
{
return
net
.
DialTimeout
(
"unix"
,
addr
,
timeout
)
return
net
.
DialTimeout
(
"unix"
,
addr
,
timeout
)
}))
}))
...
...
pkg/kubelet/cm/devicemanager/endpoint.go
View file @
b01657d0
...
@@ -244,8 +244,10 @@ func (e *endpointImpl) stop() {
...
@@ -244,8 +244,10 @@ func (e *endpointImpl) stop() {
// dial establishes the gRPC communication with the registered device plugin. https://godoc.org/google.golang.org/grpc#Dial
// dial establishes the gRPC communication with the registered device plugin. https://godoc.org/google.golang.org/grpc#Dial
func
dial
(
unixSocketPath
string
)
(
pluginapi
.
DevicePluginClient
,
*
grpc
.
ClientConn
,
error
)
{
func
dial
(
unixSocketPath
string
)
(
pluginapi
.
DevicePluginClient
,
*
grpc
.
ClientConn
,
error
)
{
c
,
err
:=
grpc
.
Dial
(
unixSocketPath
,
grpc
.
WithInsecure
(),
grpc
.
WithBlock
(),
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
grpc
.
WithTimeout
(
10
*
time
.
Second
),
defer
cancel
()
c
,
err
:=
grpc
.
DialContext
(
ctx
,
unixSocketPath
,
grpc
.
WithInsecure
(),
grpc
.
WithBlock
(),
grpc
.
WithDialer
(
func
(
addr
string
,
timeout
time
.
Duration
)
(
net
.
Conn
,
error
)
{
grpc
.
WithDialer
(
func
(
addr
string
,
timeout
time
.
Duration
)
(
net
.
Conn
,
error
)
{
return
net
.
DialTimeout
(
"unix"
,
addr
,
timeout
)
return
net
.
DialTimeout
(
"unix"
,
addr
,
timeout
)
}),
}),
...
...
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