From b996499895048a34b7016fbec7fbae37a4f9ac7a Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Tue, 24 Aug 2021 17:04:33 +0800 Subject: [PATCH] Fix the component reset command (#172) --- kubectl-plugin/component/component.go | 2 +- kubectl-plugin/component/reset.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kubectl-plugin/component/component.go b/kubectl-plugin/component/component.go index 3befe3a..b03471b 100644 --- a/kubectl-plugin/component/component.go +++ b/kubectl-plugin/component/component.go @@ -97,7 +97,7 @@ func (o *Option) getResourceType(component string) schema.GroupVersionResource { } } -func (o *Option) updateBy(image, tag string) (err error) { +func (o *Option) updateBy(image string) (err error) { ns, name := o.getNsAndName(o.Name) err = o.updateDeploy(ns, name, fmt.Sprintf("%s/%s", image, name), o.Tag) return diff --git a/kubectl-plugin/component/reset.go b/kubectl-plugin/component/reset.go index d8a2933..bb1f427 100644 --- a/kubectl-plugin/component/reset.go +++ b/kubectl-plugin/component/reset.go @@ -73,36 +73,36 @@ func (o *ResetOption) resetRunE(cmd *cobra.Command, args []string) (err error) { imageOrg := "kubespheredev" if o.Release && o.Nightly == "" { imageOrg = "kubesphere" - } else { + } else if o.Tag == "" { // try to parse the nightly date _, o.Tag = common.GetNightlyTag(o.Nightly) } if o.ResetAll { o.Name = "apiserver" - if err = o.updateBy(imageOrg, o.Tag); err != nil { + if err = o.updateBy(imageOrg); err != nil { return } o.Name = "controller" - if err = o.updateBy(imageOrg, o.Tag); err != nil { + if err = o.updateBy(imageOrg); err != nil { return } o.Name = "console" - if err = o.updateBy(imageOrg, o.Tag); err != nil { + if err = o.updateBy(imageOrg); err != nil { return } o.Name = "installer" - if err = o.updateBy(imageOrg, o.Tag); err != nil { + if err = o.updateBy(imageOrg); err != nil { return } } else { if o.Name == "" { err = fmt.Errorf("please provide a component name") } else { - err = o.updateBy(imageOrg, o.Tag) + err = o.updateBy(imageOrg) } } return