Skip to content

Commit

Permalink
cluster/dm: add gloabl listen_host (#2303)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar authored Nov 8, 2023
1 parent eb2f058 commit 2eaf957
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions components/dm/spec/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (c *DMMasterComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down Expand Up @@ -304,6 +305,7 @@ func (c *DMWorkerComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
2 changes: 2 additions & 0 deletions embed/examples/cluster/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ global:
deploy_dir: "/tidb-deploy"
# # TiDB Cluster data storage directory
data_dir: "/tidb-data"
# # default listen_host for all components
listen_host: 0.0.0.0
# # Supported values: "amd64", "arm64" (default: "amd64")
arch: "amd64"
# # Resource Control is used to limit the resource of an instance.
Expand Down
2 changes: 2 additions & 0 deletions embed/examples/cluster/multi-dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ global:
deploy_dir: "/tidb-deploy"
# # TiDB Cluster data storage directory
data_dir: "/tidb-data"
# # default listen_host for all components
listen_host: 0.0.0.0
# # Supported values: "amd64", "arm64" (default: "amd64")
arch: "amd64"
# # Resource Control is used to limit the resource of an instance.
Expand Down
2 changes: 2 additions & 0 deletions embed/examples/cluster/topology.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ global:
deploy_dir: "/tidb-deploy"
# # TiDB Cluster data storage directory
data_dir: "/tidb-data"
# # default listen_host for all components
listen_host: 0.0.0.0
# # Supported values: "amd64", "arm64" (default: "amd64")
arch: "amd64"
# # Resource Control is used to limit the resource of an instance.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (c *AlertManagerComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: s.ListenHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Port: s.WebPort,
SSHP: s.SSHPort,
NumaNode: s.NumaNode,
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (c *CDCComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (c *DashboardComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.Source,
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/drainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func (c *DrainerComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (c *GrafanaComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
NumaNode: "",
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (c *MonitorComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
NumaNode: s.NumaNode,
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (c *PDComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: s.ListenHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Port: s.ClientPort,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (c *PumpComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type (
SSHPort int `yaml:"ssh_port,omitempty" default:"22" validate:"ssh_port:editable"`
SSHType executor.SSHType `yaml:"ssh_type,omitempty" default:"builtin"`
TLSEnabled bool `yaml:"enable_tls,omitempty"`
ListenHost string `yaml:"listen_host,omitempty" validate:"listen_host:editable"`
DeployDir string `yaml:"deploy_dir,omitempty" default:"deploy"`
DataDir string `yaml:"data_dir,omitempty" default:"data"`
LogDir string `yaml:"log_dir,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (c *TiDBComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: s.ListenHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Port: s.Port,
SSHP: s.SSHPort,
Source: s.Source,
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/tiflash.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (c *TiFlashComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.GetMainPort(),
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/tikv.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (c *TiKVComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: s.ListenHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Port: s.Port,
SSHP: s.SSHPort,
Source: s.Source,
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/tikv_cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (c *TiKVCDCComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: s.GetSource(),
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/spec/tiproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (c *TiProxyComponent) Instances() []Instance {
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: c.Topology.BaseTopo().GlobalOptions.ListenHost,
Port: s.Port,
SSHP: s.SSHPort,
Source: ComponentTiProxy,
Expand Down

0 comments on commit 2eaf957

Please sign in to comment.