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
e9795e37
Unverified
Commit
e9795e37
authored
Jun 29, 2017
by
Tim St. Clair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup lint errors in the pkg/kubelet/server/... directory
parent
472e4ed9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
31 deletions
+6
-31
websocket.go
pkg/kubelet/server/portforward/websocket.go
+0
-1
httpstream.go
pkg/kubelet/server/remotecommand/httpstream.go
+2
-2
server.go
pkg/kubelet/server/server.go
+3
-5
server_test.go
pkg/kubelet/server/server_test.go
+0
-15
server_websocket_test.go
pkg/kubelet/server/server_websocket_test.go
+1
-1
summary_test.go
pkg/kubelet/server/stats/summary_test.go
+0
-7
No files found.
pkg/kubelet/server/portforward/websocket.go
View file @
e9795e37
...
@@ -158,7 +158,6 @@ type websocketStreamPair struct {
...
@@ -158,7 +158,6 @@ type websocketStreamPair struct {
// request over a websocket connection
// request over a websocket connection
type
websocketStreamHandler
struct
{
type
websocketStreamHandler
struct
{
conn
*
wsstream
.
Conn
conn
*
wsstream
.
Conn
ports
[]
int32
streamPairs
[]
*
websocketStreamPair
streamPairs
[]
*
websocketStreamPair
pod
string
pod
string
uid
types
.
UID
uid
types
.
UID
...
...
pkg/kubelet/server/remotecommand/httpstream.go
View file @
e9795e37
...
@@ -423,7 +423,7 @@ func handleResizeEvents(stream io.Reader, channel chan<- remotecommand.TerminalS
...
@@ -423,7 +423,7 @@ func handleResizeEvents(stream io.Reader, channel chan<- remotecommand.TerminalS
}
}
}
}
func
v1WriteStatusFunc
(
stream
io
.
Write
Close
r
)
func
(
status
*
apierrors
.
StatusError
)
error
{
func
v1WriteStatusFunc
(
stream
io
.
Writer
)
func
(
status
*
apierrors
.
StatusError
)
error
{
return
func
(
status
*
apierrors
.
StatusError
)
error
{
return
func
(
status
*
apierrors
.
StatusError
)
error
{
if
status
.
Status
()
.
Status
==
metav1
.
StatusSuccess
{
if
status
.
Status
()
.
Status
==
metav1
.
StatusSuccess
{
return
nil
// send error messages
return
nil
// send error messages
...
@@ -435,7 +435,7 @@ func v1WriteStatusFunc(stream io.WriteCloser) func(status *apierrors.StatusError
...
@@ -435,7 +435,7 @@ func v1WriteStatusFunc(stream io.WriteCloser) func(status *apierrors.StatusError
// v4WriteStatusFunc returns a WriteStatusFunc that marshals a given api Status
// v4WriteStatusFunc returns a WriteStatusFunc that marshals a given api Status
// as json in the error channel.
// as json in the error channel.
func
v4WriteStatusFunc
(
stream
io
.
Write
Close
r
)
func
(
status
*
apierrors
.
StatusError
)
error
{
func
v4WriteStatusFunc
(
stream
io
.
Writer
)
func
(
status
*
apierrors
.
StatusError
)
error
{
return
func
(
status
*
apierrors
.
StatusError
)
error
{
return
func
(
status
*
apierrors
.
StatusError
)
error
{
bs
,
err
:=
json
.
Marshal
(
status
.
Status
())
bs
,
err
:=
json
.
Marshal
(
status
.
Status
())
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/kubelet/server/server.go
View file @
e9795e37
...
@@ -267,8 +267,7 @@ func (s *Server) InstallDefaultHandlers() {
...
@@ -267,8 +267,7 @@ func (s *Server) InstallDefaultHandlers() {
healthz
.
PingHealthz
,
healthz
.
PingHealthz
,
healthz
.
NamedCheck
(
"syncloop"
,
s
.
syncLoopHealthCheck
),
healthz
.
NamedCheck
(
"syncloop"
,
s
.
syncLoopHealthCheck
),
)
)
var
ws
*
restful
.
WebService
ws
:=
new
(
restful
.
WebService
)
ws
=
new
(
restful
.
WebService
)
ws
.
ws
.
Path
(
"/pods"
)
.
Path
(
"/pods"
)
.
Produces
(
restful
.
MIME_JSON
)
Produces
(
restful
.
MIME_JSON
)
...
@@ -296,9 +295,8 @@ const pprofBasePath = "/debug/pprof/"
...
@@ -296,9 +295,8 @@ const pprofBasePath = "/debug/pprof/"
// InstallDebuggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
// InstallDebuggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
func
(
s
*
Server
)
InstallDebuggingHandlers
(
criHandler
http
.
Handler
)
{
func
(
s
*
Server
)
InstallDebuggingHandlers
(
criHandler
http
.
Handler
)
{
glog
.
Infof
(
"Adding debug handlers to kubelet server."
)
glog
.
Infof
(
"Adding debug handlers to kubelet server."
)
var
ws
*
restful
.
WebService
ws
=
new
(
restful
.
WebService
)
ws
:
=
new
(
restful
.
WebService
)
ws
.
ws
.
Path
(
"/run"
)
Path
(
"/run"
)
ws
.
Route
(
ws
.
POST
(
"/{podNamespace}/{podID}/{containerName}"
)
.
ws
.
Route
(
ws
.
POST
(
"/{podNamespace}/{podID}/{containerName}"
)
.
...
@@ -429,7 +427,7 @@ func (s *Server) syncLoopHealthCheck(req *http.Request) error {
...
@@ -429,7 +427,7 @@ func (s *Server) syncLoopHealthCheck(req *http.Request) error {
}
}
enterLoopTime
:=
s
.
host
.
LatestLoopEntryTime
()
enterLoopTime
:=
s
.
host
.
LatestLoopEntryTime
()
if
!
enterLoopTime
.
IsZero
()
&&
time
.
Now
()
.
After
(
enterLoopTime
.
Add
(
duration
))
{
if
!
enterLoopTime
.
IsZero
()
&&
time
.
Now
()
.
After
(
enterLoopTime
.
Add
(
duration
))
{
return
fmt
.
Errorf
(
"
Sync Loop took longer than expected.
"
)
return
fmt
.
Errorf
(
"
sync Loop took longer than expected
"
)
}
}
return
nil
return
nil
}
}
...
...
pkg/kubelet/server/server_test.go
View file @
e9795e37
...
@@ -248,21 +248,6 @@ func newServerTest() *serverTestFramework {
...
@@ -248,21 +248,6 @@ func newServerTest() *serverTestFramework {
return
fw
return
fw
}
}
// encodeJSON returns obj marshalled as a JSON string, panicing on any errors
func
encodeJSON
(
obj
interface
{})
string
{
data
,
err
:=
json
.
Marshal
(
obj
)
if
err
!=
nil
{
panic
(
err
)
}
return
string
(
data
)
}
func
readResp
(
resp
*
http
.
Response
)
(
string
,
error
)
{
defer
resp
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
return
string
(
body
),
err
}
// A helper function to return the correct pod name.
// A helper function to return the correct pod name.
func
getPodName
(
name
,
namespace
string
)
string
{
func
getPodName
(
name
,
namespace
string
)
string
{
if
namespace
==
""
{
if
namespace
==
""
{
...
...
pkg/kubelet/server/server_websocket_test.go
View file @
e9795e37
...
@@ -172,7 +172,7 @@ func TestServeWSPortForward(t *testing.T) {
...
@@ -172,7 +172,7 @@ func TestServeWSPortForward(t *testing.T) {
}
}
if
test
.
containerData
!=
""
{
if
test
.
containerData
!=
""
{
channel
,
data
,
err
=
wsRead
(
ws
)
_
,
data
,
err
=
wsRead
(
ws
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"%d: unexpected error reading container data: %v"
,
i
,
err
)
t
.
Fatalf
(
"%d: unexpected error reading container data: %v"
,
i
,
err
)
}
}
...
...
pkg/kubelet/server/stats/summary_test.go
View file @
e9795e37
...
@@ -376,13 +376,6 @@ func checkMemoryStats(t *testing.T, label string, seed int, info v2.ContainerInf
...
@@ -376,13 +376,6 @@ func checkMemoryStats(t *testing.T, label string, seed int, info v2.ContainerInf
}
}
}
}
func
checkFsStats
(
t
*
testing
.
T
,
capacity
uint64
,
Available
uint64
,
inodes
uint64
,
inodesFree
uint64
,
fs
*
kubestats
.
FsStats
)
{
assert
.
EqualValues
(
t
,
capacity
,
*
fs
.
CapacityBytes
)
assert
.
EqualValues
(
t
,
Available
,
*
fs
.
AvailableBytes
)
assert
.
EqualValues
(
t
,
inodesFree
,
*
fs
.
InodesFree
)
assert
.
EqualValues
(
t
,
inodes
,
*
fs
.
Inodes
)
}
func
TestCustomMetrics
(
t
*
testing
.
T
)
{
func
TestCustomMetrics
(
t
*
testing
.
T
)
{
spec
:=
[]
v1
.
MetricSpec
{
spec
:=
[]
v1
.
MetricSpec
{
{
{
...
...
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