Merge pull request #13257 from tangcong/automated-cherry-pick-of-#13145-#13237-origin-release-3.5
[backport 3.5]: Automated cherry pick of #13145 #13237
This commit is contained in:
commit
2fe94b19d3
@ -125,6 +125,9 @@ peer-transport-security:
|
|||||||
# Peer TLS using generated certificates.
|
# Peer TLS using generated certificates.
|
||||||
auto-tls: false
|
auto-tls: false
|
||||||
|
|
||||||
|
# The validity period of the self-signed certificate, the unit is year.
|
||||||
|
self-signed-cert-validity: 1
|
||||||
|
|
||||||
# Enable debug-level logging for etcd.
|
# Enable debug-level logging for etcd.
|
||||||
log-level: debug
|
log-level: debug
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ type Config struct {
|
|||||||
// SelfSignedCertValidity specifies the validity period of the client and peer certificates
|
// SelfSignedCertValidity specifies the validity period of the client and peer certificates
|
||||||
// that are automatically generated by etcd when you specify ClientAutoTLS and PeerAutoTLS,
|
// that are automatically generated by etcd when you specify ClientAutoTLS and PeerAutoTLS,
|
||||||
// the unit is year, and the default is 1
|
// the unit is year, and the default is 1
|
||||||
SelfSignedCertValidity uint
|
SelfSignedCertValidity uint `json:"self-signed-cert-validity"`
|
||||||
|
|
||||||
// CipherSuites is a list of supported TLS cipher suites between
|
// CipherSuites is a list of supported TLS cipher suites between
|
||||||
// client/server and peers. If empty, Go auto-populates the list.
|
// client/server and peers. If empty, Go auto-populates the list.
|
||||||
@ -591,7 +591,9 @@ func (cfg *configYAML) configFromFile(path string) error {
|
|||||||
copySecurityDetails(&cfg.PeerTLSInfo, &cfg.PeerSecurityJSON)
|
copySecurityDetails(&cfg.PeerTLSInfo, &cfg.PeerSecurityJSON)
|
||||||
cfg.ClientAutoTLS = cfg.ClientSecurityJSON.AutoTLS
|
cfg.ClientAutoTLS = cfg.ClientSecurityJSON.AutoTLS
|
||||||
cfg.PeerAutoTLS = cfg.PeerSecurityJSON.AutoTLS
|
cfg.PeerAutoTLS = cfg.PeerSecurityJSON.AutoTLS
|
||||||
|
if cfg.SelfSignedCertValidity == 0 {
|
||||||
|
cfg.SelfSignedCertValidity = 1
|
||||||
|
}
|
||||||
return cfg.Validate()
|
return cfg.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"go.etcd.io/etcd/api/v3/etcdserverpb"
|
"go.etcd.io/etcd/api/v3/etcdserverpb"
|
||||||
"go.etcd.io/etcd/raft/v3"
|
"go.etcd.io/etcd/raft/v3"
|
||||||
|
"go.etcd.io/etcd/server/v3/auth"
|
||||||
"go.etcd.io/etcd/server/v3/etcdserver"
|
"go.etcd.io/etcd/server/v3/etcdserver"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
@ -193,7 +194,7 @@ func checkV3Health(lg *zap.Logger, srv *etcdserver.EtcdServer, excludedAlarms Al
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), srv.Cfg.ReqTimeout())
|
ctx, cancel := context.WithTimeout(context.Background(), srv.Cfg.ReqTimeout())
|
||||||
_, err := srv.Range(ctx, &etcdserverpb.RangeRequest{KeysOnly: true, Limit: 1})
|
_, err := srv.Range(ctx, &etcdserverpb.RangeRequest{KeysOnly: true, Limit: 1})
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil && err != auth.ErrUserEmpty && err != auth.ErrPermissionDenied {
|
||||||
h.Health = "false"
|
h.Health = "false"
|
||||||
h.Reason = fmt.Sprintf("RANGE ERROR:%s", err)
|
h.Reason = fmt.Sprintf("RANGE ERROR:%s", err)
|
||||||
lg.Warn("serving /health false; Range fails", zap.Error(err))
|
lg.Warn("serving /health false; Range fails", zap.Error(err))
|
||||||
|
Loading…
Reference in New Issue
Block a user