Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TiDB Dashboard] Playground deploys seperated dashboard server by default. Other improvements. #2091

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion embed/examples/cluster/local.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ alertmanager_servers:
{{- range .AlertManagerServers }}
- host: {{ . }}
{{- end }}
{{ end }}
{{ end }}
{{- if .TidbDashboardServers }}
tidb_dashboard_servers:
{{- range .TidbDashboardServers }}
- host: {{ . }}
{{- end }}
{{ end }}
17 changes: 17 additions & 0 deletions embed/examples/cluster/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,20 @@ alertmanager_servers:
# data_dir: "/tidb-data/alertmanager-9093"
# # Alertmanager log file storage directory.
# log_dir: "/tidb-deploy/alertmanager-9093/log"

# # Server configs are used to specify the configuration of TiDB Dashboard Servers.
tidb_dashboard_servers:
# # The ip address of the PD Server.
- host: 10.0.1.11
# # SSH port of the server.
# ssh_port: 22
# # port of TiDB Dashboard
# port: 2380
# # TiDB Dashboard deployment file, startup script, configuration file storage directory.
# deploy_dir: "/tidb-deploy/tidb-dashboard-23333"
# # PD Server data storage directory.
# data_dir: "/tidb-data/tidb-dashboard-23333"
# # PD Server log file storage directory.
# log_dir: "/tidb-deploy/tidb-dashboard-23333/log"
# # numa node bindings.
# numa_node: "0,1"
19 changes: 18 additions & 1 deletion embed/examples/cluster/multi-dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ server_configs:
# tiflash-learner:
pd:
# # Label level settings.
replication.location-labels: ["zone","dc","rack","host"]
replication.location-labels: [ "zone","dc","rack","host" ]
# # Number of replicas of TiKV data
replication.max-replicas: 5
# # Prohibit the leader be scheduled to the specified label place.
Expand Down Expand Up @@ -310,3 +310,20 @@ alertmanager_servers:
# data_dir: "/tidb-data/alertmanager-9093"
# # Alertmanager log file storage directory.
# log_dir: "/tidb-deploy/alertmanager-9093/log"

# # Server configs are used to specify the configuration of TiDB Dashboard Servers.
tidb_dashboard_servers:
# # The ip address of the PD Server.
- host: 10.0.1.11
# # SSH port of the server.
# ssh_port: 22
# # port of TiDB Dashboard
# port: 2380
# # TiDB Dashboard deployment file, startup script, configuration file storage directory.
# deploy_dir: "/tidb-deploy/tidb-dashboard-23333"
# # PD Server data storage directory.
# data_dir: "/tidb-data/tidb-dashboard-23333"
# # PD Server log file storage directory.
# log_dir: "/tidb-deploy/tidb-dashboard-23333/log"
# # numa node bindings.
# numa_node: "0,1"
2 changes: 1 addition & 1 deletion embed/examples/cluster/topology.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ kvcdc_servers:

# # Server configs are used to specify the configuration of TiDB Dashboard Servers.
tidb_dashboard_servers:
# # The ip address of the PD Server.
# # The ip address of the TiDB Dashboard server.
- host: 10.0.1.11
# # SSH port of the server.
# ssh_port: 22
Expand Down
7 changes: 6 additions & 1 deletion embed/templates/scripts/run_tidb-dashboard.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ exec bin/tidb-dashboard \
--port="{{.Port}}" \
--pd="{{.PD}}" \
--data-dir="{{.DataDir}}" \
{{- if .TLSEnabled}}
{{- if .ClusterTLSEnabled}}
--tidb-ca tls/ca.crt \
--tidb-cert tls/tidb-dashboard.crt \
--tidb-key tls/tidb-dashboard.pem \
{{- end}}
{{- if .MysqlClientTLSEnabled}}
--tidb-ca tls/ca.crt \
--tidb-cert tls/tidb-dashboard.crt \
--tidb-key tls/tidb-dashboard.pem \
Expand Down
28 changes: 16 additions & 12 deletions pkg/cluster/spec/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,16 @@ func (i *DashboardInstance) InitConfig(
pds = append(pds, pdspec.GetAdvertiseClientURL(enableTLS))
}
cfg := &scripts.DashboardScript{
TidbVersion: clusterVersion,
IP: i.GetHost(),
DeployDir: paths.Deploy,
DataDir: paths.Data[0],
LogDir: paths.Log,
Port: spec.Port,
NumaNode: spec.NumaNode,
PD: strings.Join(pds, ","),
TLSEnabled: enableTLS,
TidbVersion: clusterVersion,
IP: i.GetHost(),
DeployDir: paths.Deploy,
DataDir: paths.Data[0],
LogDir: paths.Log,
Port: spec.Port,
NumaNode: spec.NumaNode,
PD: strings.Join(pds, ","),
ClusterTLSEnabled: enableTLS,
ClusterTLSCAPath: "placeholder",
}

fp := filepath.Join(paths.Cache, fmt.Sprintf("run_tidb-dashboard_%s_%d.sh", i.GetHost(), i.GetPort()))
Expand All @@ -203,7 +204,10 @@ func (i *DashboardInstance) InitConfig(
return checkConfig(ctx, e, i.ComponentName(), clusterVersion, i.OS(), i.Arch(), i.ComponentName()+".toml", paths, nil)
}

// setTLSConfig set TLS Config to support enable/disable TLS
func (i *DashboardInstance) setTLSConfig(ctx context.Context, enableTLS bool, configs map[string]any, paths meta.DirPaths) (map[string]any, error) {
return nil, nil
func (i *DashboardInstance) setClusterTLS() {

}

func (i *DashboardInstance) setMysqlClientTLS() {

}
33 changes: 23 additions & 10 deletions pkg/cluster/template/scripts/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,30 @@ import (
"github.com/pingcap/tiup/embed"
)

// DashboardScript represent the data to generate cdc config
// DashboardScript represents the data structure for generating startup shell scripts,
// with the help of Go Templates.
type DashboardScript struct {
TidbVersion string
IP string
Port int
DeployDir string
LogDir string
DataDir string
NumaNode string
TLSEnabled bool
PD string
TidbVersion string
IP string
Port int
DeployDir string
LogDir string
DataDir string
NumaNode string
PD string
Telemetry bool
Experimental bool
PathPrefix string

ClusterTLSEnabled bool
ClusterTLSCAPath string
ClusterTLSCertPath string
ClusterTLSKeyPath string

MysqlClientTLSEnabled bool
MysqlClientTLSCAPath string
MysqlClientTLSCertPath string
MysqlClientTLSKeyPath string
}

// ConfigToFile write config content to specific file.
Expand Down