mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdmain: proxy ignores discovery if it is initialized
This commit is contained in:
parent
8ab388fa56
commit
dedabddcb3
@ -239,16 +239,6 @@ func startProxy(cfg *config) error {
|
|||||||
return fmt.Errorf("error setting up initial cluster: %v", err)
|
return fmt.Errorf("error setting up initial cluster: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.durl != "" {
|
|
||||||
s, err := discovery.GetCluster(cfg.durl, cfg.dproxy)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if urlsmap, err = types.NewURLsMap(s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pt, err := transport.NewTimeoutTransport(cfg.peerTLSInfo, time.Duration(cfg.proxyDialTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyReadTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyWriteTimeoutMs)*time.Millisecond)
|
pt, err := transport.NewTimeoutTransport(cfg.peerTLSInfo, time.Duration(cfg.proxyDialTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyReadTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyWriteTimeoutMs)*time.Millisecond)
|
||||||
pt.MaxIdleConnsPerHost = proxy.DefaultMaxIdleConnsPerHost
|
pt.MaxIdleConnsPerHost = proxy.DefaultMaxIdleConnsPerHost
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -272,6 +262,9 @@ func startProxy(cfg *config) error {
|
|||||||
b, err := ioutil.ReadFile(clusterfile)
|
b, err := ioutil.ReadFile(clusterfile)
|
||||||
switch {
|
switch {
|
||||||
case err == nil:
|
case err == nil:
|
||||||
|
if cfg.durl != "" {
|
||||||
|
plog.Warningf("discovery token ignored since the proxy has already been initialized. Valid cluster file found at ./%s", clusterfile)
|
||||||
|
}
|
||||||
urls := struct{ PeerURLs []string }{}
|
urls := struct{ PeerURLs []string }{}
|
||||||
err := json.Unmarshal(b, &urls)
|
err := json.Unmarshal(b, &urls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -280,6 +273,15 @@ func startProxy(cfg *config) error {
|
|||||||
peerURLs = urls.PeerURLs
|
peerURLs = urls.PeerURLs
|
||||||
plog.Infof("proxy: using peer urls %v from cluster file ./%s", peerURLs, clusterfile)
|
plog.Infof("proxy: using peer urls %v from cluster file ./%s", peerURLs, clusterfile)
|
||||||
case os.IsNotExist(err):
|
case os.IsNotExist(err):
|
||||||
|
if cfg.durl != "" {
|
||||||
|
s, err := discovery.GetCluster(cfg.durl, cfg.dproxy)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if urlsmap, err = types.NewURLsMap(s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
peerURLs = urlsmap.URLs()
|
peerURLs = urlsmap.URLs()
|
||||||
plog.Infof("proxy: using peer urls %v ", peerURLs)
|
plog.Infof("proxy: using peer urls %v ", peerURLs)
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user