From c03b9c2f682dd0a267fef0ca58c9368b8c4e90b0 Mon Sep 17 00:00:00 2001 From: Dimitris Gkanatsios Date: Mon, 13 Dec 2021 14:48:24 -0800 Subject: [PATCH] adding timeout to Allocation API service --- operator/http/http.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/operator/http/http.go b/operator/http/http.go index 88ab8e7e..aebe179a 100644 --- a/operator/http/http.go +++ b/operator/http/http.go @@ -7,6 +7,7 @@ import ( "net" "net/http" "os" + "time" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" @@ -98,8 +99,11 @@ func (s *ApiServer) Start(ctx context.Context) error { log.Info("serving allocation API service", "addr", addr, "port", listeningPort) srv := &http.Server{ - Addr: addr, - Handler: mux, + Addr: addr, + Handler: mux, + ReadTimeout: 5 * time.Second, + WriteTimeout: 5 * time.Second, + MaxHeaderBytes: http.DefaultMaxHeaderBytes, } done := make(chan struct{})