Skip to content

Commit

Permalink
grafana: fix lightning's name not changed when cluster renamed (#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvisa authored and AstroProfundis committed Mar 24, 2021
1 parent 9b0e00c commit 66b79ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/cluster/api/binlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ func NewBinlogClient(pdEndpoint []string, tlsConfig *tls.Config) (*BinlogClient,
}

func (c *BinlogClient) getURL(addr string) string {
schema := "http"
scheme := "http"
if c.tls != nil {
schema = "https"
scheme = "https"
}

return fmt.Sprintf("%s://%s", schema, addr)
return fmt.Sprintf("%s://%s", scheme, addr)
}

func (c *BinlogClient) getOfflineURL(addr string, nodeID string) string {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cluster/manager/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ func (m *Manager) Display(name string, opt operator.Options) error {
var err error
dashboardAddr, err = t.GetDashboardAddress(tlsCfg, masterActive...)
if dashboardAddr != "" && err == nil {
schema := "http"
scheme := "http"
if tlsCfg != nil {
schema = "https"
scheme = "https"
}
fmt.Printf("Dashboard URL: %s\n", cyan.Sprintf("%s://%s/dashboard", schema, dashboardAddr))
fmt.Printf("Dashboard URL: %s\n", cyan.Sprintf("%s://%s/dashboard", scheme, dashboardAddr))
}
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/cluster/spec/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package spec
import (
"crypto/tls"
"fmt"
"path"
"path/filepath"
"reflect"
"strings"
Expand Down Expand Up @@ -220,10 +219,12 @@ func (i *GrafanaInstance) initDashboards(e executor.Executor, spec GrafanaSpec,
for _, cmd := range []string{
`find %s -type f -exec sed -i "s/\${DS_.*-CLUSTER}/%s/g" {} \;`,
`find %s -type f -exec sed -i "s/DS_.*-CLUSTER/%s/g" {} \;`,
`find %s -type f -exec sed -i "s/\${DS_LIGHTNING}/%s/g" {} \;`,
`find %s -type f -exec sed -i "s/DS_LIGHTNING/%s/g" {} \;`,
`find %s -type f -exec sed -i "s/test-cluster/%s/g" {} \;`,
`find %s -type f -exec sed -i "s/Test-Cluster/%s/g" {} \;`,
} {
cmd := fmt.Sprintf(cmd, path.Join(paths.Deploy, "dashboards"), clusterName)
cmd := fmt.Sprintf(cmd, dashboardsDir, clusterName)
_, stderr, err := e.Execute(cmd, false)
if err != nil {
return errors.Annotatef(err, "stderr: %s", string(stderr))
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (e *TiKVLabelError) Error() string {
return str
}

// TiKVLabelProvider provide store labels information
// TiKVLabelProvider provides the store labels information
type TiKVLabelProvider interface {
GetTiKVLabels() (map[string]map[string]string, error)
}
Expand Down

0 comments on commit 66b79ac

Please sign in to comment.