mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -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),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user