From 49322644bae07a16823ceff14f891e393f1d1b06 Mon Sep 17 00:00:00 2001 From: jinxinwang Date: Wed, 15 Nov 2023 09:25:52 +0800 Subject: [PATCH] Fix ISSUE #12563 by reusing the command line Timeout parameter to resolve hardcoded timeouts for CRDs. Signed-off-by: jinxinwang --- cmd/helm/install.go | 2 +- pkg/action/install.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d987d300f..804ca8a82 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -177,7 +177,7 @@ func addInstallFlags(cmd *cobra.Command, f *pflag.FlagSet, client *action.Instal f.BoolVar(&client.Force, "force", false, "force resource updates through a replacement strategy") f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during install") f.BoolVar(&client.Replace, "replace", false, "re-use the given name, only if that name is a deleted release which remains in the history. This is unsafe in production") - f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs or CRDs for hooks)") 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") f.BoolVar(&client.WaitForJobs, "wait-for-jobs", false, "if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout") f.BoolVarP(&client.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)") diff --git a/pkg/action/install.go b/pkg/action/install.go index e3538a4f5..3b39799e0 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -30,7 +30,6 @@ import ( "text/template" "time" - "github.com/Masterminds/sprig/v3" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -174,7 +173,7 @@ func (i *Install) installCRDs(crds []chart.CRD) error { } if len(totalItems) > 0 { // Give time for the CRD to be recognized. - if err := i.cfg.KubeClient.Wait(totalItems, 60*time.Second); err != nil { + if err := i.cfg.KubeClient.Wait(totalItems, i.Timeout); err != nil { return err }