Skip to content

Commit

Permalink
Fix the component reset command (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Aug 24, 2021
1 parent 193bba5 commit b996499
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kubectl-plugin/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions kubectl-plugin/component/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b996499

Please sign in to comment.