Skip to content

Commit

Permalink
fix: enforce timeouts in the kubenurse http.Server to avoid possible …
Browse files Browse the repository at this point in the history
…goroutine/memory leaks
  • Loading branch information
Thomas Gosteli committed Jan 21, 2022
1 parent ebb0764 commit d07df3b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/kubenurse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ func New(ctx context.Context, k8s kubernetes.Interface) (*Server, error) {

server := &Server{
http: http.Server{
Addr: ":8080",
Handler: mux,
Addr: ":8080",
Handler: mux,
ReadHeaderTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
},
https: http.Server{
Addr: ":8443",
Handler: mux,
Addr: ":8443",
Handler: mux,
ReadHeaderTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
},

//nolint:goconst // No need to make "true" a constant in my opinion, readability is better like this.
Expand Down

0 comments on commit d07df3b

Please sign in to comment.