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

dm: fix cannot deploy grafana and prometheus #2257

Merged
merged 2 commits into from
Aug 20, 2023
Merged
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
2 changes: 1 addition & 1 deletion pkg/cluster/spec/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (i *GrafanaInstance) installDashboards(ctx context.Context, e ctxt.Executor
return errors.Annotatef(err, "stderr: %s", string(stderr))
}

srcPath := PackagePath(ComponentDMMaster, clusterVersion, i.OS(), i.Arch())
srcPath := PackagePath(GetDMMasterPackageName(i.topo), clusterVersion, i.OS(), i.Arch())
dstPath := filepath.Join(tmp, filepath.Base(srcPath))
err = e.Transfer(ctx, srcPath, dstPath, false, 0, false)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/spec/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func (i *MonitorInstance) installRules(ctx context.Context, e ctxt.Executor, dep
return errors.Annotatef(err, "stderr: %s", string(stderr))
}

srcPath := PackagePath(ComponentDMMaster, clusterVersion, i.OS(), i.Arch())
srcPath := PackagePath(GetDMMasterPackageName(i.topo), clusterVersion, i.OS(), i.Arch())
dstPath := filepath.Join(tmp, filepath.Base(srcPath))

err = e.Transfer(ctx, srcPath, dstPath, false, 0, false)
Expand Down
13 changes: 13 additions & 0 deletions pkg/cluster/spec/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,16 @@ func PackagePath(comp string, version string, os string, arch string) string {
fileName := fmt.Sprintf("%s-%s-%s-%s.tar.gz", comp, version, os, arch)
return ProfilePath(TiUPPackageCacheDir, fileName)
}

// GetDMMasterPackageName return package name of the first DMMaster instance
func GetDMMasterPackageName(topo Topology) string {
for _, c := range topo.ComponentsByStartOrder() {
if c.Name() == ComponentDMMaster {
instances := c.Instances()
if len(instances) > 0 {
return instances[0].ComponentSource()
}
}
}
return ComponentDMMaster
}
Loading