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
97336cd7
Commit
97336cd7
authored
Nov 02, 2016
by
Euan Kemp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubelet: don't print httplogs for redirects
The new CRI exec implementation relies on this status code. Without this change, kubelet logs a scary stacktrace during normal execution.
parent
04a74570
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
log_test.go
pkg/httplog/log_test.go
+14
-0
server.go
pkg/kubelet/server/server.go
+1
-0
No files found.
pkg/httplog/log_test.go
View file @
97336cd7
...
@@ -24,6 +24,20 @@ import (
...
@@ -24,6 +24,20 @@ import (
"testing"
"testing"
)
)
func
TestDefaultStacktracePred
(
t
*
testing
.
T
)
{
for
_
,
x
:=
range
[]
int
{
101
,
200
,
204
,
302
,
400
,
404
}
{
if
DefaultStacktracePred
(
x
)
{
t
.
Fatalf
(
"should not log on %v by default"
,
x
)
}
}
for
_
,
x
:=
range
[]
int
{
500
,
100
}
{
if
!
DefaultStacktracePred
(
x
)
{
t
.
Fatalf
(
"should log on %v by default"
,
x
)
}
}
}
func
TestHandler
(
t
*
testing
.
T
)
{
func
TestHandler
(
t
*
testing
.
T
)
{
want
:=
&
httptest
.
ResponseRecorder
{
want
:=
&
httptest
.
ResponseRecorder
{
HeaderMap
:
make
(
http
.
Header
),
HeaderMap
:
make
(
http
.
Header
),
...
...
pkg/kubelet/server/server.go
View file @
97336cd7
...
@@ -675,6 +675,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
...
@@ -675,6 +675,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
defer
httplog
.
NewLogged
(
req
,
&
w
)
.
StacktraceWhen
(
defer
httplog
.
NewLogged
(
req
,
&
w
)
.
StacktraceWhen
(
httplog
.
StatusIsNot
(
httplog
.
StatusIsNot
(
http
.
StatusOK
,
http
.
StatusOK
,
http
.
StatusFound
,
http
.
StatusMovedPermanently
,
http
.
StatusMovedPermanently
,
http
.
StatusTemporaryRedirect
,
http
.
StatusTemporaryRedirect
,
http
.
StatusBadRequest
,
http
.
StatusBadRequest
,
...
...
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