add stub for upgrade timeouts as per feedback

Signed-off-by: Lucas Lu <lucasludev@gmail.com>
pull/10457/head
Lucas Lu 3 years ago
parent cc810cc0f5
commit 34e1e0f211

@ -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")

@ -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)
}

Loading…
Cancel
Save