From e899ab57bd832b977b4e38db92e93a05ddb3b251 Mon Sep 17 00:00:00 2001 From: nexustar Date: Mon, 11 Sep 2023 20:11:46 +0800 Subject: [PATCH] remove bindVersion --- components/cluster/command/root.go | 2 +- components/dm/command/root.go | 2 +- components/dm/spec/bindversion.go | 18 ------------------ pkg/cluster/manager/builder.go | 2 -- pkg/cluster/manager/deploy.go | 2 +- pkg/cluster/manager/manager.go | 3 --- pkg/cluster/manager/patch.go | 4 ++-- pkg/cluster/spec/server_config.go | 3 --- 8 files changed, 5 insertions(+), 31 deletions(-) delete mode 100644 components/dm/spec/bindversion.go diff --git a/components/cluster/command/root.go b/components/cluster/command/root.go index 5eaed5cf4d..e2cdf15e2f 100644 --- a/components/cluster/command/root.go +++ b/components/cluster/command/root.go @@ -110,7 +110,7 @@ func init() { } tidbSpec = spec.GetSpecManager() - cm = manager.NewManager("tidb", tidbSpec, spec.TiDBComponentVersion, log) + cm = manager.NewManager("tidb", tidbSpec, log) if cmd.Name() != "__complete" { logger.EnableAuditLog(spec.AuditDir()) } diff --git a/components/dm/command/root.go b/components/dm/command/root.go index e2a3f5df70..94c9bb2241 100644 --- a/components/dm/command/root.go +++ b/components/dm/command/root.go @@ -85,7 +85,7 @@ please backup your data before process.`, dmspec = spec.GetSpecManager() logger.EnableAuditLog(cspec.AuditDir()) - cm = manager.NewManager("dm", dmspec, spec.DMComponentVersion, log) + cm = manager.NewManager("dm", dmspec, log) // Running in other OS/ARCH Should be fine we only download manifest file. env, err = tiupmeta.InitEnv(repository.Options{ diff --git a/components/dm/spec/bindversion.go b/components/dm/spec/bindversion.go deleted file mode 100644 index cfda8ffa05..0000000000 --- a/components/dm/spec/bindversion.go +++ /dev/null @@ -1,18 +0,0 @@ -package spec - -import "github.com/pingcap/tiup/pkg/cluster/spec" - -// DMComponentVersion maps the dm version to the third components binding version -// Empty version means the latest stable one -func DMComponentVersion(comp, version string) string { - switch comp { - case spec.ComponentAlertmanager, - spec.ComponentGrafana, - spec.ComponentPrometheus, - spec.ComponentBlackboxExporter, - spec.ComponentNodeExporter: - return "" - default: - return version - } -} diff --git a/pkg/cluster/manager/builder.go b/pkg/cluster/manager/builder.go index 63c2380e98..a945a664f4 100644 --- a/pkg/cluster/manager/builder.go +++ b/pkg/cluster/manager/builder.go @@ -164,7 +164,6 @@ func buildScaleOutTask( newPart, m.logger, gOpt, - m.bindVersion, ) sshType := topo.BaseTopo().GlobalOptions.SSHType @@ -684,7 +683,6 @@ func buildDownloadCompTasks( topo spec.Topology, logger *logprinter.Logger, gOpt operator.Options, - bindVersion spec.BindVersion, ) []*task.StepDisplay { var tasks []*task.StepDisplay uniqueTaskList := set.NewStringSet() diff --git a/pkg/cluster/manager/deploy.go b/pkg/cluster/manager/deploy.go index feead30434..c9b413edd3 100644 --- a/pkg/cluster/manager/deploy.go +++ b/pkg/cluster/manager/deploy.go @@ -245,7 +245,7 @@ func (m *Manager) Deploy( } // Download missing component - downloadCompTasks = buildDownloadCompTasks(clusterVersion, topo, m.logger, gOpt, m.bindVersion) + downloadCompTasks = buildDownloadCompTasks(clusterVersion, topo, m.logger, gOpt) // Deploy components to remote topo.IterInstance(func(inst spec.Instance) { diff --git a/pkg/cluster/manager/manager.go b/pkg/cluster/manager/manager.go index ee2440d857..bfe15feddd 100644 --- a/pkg/cluster/manager/manager.go +++ b/pkg/cluster/manager/manager.go @@ -45,7 +45,6 @@ var ( type Manager struct { sysName string specManager *spec.SpecManager - bindVersion spec.BindVersion logger *logprinter.Logger } @@ -53,13 +52,11 @@ type Manager struct { func NewManager( sysName string, specManager *spec.SpecManager, - bindVersion spec.BindVersion, logger *logprinter.Logger, ) *Manager { return &Manager{ sysName: sysName, specManager: specManager, - bindVersion: bindVersion, logger: logger, } } diff --git a/pkg/cluster/manager/patch.go b/pkg/cluster/manager/patch.go index 501a1275d8..afbfa28a3d 100644 --- a/pkg/cluster/manager/patch.go +++ b/pkg/cluster/manager/patch.go @@ -78,7 +78,7 @@ func (m *Manager) Patch(name string, packagePath string, opt operator.Options, o if err != nil { return err } - if err := checkPackage(m.bindVersion, m.specManager, name, insts[0], insts[0].OS(), insts[0].Arch(), packagePath); err != nil { + if err := checkPackage(m.specManager, name, insts[0], insts[0].OS(), insts[0].Arch(), packagePath); err != nil { return err } @@ -139,7 +139,7 @@ func (m *Manager) Patch(name string, packagePath string, opt operator.Options, o return m.specManager.SaveMeta(name, metadata) } -func checkPackage(bindVersion spec.BindVersion, specManager *spec.SpecManager, name string, inst spec.Instance, nodeOS, arch, packagePath string) error { +func checkPackage(specManager *spec.SpecManager, name string, inst spec.Instance, nodeOS, arch, packagePath string) error { metadata := specManager.NewMetadata() if err := specManager.Metadata(name, metadata); err != nil { return err diff --git a/pkg/cluster/spec/server_config.go b/pkg/cluster/spec/server_config.go index f8a0113cb9..67207a6466 100644 --- a/pkg/cluster/spec/server_config.go +++ b/pkg/cluster/spec/server_config.go @@ -260,9 +260,6 @@ func mergeImported(importConfig []byte, specConfigs ...map[string]any) (map[stri return lhs, nil } -// BindVersion map the cluster version to the third components binding version. -type BindVersion func(comp string, version string) (bindVersion string) - func checkConfig(ctx context.Context, e ctxt.Executor, componentName, componentSource, version, nodeOS, arch, config string, paths meta.DirPaths) error { var cmd string configPath := path.Join(paths.Deploy, "conf", config)