From 7282b448a4284590d64e7fb259a0571190531574 Mon Sep 17 00:00:00 2001 From: nexustar Date: Fri, 17 Nov 2023 16:45:50 +0800 Subject: [PATCH] update --- ...1-separate-component-version-in-cluster.md | 31 +++++++++++++------ pkg/cluster/spec/spec.go | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/rfcs/0001-separate-component-version-in-cluster.md b/doc/rfcs/0001-separate-component-version-in-cluster.md index f018dbd1a5..3ad7705cad 100644 --- a/doc/rfcs/0001-separate-component-version-in-cluster.md +++ b/doc/rfcs/0001-separate-component-version-in-cluster.md @@ -12,15 +12,26 @@ Add a version field to each component on topology file. Allow user to upgrade si ## Detailed design -1. add "latest" alias to tiup download function.It cloud be used to download latest release package of component. +1. ~~add "latest" alias to tiup download function.It cloud be used to download latest release package of component.~~ just use "" as latest alias -2. add version field to DashboardSpec struct. +2. add ComponentVersions struct to topology ``` -type DashboardSpec struct { - ... - Version string `yaml:"version,omitempty" default:"latest"` - ... +// ComponentVersions represents the versions of components +ComponentVersions struct { + TiDB string `yaml:"tidb,omitempty"` + TiKV string `yaml:"tikv,omitempty"` + TiFlash string `yaml:"tiflash,omitempty"` + PD string `yaml:"pd,omitempty"` + Dashboard string `yaml:"tidb_dashboard,omitempty"` + Pump string `yaml:"pump,omitempty"` + Drainer string `yaml:"drainer,omitempty"` + CDC string `yaml:"cdc,omitempty"` + TiKVCDC string `yaml:"kvcdc,omitempty"` + TiProxy string `yaml:"tiproxy,omitempty"` + Prometheus string `yaml:"prometheus,omitempty"` + Grafana string `yaml:"grafana,omitempty"` + AlertManager string `yaml:"alertmanager,omitempty"` } ``` @@ -35,10 +46,10 @@ MonitoredOptions struct { } ``` -4. if user not specify version, those version has default value latest which means use newest stable version in tiup repo. +4. Add CalculateVersion for each component struct. It returns cluster version if component version is not set for components like pd, tikv. It returns "" by default for components like alertmanager -5. maybe add version field to all other component, deafult value is empty which means use global cluster version +5. Add flags to specify component versions -6. apply those version to deploy,scale-out and upgrade command +6. Merge ComponentVersion struct when scale-out -7. how user upgrade single exist component? add a new subcommand or just edit-config and reload? I don't know yet \ No newline at end of file +7. apply those version to deploy,scale-out and upgrade command diff --git a/pkg/cluster/spec/spec.go b/pkg/cluster/spec/spec.go index c30ac7cecc..0ddfbee29b 100644 --- a/pkg/cluster/spec/spec.go +++ b/pkg/cluster/spec/spec.go @@ -159,7 +159,7 @@ type ( GlobalOptions GlobalOptions `yaml:"global,omitempty" validate:"global:editable"` MonitoredOptions MonitoredOptions `yaml:"monitored,omitempty" validate:"monitored:editable"` ComponentVersions ComponentVersions `yaml:"component_versions,omitempty" validate:"component_versions:editable"` - ComponentSources ComponentSources `yaml:"component_sources,omitempty" validate:"component_versions:editable"` + ComponentSources ComponentSources `yaml:"component_sources,omitempty" validate:"component_sources:editable"` ServerConfigs ServerConfigs `yaml:"server_configs,omitempty" validate:"server_configs:ignore"` TiDBServers []*TiDBSpec `yaml:"tidb_servers"` TiKVServers []*TiKVSpec `yaml:"tikv_servers"`