Skip to content

Commit

Permalink
Merge branch 'master' into issue-1636
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored Dec 13, 2021
2 parents a17e345 + b01e507 commit ca34485
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion embed/templates/scripts/run_alertmanager.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ exec bin/alertmanager/alertmanager \
--cluster.peer="{{$am.IP}}:{{$am.ClusterPort}}" \
{{- end}}
{{- end}}
--cluster.listen-address="{{.IP}}:{{.ClusterPort}}"
--cluster.listen-address="{{.ListenHost}}:{{.ClusterPort}}"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/pingcap/tiup
go 1.16

replace (
github.com/appleboy/easyssh-proxy => github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20210615044136-d52fc631316d
github.com/appleboy/easyssh-proxy => github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20211209071554-9910ebdf514e
gopkg.in/yaml.v2 => github.com/july2993/yaml v0.0.0-20200423062752-adcfa5abe2ed
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20210615044136-d52fc631316d h1:jsOHh5HJR1sYE1wYxuYQa2nSc01V0/6ZNRIS2qNW1zg=
github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20210615044136-d52fc631316d/go.mod h1:SnOlkuIAoaj8FvRIGcWp2BbLOwvHZnNNOva+DBMbHWU=
github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20211209071554-9910ebdf514e h1:4j6hTmpAhrJYt8XhG/mLJYywzsclH6pqAim1H7HBM/o=
github.com/AstroProfundis/easyssh-proxy v1.3.10-0.20211209071554-9910ebdf514e/go.mod h1:SnOlkuIAoaj8FvRIGcWp2BbLOwvHZnNNOva+DBMbHWU=
github.com/AstroProfundis/sysinfo v0.0.0-20210901042104-765f00aa1304 h1:xjoJdgLCgiPv8CNEnsHP+W6UJ/JiNbALll6csqw3hbg=
github.com/AstroProfundis/sysinfo v0.0.0-20210901042104-765f00aa1304/go.mod h1:4m15VhW6ZffaqJNAK/HtN3Qvf97aCe1T39u3UXaA2lA=
github.com/AstroProfundis/tabby v1.1.1-color h1:gi/Fs4W2KVcC1m29lqa39tDnsGfZG/PYvZmwOhAH5m0=
Expand Down
3 changes: 2 additions & 1 deletion pkg/cluster/spec/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type AlertmanagerSpec struct {
IgnoreExporter bool `yaml:"ignore_exporter,omitempty"`
WebPort int `yaml:"web_port" default:"9093"`
ClusterPort int `yaml:"cluster_port" default:"9094"`
ListenHost string `yaml:"listen_host,omitempty" validate:"listen_host:editable"`
DeployDir string `yaml:"deploy_dir,omitempty"`
DataDir string `yaml:"data_dir,omitempty"`
LogDir string `yaml:"log_dir,omitempty"`
Expand Down Expand Up @@ -144,7 +145,7 @@ func (i *AlertManagerInstance) InitConfig(
enableTLS := gOpts.TLSEnabled
// Transfer start script
spec := i.InstanceSpec.(*AlertmanagerSpec)
cfg := scripts.NewAlertManagerScript(spec.Host, paths.Deploy, paths.Data[0], paths.Log, enableTLS).
cfg := scripts.NewAlertManagerScript(spec.Host, spec.ListenHost, paths.Deploy, paths.Data[0], paths.Log, enableTLS).
WithWebPort(spec.WebPort).WithClusterPort(spec.ClusterPort).WithNumaNode(spec.NumaNode).
AppendEndpoints(AlertManagerEndpoints(alertmanagers, deployUser, enableTLS))

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 @@ -773,6 +773,7 @@ func AlertManagerEndpoints(alertmanager []*AlertmanagerSpec, user string, enable

script := scripts.NewAlertManagerScript(
spec.Host,
spec.ListenHost,
deployDir,
dataDir,
logDir,
Expand Down
7 changes: 6 additions & 1 deletion pkg/cluster/template/scripts/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
// AlertManagerScript represent the data to generate AlertManager start script
type AlertManagerScript struct {
IP string
ListenHost string
WebPort int
ClusterPort int
DeployDir string
Expand All @@ -36,9 +37,13 @@ type AlertManagerScript struct {
}

// NewAlertManagerScript returns a AlertManagerScript with given arguments
func NewAlertManagerScript(ip, deployDir, dataDir, logDir string, enableTLS bool) *AlertManagerScript {
func NewAlertManagerScript(ip, listenHost, deployDir, dataDir, logDir string, enableTLS bool) *AlertManagerScript {
if listenHost == "" {
listenHost = ip
}
return &AlertManagerScript{
IP: ip,
ListenHost: listenHost,
WebPort: 9093,
ClusterPort: 9094,
DeployDir: deployDir,
Expand Down

0 comments on commit ca34485

Please sign in to comment.