Set minimum CRD installation timeout to 60 seconds

Signed-off-by: JustinWang <opencmit2@126.com>
pull/12570/head
JustinWang 2 years ago
parent 49322644ba
commit c2c1f97404

@ -62,6 +62,9 @@ const notesFileSuffix = "NOTES.txt"
const defaultDirectoryPermission = 0755 const defaultDirectoryPermission = 0755
// Default timeout for CRD
const defaultTimeout = 60 * time.Second
// Install performs an installation operation. // Install performs an installation operation.
type Install struct { type Install struct {
cfg *Configuration cfg *Configuration
@ -172,8 +175,15 @@ func (i *Install) installCRDs(crds []chart.CRD) error {
totalItems = append(totalItems, res...) totalItems = append(totalItems, res...)
} }
if len(totalItems) > 0 { if len(totalItems) > 0 {
// If the timeout provided is greater than the default timeout
// use the provided timeout as the maximum timeout.
crdMaxTimeout := defaultTimeout
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, i.Timeout); err != nil { if err := i.cfg.KubeClient.Wait(totalItems, crdMaxTimeout); err != nil {
return err return err
} }

Loading…
Cancel
Save