diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index dbcd2d0d6..58b350831 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -223,6 +223,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.BoolVar(&client.DisableOpenAPIValidation, "disable-openapi-validation", false, "if set, the upgrade process will not validate rendered templates against the Kubernetes OpenAPI Schema") f.BoolVar(&client.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed when an upgrade is performed with install flag enabled. By default, CRDs are installed if not already present, when an upgrade is performed with install flag enabled") f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.DurationVar(&client.Timeout, "upgrade-timeout", 3000*time.Second, "time to wait for the entire upgrade operation") f.BoolVar(&client.ResetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") f.BoolVar(&client.ReuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored") f.BoolVar(&client.Wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful. It will wait for as long as --timeout") diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index ca4ace62e..5557ac761 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -63,6 +63,8 @@ type Upgrade struct { SkipCRDs bool // Timeout is the timeout for individual hooks/kubernetes operations Timeout time.Duration + // UpgradeTimeout is the timeout for this entire upgrade operation + UpgradeTimeout time.Duration // Wait determines whether the wait operation should be performed after the upgrade is requested. Wait bool // WaitForJobs determines whether the wait operation for the Jobs should be performed after the upgrade is requested. @@ -475,8 +477,7 @@ func (u *Upgrade) failRelease(rel *release.Release, created kube.ResourceList, e rollin.Recreate = u.Recreate rollin.Force = u.Force rollin.Timeout = u.Timeout - // TODO: Implement upgrade timeout to inject as value here - rollin.RollbackTimeout = 1200 * time.Second + rollin.RollbackTimeout = u.UpgradeTimeout if rollErr := rollin.Run(rel.Name); rollErr != nil { return rel, errors.Wrapf(rollErr, "an error occurred while rolling back the release. original upgrade error: %s", err) }