mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
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:
commit
d1af520bd0
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/coreos/go-etcd/etcd"
|
"github.com/coreos/go-etcd/etcd"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -55,7 +56,7 @@ func InitHealthChecking(k *Kubelet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this into a pkg/tools/etcd_tools
|
// 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 {
|
if len(etcdServerList) > 0 {
|
||||||
return etcd.NewClient(etcdServerList)
|
return etcd.NewClient(etcdServerList)
|
||||||
} else if etcdConfigFile != "" {
|
} else if etcdConfigFile != "" {
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
@ -232,11 +231,11 @@ func makePodSourceConfig(kc *KubeletConfig) *config.PodConfig {
|
|||||||
glog.Infof("Adding manifest url: %v", kc.ManifestURL)
|
glog.Infof("Adding manifest url: %v", kc.ManifestURL)
|
||||||
config.NewSourceURL(kc.ManifestURL, kc.HttpCheckFrequency, cfg.Channel(kubelet.HTTPSource))
|
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())
|
glog.Infof("Watching for etcd configs at %v", kc.EtcdClient.GetCluster())
|
||||||
config.NewSourceEtcd(config.EtcdKeyForHost(kc.Hostname), kc.EtcdClient, cfg.Channel(kubelet.EtcdSource))
|
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")
|
glog.Infof("Watching apiserver")
|
||||||
config.NewSourceApiserver(kc.KubeClient, kc.Hostname, cfg.Channel(kubelet.ApiserverSource))
|
config.NewSourceApiserver(kc.KubeClient, kc.Hostname, cfg.Channel(kubelet.ApiserverSource))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user