1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fix: set correct logger in profiling server (#5358)

* fix: set correct logger in profiling server

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* Update cmd/kyverno/main.go

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
yinka 2022-11-17 10:06:36 +00:00 committed by GitHub
parent bb90bb25ba
commit 3d7fd8adc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,8 +160,14 @@ func startProfiling(logger logr.Logger) {
addr := ":" + profilePort
logger.Info("Enable profiling, see details at https://github.com/kyverno/kyverno/wiki/Profiling-Kyverno-on-Kubernetes", "port", profilePort)
go func() {
if err := http.ListenAndServe(addr, nil); err != nil {
logger.Error(err, "Failed to enable profiling")
s := http.Server{
Addr: addr,
Handler: nil,
ErrorLog: logging.StdLogger(logger, ""),
ReadHeaderTimeout: 30 * time.Second,
}
if err := s.ListenAndServe(); err != nil {
logger.Error(err, "failed to enable profiling", "address", addr)
os.Exit(1)
}
}()