From d13ebe35175d728a2a79b16cbb6549ebc1ef3767 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 6 Mar 2024 13:47:43 +0800 Subject: [PATCH] change the source Signed-off-by: Ryan Leung --- pkg/cluster/clusterutil/cluster.go | 3 --- pkg/cluster/spec/scheduling.go | 4 ++-- pkg/cluster/spec/spec.go | 20 +++++++++----------- pkg/cluster/spec/tso.go | 4 ++-- pkg/cluster/task/builder.go | 9 --------- 5 files changed, 13 insertions(+), 27 deletions(-) diff --git a/pkg/cluster/clusterutil/cluster.go b/pkg/cluster/clusterutil/cluster.go index 511bd58c4a..8026cf5208 100644 --- a/pkg/cluster/clusterutil/cluster.go +++ b/pkg/cluster/clusterutil/cluster.go @@ -84,9 +84,6 @@ func (r *repositoryT) VerifyComponent(comp, version, target string) error { } func (r *repositoryT) ComponentBinEntry(comp, version string) (string, error) { - if comp == "tso" || comp == "scheduling" { - comp = "pd" - } versionItem, err := r.repo.ComponentVersion(comp, version, true) if err != nil { return "", err diff --git a/pkg/cluster/spec/scheduling.go b/pkg/cluster/spec/scheduling.go index 2f7d4f6dd3..efbe7def00 100644 --- a/pkg/cluster/spec/scheduling.go +++ b/pkg/cluster/spec/scheduling.go @@ -140,11 +140,11 @@ func (c *SchedulingComponent) Role() string { // Source implements Component interface. func (c *SchedulingComponent) Source() string { - source := c.Topology.ComponentSources.Scheduling + source := c.Topology.ComponentSources.PD if source != "" { return source } - return ComponentScheduling + return ComponentPD } // CalculateVersion implements the Component interface diff --git a/pkg/cluster/spec/spec.go b/pkg/cluster/spec/spec.go index cfdc213470..f3400c9758 100644 --- a/pkg/cluster/spec/spec.go +++ b/pkg/cluster/spec/spec.go @@ -159,17 +159,15 @@ type ( // ComponentSources represents the source of components ComponentSources struct { - TiDB string `yaml:"tidb,omitempty" validate:"tidb:editable"` - TiKV string `yaml:"tikv,omitempty" validate:"tikv:editable"` - TiFlash string `yaml:"tiflash,omitempty" validate:"tiflash:editable"` - PD string `yaml:"pd,omitempty" validate:"pd:editable"` - TSO string `yaml:"tso,omitempty" validate:"tso:editable"` - Scheduling string `yaml:"scheduling,omitempty" validate:"schedulng:editable"` - Dashboard string `yaml:"tidb_dashboard,omitempty" validate:"tidb_dashboard:editable"` - Pump string `yaml:"pump,omitempty" validate:"pump:editable"` - Drainer string `yaml:"drainer,omitempty" validate:"drainer:editable"` - CDC string `yaml:"cdc,omitempty" validate:"cdc:editable"` - TiKVCDC string `yaml:"kvcdc,omitempty" validate:"kvcdc:editable"` + TiDB string `yaml:"tidb,omitempty" validate:"tidb:editable"` + TiKV string `yaml:"tikv,omitempty" validate:"tikv:editable"` + TiFlash string `yaml:"tiflash,omitempty" validate:"tiflash:editable"` + PD string `yaml:"pd,omitempty" validate:"pd:editable"` + Dashboard string `yaml:"tidb_dashboard,omitempty" validate:"tidb_dashboard:editable"` + Pump string `yaml:"pump,omitempty" validate:"pump:editable"` + Drainer string `yaml:"drainer,omitempty" validate:"drainer:editable"` + CDC string `yaml:"cdc,omitempty" validate:"cdc:editable"` + TiKVCDC string `yaml:"kvcdc,omitempty" validate:"kvcdc:editable"` } // Specification represents the specification of topology.yaml diff --git a/pkg/cluster/spec/tso.go b/pkg/cluster/spec/tso.go index bc438b23de..a84069f6ee 100644 --- a/pkg/cluster/spec/tso.go +++ b/pkg/cluster/spec/tso.go @@ -140,11 +140,11 @@ func (c *TSOComponent) Role() string { // Source implements Component interface. func (c *TSOComponent) Source() string { - source := c.Topology.ComponentSources.TSO + source := c.Topology.ComponentSources.PD if source != "" { return source } - return ComponentTSO + return ComponentPD } // CalculateVersion implements the Component interface diff --git a/pkg/cluster/task/builder.go b/pkg/cluster/task/builder.go index c87ecfafc3..3d001e7517 100644 --- a/pkg/cluster/task/builder.go +++ b/pkg/cluster/task/builder.go @@ -201,9 +201,6 @@ func (b *Builder) CopyFile(src, dst, server string, download bool, limit int, co // Download appends a Downloader task to the current task collection func (b *Builder) Download(component, os, arch string, version string) *Builder { - if component == "tso" || component == "scheduling" { - component = "pd" - } b.tasks = append(b.tasks, NewDownloader(component, os, arch, version)) return b } @@ -213,9 +210,6 @@ func (b *Builder) CopyComponent(component, os, arch string, version string, srcPath, dstHost, dstDir string, ) *Builder { - if component == "tso" || component == "scheduling" { - component = "pd" - } b.tasks = append(b.tasks, &CopyComponent{ component: component, os: os, @@ -240,9 +234,6 @@ func (b *Builder) InstallPackage(srcPath, dstHost, dstDir string) *Builder { // BackupComponent appends a BackupComponent task to the current task collection func (b *Builder) BackupComponent(component, fromVer string, host, deployDir string) *Builder { - if component == "tso" || component == "scheduling" { - component = "pd" - } b.tasks = append(b.tasks, &BackupComponent{ component: component, fromVer: fromVer,