diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 53aef7af7..af8ff68e3 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -91,8 +91,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } if client.Install { - // If a release does not exist, install it. If another error occurs during - // the check, ignore the error and continue with the upgrade. + // If a release does not exist, install it. histClient := action.NewHistory(cfg) histClient.Max = 1 if _, err := histClient.Run(args[0]); err == driver.ErrReleaseNotFound { @@ -119,6 +118,8 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return err } return outfmt.Write(out, &statusPrinter{rel, settings.Debug}) + } else if err != nil { + return err } } diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index 62e26adb4..fabba9af4 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -75,6 +75,10 @@ func NewUpgrade(cfg *Configuration) *Upgrade { // Run executes the upgrade on the given release. func (u *Upgrade) Run(name string, chart *chart.Chart, vals map[string]interface{}) (*release.Release, error) { + if err := u.cfg.KubeClient.IsReachable(); err != nil { + return nil, err + } + // Make sure if Atomic is set, that wait is set as well. This makes it so // the user doesn't have to specify both u.Wait = u.Wait || u.Atomic