Skip to content

Commit 560eb6f

Browse files
committed
Address review comments
Signed-off-by: Hidde Beydals <[email protected]>
1 parent 4eaa6a5 commit 560eb6f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

api/v2beta1/condition_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ const (
7272
// HelmRelease failed.
7373
UninstallFailedReason string = "UninstallFailed"
7474

75+
// ArtifactNotReadyReason represents the fact that the artifact for the HelmChart
76+
// is not available.
77+
ArtifactNotReadyReason string = "ArtifactNotReady"
78+
7579
// ArtifactFailedReason represents the fact that the artifact download for the
7680
// HelmRelease failed.
7781
ArtifactFailedReason string = "ArtifactFailed"

controllers/helmrelease_controller_release.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, log logr.L
4545
hc, err := r.getHelmChart(ctx, hr)
4646
if err != nil {
4747
err = fmt.Errorf("failed to get HelmChart for resource: %w", err)
48-
v2.HelmReleaseNotReady(hr, v2.GetLastReleaseFailedReason, err.Error())
48+
v2.HelmReleaseNotReady(hr, v2.ArtifactFailedReason, err.Error())
4949
return ctrl.Result{}, err
5050
}
5151

@@ -55,7 +55,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, log logr.L
5555
// a new reconciliation.
5656
if hc.GetArtifact() == nil {
5757
msg := fmt.Sprintf("HelmChart '%s/%s' has no artifact", hc.GetNamespace(), hc.GetName())
58-
v2.HelmReleaseNotReady(hr, meta.DependencyNotReadyReason, msg)
58+
v2.HelmReleaseNotReady(hr, v2.ArtifactNotReadyReason, msg)
5959
return ctrl.Result{RequeueAfter: hr.Spec.Interval.Duration}, nil
6060
}
6161

@@ -84,7 +84,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, log logr.L
8484
// release in the Helm storage.
8585
makeRelease, remediation := run.Install, hr.Spec.GetInstall().GetRemediation()
8686
successReason, failureReason := v2.InstallSucceededReason, v2.InstallFailedReason
87-
if rls != nil {
87+
if rls != nil && hr.Status.LastSuccessfulReleaseRevision > 0 {
8888
makeRelease, remediation = run.Upgrade, hr.Spec.GetUpgrade().GetRemediation()
8989
successReason, failureReason = v2.UpgradeSucceededReason, v2.UpgradeFailedReason
9090
}
@@ -94,7 +94,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, log logr.L
9494
releaseRevision := util.ReleaseRevision(rls)
9595
if rls != nil && hr.Status.LastReleaseRevision == releaseRevision && rls.Info.Status.IsPending() {
9696
msg := fmt.Sprintf("previous release did not finish (%s)", rls.Info.Status)
97-
v2.HelmReleaseNotReady(hr, v2.RemediatedCondition, msg)
97+
v2.HelmReleaseNotReady(hr, meta.ReconciliationFailedReason, msg)
9898
r.event(hr, hr.Status.LastAttemptedRevision, events.EventSeverityError, msg)
9999
remediation.IncrementFailureCount(hr)
100100
return ctrl.Result{RequeueAfter: hr.Spec.Interval.Duration}, nil
@@ -119,7 +119,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, log logr.L
119119
case remediation.RetriesExhausted(*hr):
120120
v2.HelmReleaseNotReady(hr, meta.ReconciliationFailedReason, "exhausted release retries")
121121
return ctrl.Result{RequeueAfter: hr.Spec.Interval.Duration}, nil
122-
// Our previous reconciliation attempt failed, skip release to retry.
122+
// Our previous remediation attempt failed, skip release to retry.
123123
case hr.Status.LastSuccessfulReleaseRevision > 0 && hr.Status.LastReleaseRevision != hr.Status.LastSuccessfulReleaseRevision:
124124
return ctrl.Result{RequeueAfter: hr.Spec.Interval.Duration}, nil
125125
}

0 commit comments

Comments
 (0)