mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Migrate to structured logging
migrate pkg/kubelet/server to structured logging. Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
This commit is contained in:
parent
066600f105
commit
5af10e9828
@ -25,6 +25,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
goruntime "runtime"
|
goruntime "runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -159,9 +160,13 @@ func ListenAndServeKubeletServer(
|
|||||||
// Passing empty strings as the cert and key files means no
|
// Passing empty strings as the cert and key files means no
|
||||||
// cert/keys are specified and GetCertificate in the TLSConfig
|
// cert/keys are specified and GetCertificate in the TLSConfig
|
||||||
// should be called instead.
|
// should be called instead.
|
||||||
klog.Fatal(s.ListenAndServeTLS(tlsOptions.CertFile, tlsOptions.KeyFile))
|
if err := s.ListenAndServeTLS(tlsOptions.CertFile, tlsOptions.KeyFile); err != nil {
|
||||||
} else {
|
klog.ErrorS(err, "Failed to listen and serve")
|
||||||
klog.Fatal(s.ListenAndServe())
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
} else if err := s.ListenAndServe(); err != nil {
|
||||||
|
klog.ErrorS(err, "Failed to listen and serve")
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +180,11 @@ func ListenAndServeKubeletReadOnlyServer(host HostInterface, resourceAnalyzer st
|
|||||||
Handler: &s,
|
Handler: &s,
|
||||||
MaxHeaderBytes: 1 << 20,
|
MaxHeaderBytes: 1 << 20,
|
||||||
}
|
}
|
||||||
klog.Fatal(server.ListenAndServe())
|
|
||||||
|
if err := server.ListenAndServe(); err != nil {
|
||||||
|
klog.ErrorS(err, "Failed to listen and serve")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListenAndServePodResources initializes a gRPC server to serve the PodResources service
|
// ListenAndServePodResources initializes a gRPC server to serve the PodResources service
|
||||||
@ -185,9 +194,14 @@ func ListenAndServePodResources(socket string, podsProvider podresources.PodsPro
|
|||||||
podresourcesapi.RegisterPodResourcesListerServer(server, podresources.NewV1PodResourcesServer(podsProvider, devicesProvider, cpusProvider))
|
podresourcesapi.RegisterPodResourcesListerServer(server, podresources.NewV1PodResourcesServer(podsProvider, devicesProvider, cpusProvider))
|
||||||
l, err := util.CreateListener(socket)
|
l, err := util.CreateListener(socket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("Failed to create listener for podResources endpoint: %v", err)
|
klog.ErrorS(err, "Failed to create listener for podResources endpoint")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := server.Serve(l); err != nil {
|
||||||
|
klog.ErrorS(err, "Failed to serve")
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
klog.Fatal(server.Serve(l))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthInterface contains all methods required by the auth filters
|
// AuthInterface contains all methods required by the auth filters
|
||||||
|
Loading…
Reference in New Issue
Block a user