feat(clustertool): retry helm-install after etcs timeout
This commit is contained in:
@@ -239,10 +239,24 @@ func HelmInstall(repoURL string, chartName string, releaseName string, namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Install the chart with merged values
|
// Install the chart with merged values
|
||||||
|
log.Debug().Msg("Installing chart...")
|
||||||
release, err := client.Run(chart, vals)
|
release, err := client.Run(chart, vals)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Debug().Msg("Chart install returned an error")
|
||||||
|
if strings.Contains(err.Error(), "timed out") {
|
||||||
|
// Wait for 15 seconds and try again
|
||||||
|
log.Warn().Msg("Chart install recieved a timeout, retrying in 15 seconds...")
|
||||||
|
time.Sleep(15 * time.Second)
|
||||||
|
release, err = client.Run(chart, vals)
|
||||||
|
if err != nil && strings.Contains(err.Error(), "timed out") {
|
||||||
|
return fmt.Errorf("failed to install chart after retry, with another timeout: %w", err)
|
||||||
|
} else if err != nil {
|
||||||
|
return fmt.Errorf("failed to install chart after retry: %w", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return fmt.Errorf("failed to install chart: %w", err)
|
return fmt.Errorf("failed to install chart: %w", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if wait {
|
if wait {
|
||||||
waitForRelease(actionConfig, release.Name, client.Namespace)
|
waitForRelease(actionConfig, release.Name, client.Namespace)
|
||||||
|
|||||||
Reference in New Issue
Block a user