Skip to content

Commit

Permalink
feat(clustertool): retry helm-install after etcs timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
PrivatePuffin committed Nov 12, 2024
1 parent 8dc3b8e commit 0610afa
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion clustertool/pkg/fluxhandler/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,23 @@ func HelmInstall(repoURL string, chartName string, releaseName string, namespace
}

// Install the chart with merged values
log.Debug().Msg("Installing chart...")
release, err := client.Run(chart, vals)
if err != nil {
return fmt.Errorf("failed to install chart: %w", err)
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)
}
}

if wait {
Expand Down

0 comments on commit 0610afa

Please sign in to comment.