mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Add logging, fix crash
Crash was in kublet_server when fake docker client gives it nil pointer.
This commit is contained in:
parent
bf3b34c2e9
commit
969586a214
@ -173,7 +173,7 @@ func main() {
|
||||
if len(createdPods) != 7 {
|
||||
glog.Fatalf("Unexpected list of created pods:\n\n%#v\n\n%#v\n\n%#v\n\n", createdPods.List(), fakeDocker1.Created, fakeDocker2.Created)
|
||||
}
|
||||
glog.Infof("OK")
|
||||
glog.Infof("OK - found created pods: %#v", createdPods.List())
|
||||
}
|
||||
|
||||
// Serve a file for kubelet to read.
|
||||
|
@ -801,7 +801,12 @@ func (kl *Kubelet) GetPodInfo(podID string) (api.PodInfo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info[containerName] = *inspectResult
|
||||
if inspectResult == nil {
|
||||
// Why did we not get an error?
|
||||
info[containerName] = docker.Container{}
|
||||
} else {
|
||||
info[containerName] = *inspectResult
|
||||
}
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"net/url"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
|
||||
"gopkg.in/v1/yaml"
|
||||
)
|
||||
|
||||
@ -45,6 +46,10 @@ func (s *KubeletServer) error(w http.ResponseWriter, err error) {
|
||||
}
|
||||
|
||||
func (s *KubeletServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
logger := apiserver.MakeLogged(req, w)
|
||||
w = logger
|
||||
defer logger.Log()
|
||||
|
||||
u, err := url.ParseRequestURI(req.RequestURI)
|
||||
if err != nil {
|
||||
s.error(w, err)
|
||||
|
Loading…
Reference in New Issue
Block a user