Skip to content

Commit

Permalink
feat: Skip reconciliation if deleting cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
kahirokunn committed Dec 18, 2024
1 parent 08f2c8c commit 809ce86
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions controllers/helmchartproxy/helmchartproxy_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ func (r *HelmChartProxyReconciler) reconcileForCluster(ctx context.Context, helm
return errors.Wrapf(err, "failed to parse values on cluster %s", cluster.Name)
}

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

return errors.Wrapf(err, "failed to create or update HelmReleaseProxy on cluster %s", cluster.Name)
return errors.Wrapf(err, "failed to create or update HelmReleaseProxy on cluster %s", cluster.Name)
}
} else {
log.V(2).Info("Cluster is being deleted, skipping reconciliation", "cluster", cluster.Name)
return nil
}

return nil
Expand Down

0 comments on commit 809ce86

Please sign in to comment.