Skip to content

Commit

Permalink
Merge pull request kubernetes#3589 from filbranden/fix_nil_interface_…
Browse files Browse the repository at this point in the history
…pointer_without_reflect1

Fix comparison of EtcdClient to nil so that it does not run into the pointer vs. interface issue
  • Loading branch information
dchen1107 committed Jan 20, 2015
2 parents dd6cc78 + 79ff06f commit d1af520
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/kubelet/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 != "" {
Expand Down
5 changes: 2 additions & 3 deletions pkg/standalone/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"net"
"net/http"
"reflect"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit d1af520

Please sign in to comment.