Skip to content

Commit

Permalink
try not use bindversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar committed Sep 7, 2023
1 parent 8aa3423 commit b004a4c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions pkg/cluster/manager/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func buildScaleOutTask(
var iterErr error
// Deploy the new topology and refresh the configuration
newPart.IterInstance(func(inst spec.Instance) {
version := inst.CalculateVersion(m.bindVersion(inst.ComponentName(), base.Version))
version := inst.CalculateVersion(base.Version)
deployDir := spec.Abs(base.User, inst.DeployDir())
// data dir would be empty for components which don't need it
dataDirs := spec.MultiDirAbs(base.User, inst.DataDir())
Expand Down Expand Up @@ -235,9 +235,9 @@ func buildScaleOutTask(
// data dir would be empty for components which don't need it
// Download and copy the latest component to remote if the cluster is imported from Ansible
tb := task.NewBuilder(m.logger)
version := inst.CalculateVersion(base.Version)
switch compName := inst.ComponentName(); compName {
case spec.ComponentGrafana, spec.ComponentPrometheus, spec.ComponentAlertmanager:
version := m.bindVersion(compName, base.Version)
tb.Download(compName, inst.OS(), inst.Arch(), version).
CopyComponent(compName, inst.OS(), inst.Arch(), version, "", inst.GetManageHost(), deployDir)
}
Expand Down Expand Up @@ -639,9 +639,9 @@ func buildInitConfigTasks(
// Download and copy the latest component to remote if the cluster is imported from Ansible
tb := task.NewBuilder(m.logger)
if instance.IsImported() {
version := instance.CalculateVersion(base.Version)
switch compName {
case spec.ComponentGrafana, spec.ComponentPrometheus, spec.ComponentAlertmanager:
version := m.bindVersion(compName, base.Version)
tb.Download(compName, instance.OS(), instance.Arch(), version).
CopyComponent(
compName,
Expand Down Expand Up @@ -699,7 +699,7 @@ func buildDownloadCompTasks(
// download spark as dependency of tispark
tasks = append(tasks, buildDownloadSparkTask(inst, logger, gOpt))
} else {
version = inst.CalculateVersion(bindVersion(inst.ComponentName(), clusterVersion))
version = inst.CalculateVersion(clusterVersion)
}

t := task.NewBuilder(logger).
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/manager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ func (m *Manager) Deploy(

// Deploy components to remote
topo.IterInstance(func(inst spec.Instance) {
version := inst.CalculateVersion(m.bindVersion(inst.ComponentName(), clusterVersion))
inst.SetVersion(version)
version := inst.CalculateVersion(clusterVersion)
//inst.SetVersion(version)
deployDir := spec.Abs(globalOptions.User, inst.DeployDir())
// data dir would be empty for components which don't need it
dataDirs := spec.MultiDirAbs(globalOptions.User, inst.DataDir())
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/manager/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func checkPackage(bindVersion spec.BindVersion, specManager *spec.SpecManager, n
return err
}

ver := inst.CalculateVersion(bindVersion(inst.ComponentName(), metadata.GetBaseMeta().Version))
ver := inst.CalculateVersion(metadata.GetBaseMeta().Version)
repo, err := clusterutil.NewRepository(nodeOS, arch)
if err != nil {
return err
Expand Down
9 changes: 6 additions & 3 deletions pkg/cluster/manager/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ Do you want to continue? [y/N]:`,

// if component version is not specified, use the cluster version or latest("")
version := componentVersions[compName]
if version == "" {
version = m.bindVersion(compName, clusterVersion)
//if version == "" {
// version = m.bindVersion(compName, clusterVersion)
//}
if version != "" {
inst.SetVersion(version)
}
inst.SetVersion(version)
version = inst.CalculateVersion(clusterVersion)

// Download component from repository
key := fmt.Sprintf("%s-%s-%s-%s", compName, version, inst.OS(), inst.Arch())
Expand Down

0 comments on commit b004a4c

Please sign in to comment.