mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: deprecate "CAFile" field
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
82ef3f83f6
commit
c524ebe6fd
@ -247,7 +247,6 @@ type configJSON struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type securityConfig struct {
|
type securityConfig struct {
|
||||||
CAFile string `json:"ca-file"`
|
|
||||||
CertFile string `json:"cert-file"`
|
CertFile string `json:"cert-file"`
|
||||||
KeyFile string `json:"key-file"`
|
KeyFile string `json:"key-file"`
|
||||||
CertAuth bool `json:"client-cert-auth"`
|
CertAuth bool `json:"client-cert-auth"`
|
||||||
@ -421,7 +420,6 @@ func (cfg *configYAML) configFromFile(path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copySecurityDetails := func(tls *transport.TLSInfo, ysc *securityConfig) {
|
copySecurityDetails := func(tls *transport.TLSInfo, ysc *securityConfig) {
|
||||||
tls.CAFile = ysc.CAFile
|
|
||||||
tls.CertFile = ysc.CertFile
|
tls.CertFile = ysc.CertFile
|
||||||
tls.KeyFile = ysc.KeyFile
|
tls.KeyFile = ysc.KeyFile
|
||||||
tls.ClientCertAuth = ysc.CertAuth
|
tls.ClientCertAuth = ysc.CertAuth
|
||||||
@ -525,7 +523,7 @@ func (cfg *Config) PeerURLsMapAndToken(which string) (urlsmap types.URLsMap, tok
|
|||||||
plog.Noticef("got bootstrap from DNS for etcd-server at %s", s)
|
plog.Noticef("got bootstrap from DNS for etcd-server at %s", s)
|
||||||
}
|
}
|
||||||
clusterStr := strings.Join(clusterStrs, ",")
|
clusterStr := strings.Join(clusterStrs, ",")
|
||||||
if strings.Contains(clusterStr, "https://") && cfg.PeerTLSInfo.CAFile == "" {
|
if strings.Contains(clusterStr, "https://") && cfg.PeerTLSInfo.TrustedCAFile == "" {
|
||||||
cfg.PeerTLSInfo.ServerName = cfg.DNSCluster
|
cfg.PeerTLSInfo.ServerName = cfg.DNSCluster
|
||||||
}
|
}
|
||||||
urlsmap, err = types.NewURLsMap(clusterStr)
|
urlsmap, err = types.NewURLsMap(clusterStr)
|
||||||
|
@ -27,8 +27,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestConfigFileOtherFields(t *testing.T) {
|
func TestConfigFileOtherFields(t *testing.T) {
|
||||||
ctls := securityConfig{CAFile: "cca", CertFile: "ccert", KeyFile: "ckey"}
|
ctls := securityConfig{TrustedCAFile: "cca", CertFile: "ccert", KeyFile: "ckey"}
|
||||||
ptls := securityConfig{CAFile: "pca", CertFile: "pcert", KeyFile: "pkey"}
|
ptls := securityConfig{TrustedCAFile: "pca", CertFile: "pcert", KeyFile: "pkey"}
|
||||||
yc := struct {
|
yc := struct {
|
||||||
ClientSecurityCfgFile securityConfig `json:"client-transport-security"`
|
ClientSecurityCfgFile securityConfig `json:"client-transport-security"`
|
||||||
PeerSecurityCfgFile securityConfig `json:"peer-transport-security"`
|
PeerSecurityCfgFile securityConfig `json:"peer-transport-security"`
|
||||||
@ -129,8 +129,7 @@ func TestUpdateDefaultClusterFromNameOverwrite(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *securityConfig) equals(t *transport.TLSInfo) bool {
|
func (s *securityConfig) equals(t *transport.TLSInfo) bool {
|
||||||
return s.CAFile == t.CAFile &&
|
return s.CertFile == t.CertFile &&
|
||||||
s.CertFile == t.CertFile &&
|
|
||||||
s.CertAuth == t.ClientCertAuth &&
|
s.CertAuth == t.ClientCertAuth &&
|
||||||
s.TrustedCAFile == t.TrustedCAFile
|
s.TrustedCAFile == t.TrustedCAFile
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user