Move clientconfig into clientv3 so that it can be reused by both etcdctl and v3 discovery
This commit is contained in:
@ -31,6 +31,7 @@ import (
|
||||
"go.etcd.io/etcd/client/pkg/v3/tlsutil"
|
||||
"go.etcd.io/etcd/client/pkg/v3/transport"
|
||||
"go.etcd.io/etcd/client/pkg/v3/types"
|
||||
"go.etcd.io/etcd/client/v3"
|
||||
"go.etcd.io/etcd/pkg/v3/flags"
|
||||
"go.etcd.io/etcd/pkg/v3/netutil"
|
||||
"go.etcd.io/etcd/server/v3/config"
|
||||
@ -516,10 +517,15 @@ func NewConfig() *Config {
|
||||
V2Deprecation: config.V2_DEPR_DEFAULT,
|
||||
|
||||
DiscoveryCfg: v3discovery.DiscoveryConfig{
|
||||
DialTimeout: DefaultDiscoveryDialTimeout,
|
||||
RequestTimeOut: DefaultDiscoveryRequestTimeOut,
|
||||
KeepAliveTime: DefaultDiscoveryKeepAliveTime,
|
||||
KeepAliveTimeout: DefaultDiscoveryKeepAliveTimeOut,
|
||||
ClientConfig: clientv3.ClientConfig{
|
||||
DialTimeout: DefaultDiscoveryDialTimeout,
|
||||
RequestTimeout: DefaultDiscoveryRequestTimeOut,
|
||||
KeepAliveTime: DefaultDiscoveryKeepAliveTime,
|
||||
KeepAliveTimeout: DefaultDiscoveryKeepAliveTimeOut,
|
||||
|
||||
Secure: &clientv3.SecureConfig{},
|
||||
Auth: &clientv3.AuthConfig{},
|
||||
},
|
||||
},
|
||||
}
|
||||
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
|
||||
@ -688,11 +694,11 @@ func (cfg *Config) Validate() error {
|
||||
v2discoveryFlagsExist := cfg.Dproxy != ""
|
||||
v3discoveryFlagsExist := len(cfg.DiscoveryCfg.Endpoints) > 0 ||
|
||||
cfg.DiscoveryCfg.Token != "" ||
|
||||
cfg.DiscoveryCfg.CertFile != "" ||
|
||||
cfg.DiscoveryCfg.KeyFile != "" ||
|
||||
cfg.DiscoveryCfg.TrustedCAFile != "" ||
|
||||
cfg.DiscoveryCfg.User != "" ||
|
||||
cfg.DiscoveryCfg.Password != ""
|
||||
cfg.DiscoveryCfg.Secure.Cert != "" ||
|
||||
cfg.DiscoveryCfg.Secure.Key != "" ||
|
||||
cfg.DiscoveryCfg.Secure.Cacert != "" ||
|
||||
cfg.DiscoveryCfg.Auth.Username != "" ||
|
||||
cfg.DiscoveryCfg.Auth.Password != ""
|
||||
|
||||
if v2discoveryFlagsExist && v3discoveryFlagsExist {
|
||||
return errors.New("both v2 discovery settings (discovery, discovery-proxy) " +
|
||||
|
Reference in New Issue
Block a user