From 4f47e27433ba799fb0deaafa16e3f30c72bbf3a6 Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Wed, 10 Jan 2024 10:34:12 +0800 Subject: [PATCH] installer: rename the role name witness instead etcd Signed-off-by: Vicente Cheng --- pkg/config/constants.go | 2 +- pkg/console/install_panels.go | 4 ++-- pkg/console/util.go | 8 ++++---- pkg/util/common.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index c2e2664da..5e6d35141 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -7,7 +7,7 @@ const ( ModeInstall = "install" RoleDefault = "default" - RoleEtcd = "etcd" + RoleWitness = "witness" NetworkMethodDHCP = "dhcp" NetworkMethodStatic = "static" diff --git a/pkg/console/install_panels.go b/pkg/console/install_panels.go index 77f4bd155..030b2f357 100644 --- a/pkg/console/install_panels.go +++ b/pkg/console/install_panels.go @@ -770,8 +770,8 @@ func addAskRolePanel(c *Console) error { Value: config.RoleDefault, Text: "Default Role (Master or Worker)", }, { - Value: config.RoleEtcd, - Text: "Worker (Etcd only)", + Value: config.RoleWitness, + Text: "Witness Role", }, }, nil } diff --git a/pkg/console/util.go b/pkg/console/util.go index dec1d019f..a633678b3 100644 --- a/pkg/console/util.go +++ b/pkg/console/util.go @@ -457,11 +457,11 @@ func doInstall(g *gocui.Gui, hvstConfig *config.HarvesterConfig, webhooks Render } // specific the node label for the specific node role - if hvstConfig.Role == config.RoleEtcd { + if hvstConfig.Role == config.RoleWitness { if hvstConfig.Labels == nil { hvstConfig.Labels = make(map[string]string) } - hvstConfig.Labels[util.HarvesterEtcdNodeLabelKey] = "true" + hvstConfig.Labels[util.HarvesterWitnessNodeLabelKey] = "true" } env, elementalConfig, err := generateEnvAndConfig(g, hvstConfig) @@ -777,11 +777,11 @@ func configureInstalledNode(g *gocui.Gui, hvstConfig *config.HarvesterConfig, we webhooks.Handle(EventInstallStarted) // specific the node label for the specific node role - if hvstConfig.Role == config.RoleEtcd { + if hvstConfig.Role == config.RoleWitness { if hvstConfig.Labels == nil { hvstConfig.Labels = make(map[string]string) } - hvstConfig.Labels[util.HarvesterEtcdNodeLabelKey] = "true" + hvstConfig.Labels[util.HarvesterWitnessNodeLabelKey] = "true" } // skip rancherd and network config in the cos config diff --git a/pkg/util/common.go b/pkg/util/common.go index 47d132e5a..8a56dd14f 100644 --- a/pkg/util/common.go +++ b/pkg/util/common.go @@ -6,7 +6,7 @@ import ( var ( HarvesterNodeRoleLabelPrefix = "node-role.harvesterhci.io/" - HarvesterEtcdNodeLabelKey = HarvesterNodeRoleLabelPrefix + "etcd" + HarvesterWitnessNodeLabelKey = HarvesterNodeRoleLabelPrefix + "witness" sizeRegexp = regexp.MustCompile(`^(\d+)(Mi|Gi)$`) )