diff --git a/go.mod b/go.mod index 6c67a2e88a5..d2a2bb07078 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,11 @@ require ( github.com/pingcap/kvproto v0.0.0-20230407040905-68d0eebd564a github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 +======= + github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/prometheus/client_golang v1.11.1 github.com/prometheus/common v0.26.0 github.com/sasha-s/go-deadlock v0.2.0 diff --git a/go.sum b/go.sum index 22917e9da5a..937d02fd587 100644 --- a/go.sum +++ b/go.sum @@ -449,8 +449,13 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM= +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8= github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw= +======= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c h1:iEZwsxxOxXaH0zEfzVAn6fjveOlPh3v3DsYlhWJAVi0= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c= +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4= github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= diff --git a/pkg/dashboard/adapter/config.go b/pkg/dashboard/adapter/config.go index 63c900acf77..a1661b84f2b 100644 --- a/pkg/dashboard/adapter/config.go +++ b/pkg/dashboard/adapter/config.go @@ -38,6 +38,9 @@ func GenDashboardConfig(srv *server.Server) (*config.Config, error) { if dashboardCfg.ClusterTLSConfig, err = cfg.Security.ToTLSConfig(); err != nil { return nil, err } + if dashboardCfg.ClusterTLSInfo, err = cfg.Security.ToTLSInfo(); err != nil { + return nil, err + } if dashboardCfg.TiDBTLSConfig, err = cfg.Dashboard.ToTiDBTLSConfig(); err != nil { return nil, err } diff --git a/pkg/utils/grpcutil/grpcutil.go b/pkg/utils/grpcutil/grpcutil.go index 5aae6d97e34..0cf39a45157 100644 --- a/pkg/utils/grpcutil/grpcutil.go +++ b/pkg/utils/grpcutil/grpcutil.go @@ -47,6 +47,24 @@ type TLSConfig struct { SSLKEYBytes []byte } +// ToTLSInfo converts TLSConfig to transport.TLSInfo. +func (s TLSConfig) ToTLSInfo() (*transport.TLSInfo, error) { + if len(s.CertPath) == 0 && len(s.KeyPath) == 0 { + return nil, nil + } + allowedCN, err := s.GetOneAllowedCN() + if err != nil { + return nil, err + } + + return &transport.TLSInfo{ + CertFile: s.CertPath, + KeyFile: s.KeyPath, + TrustedCAFile: s.CAPath, + AllowedCN: allowedCN, + }, nil +} + // ToTLSConfig generates tls config. func (s TLSConfig) ToTLSConfig() (*tls.Config, error) { if len(s.SSLCABytes) != 0 || len(s.SSLCertBytes) != 0 || len(s.SSLKEYBytes) != 0 { @@ -68,19 +86,12 @@ func (s TLSConfig) ToTLSConfig() (*tls.Config, error) { }, nil } - if len(s.CertPath) == 0 && len(s.KeyPath) == 0 { + tlsInfo, err := s.ToTLSInfo() + if tlsInfo == nil { return nil, nil } - allowedCN, err := s.GetOneAllowedCN() if err != nil { - return nil, err - } - - tlsInfo := transport.TLSInfo{ - CertFile: s.CertPath, - KeyFile: s.KeyPath, - TrustedCAFile: s.CAPath, - AllowedCN: allowedCN, + return nil, errs.ErrEtcdTLSConfig.Wrap(err).GenWithStackByCause() } tlsConfig, err := tlsInfo.ClientConfig() diff --git a/tests/integrations/client/go.mod b/tests/integrations/client/go.mod index e3ad32eda8b..dccbf1b196a 100644 --- a/tests/integrations/client/go.mod +++ b/tests/integrations/client/go.mod @@ -122,7 +122,11 @@ require ( github.com/pingcap/errcode v0.3.0 // indirect github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect +======= + github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c // indirect +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/tests/integrations/client/go.sum b/tests/integrations/client/go.sum index df83e220389..cd51860631e 100644 --- a/tests/integrations/client/go.sum +++ b/tests/integrations/client/go.sum @@ -412,8 +412,13 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM= +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8= github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw= +======= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c h1:iEZwsxxOxXaH0zEfzVAn6fjveOlPh3v3DsYlhWJAVi0= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c= +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4= github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= diff --git a/tests/integrations/mcs/go.mod b/tests/integrations/mcs/go.mod index af49c87e320..78657883080 100644 --- a/tests/integrations/mcs/go.mod +++ b/tests/integrations/mcs/go.mod @@ -124,7 +124,11 @@ require ( github.com/pingcap/errcode v0.3.0 // indirect github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect +======= + github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c // indirect +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect diff --git a/tests/integrations/mcs/go.sum b/tests/integrations/mcs/go.sum index 057de20b2c7..3aa2f45084b 100644 --- a/tests/integrations/mcs/go.sum +++ b/tests/integrations/mcs/go.sum @@ -421,8 +421,13 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM= +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8= github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw= +======= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c h1:iEZwsxxOxXaH0zEfzVAn6fjveOlPh3v3DsYlhWJAVi0= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c= +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4= github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= diff --git a/tests/integrations/tso/go.mod b/tests/integrations/tso/go.mod index 58bbacf6532..6b8f58fff6b 100644 --- a/tests/integrations/tso/go.mod +++ b/tests/integrations/tso/go.mod @@ -121,7 +121,11 @@ require ( github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 // indirect github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect +======= + github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c // indirect +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/tests/integrations/tso/go.sum b/tests/integrations/tso/go.sum index e46ec710f45..c934971fa2a 100644 --- a/tests/integrations/tso/go.sum +++ b/tests/integrations/tso/go.sum @@ -412,8 +412,13 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I= github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM= +<<<<<<< HEAD github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8= github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw= +======= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c h1:iEZwsxxOxXaH0zEfzVAn6fjveOlPh3v3DsYlhWJAVi0= +github.com/pingcap/tidb-dashboard v0.0.0-20231218095437-aa621ed4de2c/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c= +>>>>>>> 83da4c26b (dashboard: Pass TLS info to dashboard to fix TiKV heap profiling (#7563)) github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4= github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=