@@ -17,16 +17,19 @@ import (
1717 "context"
1818 "encoding/json"
1919 "fmt"
20- "go.uber.org/zap"
2120 "io"
2221 "net/http"
23- _ "net/http/pprof" // Registers /debug/pprof endpoints in http.DefaultServeMux.
22+ _ "net/http/pprof"
2423 "os"
2524 "sort"
2625 "strings"
2726 "sync"
2827 "time"
2928
29+ "go.uber.org/zap"
30+
31+ // Registers /debug/pprof endpoints in http.DefaultServeMux.
32+
3033 "github.com/uber/kraken/build-index/tagclient"
3134 "github.com/uber/kraken/core"
3235 "github.com/uber/kraken/lib/containerruntime"
@@ -56,9 +59,6 @@ type Config struct {
5659 // Timeout for readiness checks
5760 ReadinessTimeout time.Duration `yaml:"readiness_timeout"`
5861
59- // Maximum request body size for patch operations
60- MaxRequestBodySize int64 `yaml:"max_request_body_size"`
61-
6262 // Enable detailed request logging
6363 EnableRequestLogging bool `yaml:"enable_request_logging"`
6464}
@@ -74,9 +74,6 @@ func (c *Config) applyDefaults() {
7474 if c .ReadinessTimeout == 0 {
7575 c .ReadinessTimeout = 30 * time .Second
7676 }
77- if c .MaxRequestBodySize == 0 {
78- c .MaxRequestBodySize = 1024 * 1024 // 1MB
79- }
8077}
8178
8279// Server defines the agent HTTP server.
@@ -100,8 +97,8 @@ func New(
10097 sched scheduler.ReloadableScheduler ,
10198 tags tagclient.Client ,
10299 ac announceclient.Client ,
103- containerRuntime containerruntime.Factory ) * Server {
104-
100+ containerRuntime containerruntime.Factory ,
101+ ) * Server {
105102 config .applyDefaults ()
106103
107104 stats = stats .Tagged (map [string ]string {
@@ -184,7 +181,7 @@ func (s *Server) getLogger(ctx context.Context) *zap.SugaredLogger {
184181func (s * Server ) getTagHandler (w http.ResponseWriter , r * http.Request ) error {
185182 ctx := r .Context ()
186183 logger := s .getLogger (ctx )
187-
184+
188185 tag , err := httputil .ParseParam (r , "tag" )
189186 if err != nil {
190187 return handler .Errorf ("parse tag param: %s" , err ).Status (http .StatusBadRequest )
@@ -507,9 +504,6 @@ func (s *Server) readinessCheckHandler(w http.ResponseWriter, r *http.Request) e
507504func (s * Server ) patchSchedulerConfigHandler (w http.ResponseWriter , r * http.Request ) error {
508505 ctx := r .Context ()
509506 logger := s .getLogger (ctx )
510-
511- // Limit request body size
512- r .Body = http .MaxBytesReader (w , r .Body , s .config .MaxRequestBodySize )
513507 defer r .Body .Close ()
514508
515509 logger .Debugw ("patching scheduler config" )
0 commit comments