Merge pull request #3589 from filbranden/fix_nil_interface_pointer_without_reflect1

Fix comparison of EtcdClient to nil so that it does not run into the pointer vs. interface issue
This commit is contained in:
Dawn Chen 2015-01-20 13:55:25 -08:00
commit d1af520bd0
2 changed files with 4 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
@ -55,7 +56,7 @@ func InitHealthChecking(k *Kubelet) {
}
// TODO: move this into a pkg/tools/etcd_tools
func EtcdClientOrDie(etcdServerList util.StringList, etcdConfigFile string) *etcd.Client {
func EtcdClientOrDie(etcdServerList util.StringList, etcdConfigFile string) tools.EtcdClient {
if len(etcdServerList) > 0 {
return etcd.NewClient(etcdServerList)
} else if etcdConfigFile != "" {

View File

@ -20,7 +20,6 @@ import (
"fmt"
"net"
"net/http"
"reflect"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
@ -232,11 +231,11 @@ func makePodSourceConfig(kc *KubeletConfig) *config.PodConfig {
glog.Infof("Adding manifest url: %v", kc.ManifestURL)
config.NewSourceURL(kc.ManifestURL, kc.HttpCheckFrequency, cfg.Channel(kubelet.HTTPSource))
}
if kc.EtcdClient != nil && !reflect.ValueOf(kc.EtcdClient).IsNil() {
if kc.EtcdClient != nil {
glog.Infof("Watching for etcd configs at %v", kc.EtcdClient.GetCluster())
config.NewSourceEtcd(config.EtcdKeyForHost(kc.Hostname), kc.EtcdClient, cfg.Channel(kubelet.EtcdSource))
}
if kc.KubeClient != nil && !reflect.ValueOf(kc.KubeClient).IsNil() {
if kc.KubeClient != nil {
glog.Infof("Watching apiserver")
config.NewSourceApiserver(kc.KubeClient, kc.Hostname, cfg.Channel(kubelet.ApiserverSource))
}