From bd3ec35697cbf273f37590a67452b666a99f9a62 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 4 Oct 2023 10:12:09 +0300 Subject: [PATCH] Retry failed releases when charts are available in storage Signed-off-by: Stefan Prodan --- internal/controller/helmrelease_controller.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/controller/helmrelease_controller.go b/internal/controller/helmrelease_controller.go index 5b724da9b..59f0a80d9 100644 --- a/internal/controller/helmrelease_controller.go +++ b/internal/controller/helmrelease_controller.go @@ -23,6 +23,7 @@ import ( "strings" "time" + "github.com/fluxcd/pkg/runtime/conditions" "github.com/hashicorp/go-retryablehttp" "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chartutil" @@ -770,13 +771,13 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(ctx context.Context, } var reqs []reconcile.Request - for _, i := range list.Items { - // If the revision of the artifact equals to the last attempted revision, - // we should not make a request for this HelmRelease - if hc.GetArtifact().HasRevision(i.Status.LastAttemptedRevision) { + for _, hr := range list.Items { + // If the HelmRelease is ready and the revision of the artifact equals to the + // last attempted revision, we should not make a request for this HelmRelease + if conditions.IsReady(&hr) && hc.GetArtifact().HasRevision(hr.Status.LastAttemptedRevision) { continue } - reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&i)}) + reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&hr)}) } return reqs }