Skip to content

Commit bb0559c

Browse files
authored
Merge pull request #328 from kahirokunn/improve-install-delete-cycle
✨ Skip reconciliation if deleting cluster
2 parents 2601bfb + be00959 commit bb0559c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

controllers/helmchartproxy/helmchartproxy_controller_phases.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ func (r *HelmChartProxyReconciler) reconcileForCluster(ctx context.Context, helm
102102
return errors.Wrapf(err, "failed to parse values on cluster %s", cluster.Name)
103103
}
104104

105-
log.V(2).Info("Values for cluster", "cluster", cluster.Name, "values", values)
106-
if err := r.createOrUpdateHelmReleaseProxy(ctx, existingHelmReleaseProxy, helmChartProxy, &cluster, values); err != nil {
107-
conditions.MarkFalse(helmChartProxy, addonsv1alpha1.HelmReleaseProxySpecsUpToDateCondition, addonsv1alpha1.HelmReleaseProxyCreationFailedReason, clusterv1.ConditionSeverityError, "%s", err.Error())
105+
// If the cluster is not being deleted, create or update the HelmReleaseProxy
106+
if cluster.DeletionTimestamp.IsZero() {
107+
log.V(2).Info("Values for cluster", "cluster", cluster.Name, "values", values)
108+
if err := r.createOrUpdateHelmReleaseProxy(ctx, existingHelmReleaseProxy, helmChartProxy, &cluster, values); err != nil {
109+
conditions.MarkFalse(helmChartProxy, addonsv1alpha1.HelmReleaseProxySpecsUpToDateCondition, addonsv1alpha1.HelmReleaseProxyCreationFailedReason, clusterv1.ConditionSeverityError, "%s", err.Error())
108110

109-
return errors.Wrapf(err, "failed to create or update HelmReleaseProxy on cluster %s", cluster.Name)
111+
return errors.Wrapf(err, "failed to create or update HelmReleaseProxy on cluster %s", cluster.Name)
112+
}
113+
} else {
114+
log.V(2).Info("Cluster is being deleted, skipping reconciliation", "cluster", cluster.Name)
115+
return nil
110116
}
111117

112118
return nil

0 commit comments

Comments
 (0)