Merge pull request #785 from fluxcd/speed-up-recovery

fix: Retry failed releases when charts are available in storage
This commit is contained in:
Stefan Prodan 2023-10-04 14:00:17 +03:00 committed by GitHub
commit 0c31fd395c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -23,6 +23,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/fluxcd/pkg/runtime/conditions"
"github.com/hashicorp/go-retryablehttp" "github.com/hashicorp/go-retryablehttp"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/chartutil"
@ -770,13 +771,13 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(ctx context.Context,
} }
var reqs []reconcile.Request var reqs []reconcile.Request
for _, i := range list.Items { for _, hr := range list.Items {
// If the revision of the artifact equals to the last attempted revision, // If the HelmRelease is ready and the revision of the artifact equals to the
// we should not make a request for this HelmRelease // last attempted revision, we should not make a request for this HelmRelease
if hc.GetArtifact().HasRevision(i.Status.LastAttemptedRevision) { if conditions.IsReady(&hr) && hc.GetArtifact().HasRevision(hr.Status.LastAttemptedRevision) {
continue continue
} }
reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&i)}) reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&hr)})
} }
return reqs return reqs
} }