Test for and fix crash with nil client in kubelet.

Added test that fails before fix.
Fixed use of nil pointer.
This commit is contained in:
Eric Tune
2015-01-16 13:39:31 -08:00
parent ee0ba6c922
commit 98bdd3f7c4
4 changed files with 18 additions and 4 deletions

View File

@@ -93,7 +93,9 @@ func NewMainKubelet(
}
serviceStore := cache.NewStore()
cache.NewReflector(&cache.ListWatch{kubeClient, labels.Everything(), "services", api.NamespaceAll}, &api.Service{}, serviceStore).Run()
if kubeClient != nil {
cache.NewReflector(&cache.ListWatch{kubeClient, labels.Everything(), "services", api.NamespaceAll}, &api.Service{}, serviceStore).Run()
}
serviceLister := &cache.StoreToServiceLister{serviceStore}
klet := &Kubelet{