mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #2461 from sushilkm/issues/2441
helm reset --force would clean a failed tiller deployment
This commit is contained in:
commit
8183b6396d
2 changed files with 14 additions and 9 deletions
|
|
@ -54,10 +54,15 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "reset",
|
||||
Short: "uninstalls Tiller from a cluster",
|
||||
Long: resetDesc,
|
||||
PersistentPreRunE: setupConnection,
|
||||
Use: "reset",
|
||||
Short: "uninstalls Tiller from a cluster",
|
||||
Long: resetDesc,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := setupConnection(cmd, args); !d.force && err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return errors.New("This command does not accept arguments")
|
||||
|
|
@ -72,7 +77,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
f := cmd.Flags()
|
||||
f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed")
|
||||
f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if tiller is not in ready state")
|
||||
f.BoolVar(&d.removeHelmHome, "remove-helm-home", false, "if set deletes $HELM_HOME")
|
||||
|
||||
return cmd
|
||||
|
|
@ -91,11 +96,11 @@ func (d *resetCmd) run() error {
|
|||
res, err := d.client.ListReleases(
|
||||
helm.ReleaseListStatuses([]release.Status_Code{release.Status_DEPLOYED}),
|
||||
)
|
||||
if err != nil {
|
||||
if !d.force && err != nil {
|
||||
return prettyError(err)
|
||||
}
|
||||
|
||||
if len(res.Releases) > 0 && !d.force {
|
||||
if !d.force && res != nil && len(res.Releases) > 0 {
|
||||
return fmt.Errorf("there are still %d deployed releases (Tip: use --force)", len(res.Releases))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ helm reset
|
|||
### Options
|
||||
|
||||
```
|
||||
-f, --force forces Tiller uninstall even if there are releases installed
|
||||
-f, --force forces Tiller uninstall even if there are releases installed, or if tiller is not in ready state
|
||||
--remove-helm-home if set deletes $HELM_HOME
|
||||
--tls enable TLS for request
|
||||
--tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem")
|
||||
|
|
@ -40,4 +40,4 @@ helm reset
|
|||
### SEE ALSO
|
||||
* [helm](helm.md) - The Helm package manager for Kubernetes.
|
||||
|
||||
###### Auto generated by spf13/cobra on 17-May-2017
|
||||
###### Auto generated by spf13/cobra on 25-May-2017
|
||||
|
|
|
|||
Loading…
Reference in a new issue