Removes the hardcoded timeout (60 seconds) and replaces it with dynamically calculated maximum timeout.

Signed-off-by: JinXinWang <opencmit2@126.com>
pull/12691/head
JinXinWang 2 years ago
parent 5a4737d4a2
commit 8f77526a6e

@ -63,8 +63,8 @@ const notesFileSuffix = "NOTES.txt"
const defaultDirectoryPermission = 0755 const defaultDirectoryPermission = 0755
// Default timeout for CRD // Minimum timeout for CRD installation (retained for compatibility reasons)
const defaultTimeout = 60 * time.Second const minimumCRDTimeout = 60 * time.Second
// Install performs an installation operation. // Install performs an installation operation.
type Install struct { type Install struct {
@ -178,13 +178,10 @@ func (i *Install) installCRDs(crds []chart.CRD) error {
if len(totalItems) > 0 { if len(totalItems) > 0 {
// If the timeout provided is greater than the default timeout // If the timeout provided is greater than the default timeout
// use the provided timeout as the maximum timeout. // use the provided timeout as the maximum timeout.
crdMaxTimeout := defaultTimeout crdTimeout := max(i.Timeout, minimumCRDTimeout)
if i.Timeout > defaultTimeout {
crdMaxTimeout = i.Timeout
}
// Give time for the CRD to be recognized. // Give time for the CRD to be recognized.
if err := i.cfg.KubeClient.Wait(totalItems, crdMaxTimeout); err != nil { if err := i.cfg.KubeClient.Wait(totalItems, crdTimeout); err != nil {
return err return err
} }

Loading…
Cancel
Save