diff --git a/controllers/helmrepository_controller.go b/controllers/helmrepository_controller.go index b3d1d1487..41a391253 100644 --- a/controllers/helmrepository_controller.go +++ b/controllers/helmrepository_controller.go @@ -475,8 +475,7 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc } if curDig.Validate() == nil { // Short-circuit based on the fetched index being an exact match to the - // stored Artifact. This prevents having to unmarshal the YAML to calculate - // the (stable) revision, which is a memory expensive operation. + // stored Artifact. if newDig := chartRepo.Digest(curDig.Algorithm()); newDig.Validate() == nil && (newDig == curDig) { *artifact = *curArtifact conditions.Delete(obj, sourcev1.FetchFailedCondition) @@ -501,11 +500,11 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc var changed bool if artifact := obj.Status.Artifact; artifact != nil { curRev := digest.Digest(sourcev1.TransformLegacyRevision(artifact.Revision)) - changed = curRev.Validate() != nil || curRev != chartRepo.Revision(curRev.Algorithm()) + changed = curRev.Validate() != nil || curRev != chartRepo.Digest(curRev.Algorithm()) } // Calculate revision. - revision := chartRepo.Revision(intdigest.Canonical) + revision := chartRepo.Digest(intdigest.Canonical) if revision.Validate() != nil { e := &serror.Event{ Err: fmt.Errorf("failed to calculate revision: %w", err), diff --git a/internal/helm/repository/chart_repository.go b/internal/helm/repository/chart_repository.go index 8071df242..269dabf33 100644 --- a/internal/helm/repository/chart_repository.go +++ b/internal/helm/repository/chart_repository.go @@ -386,6 +386,8 @@ func (r *ChartRepository) DownloadIndex(w io.Writer) (err error) { // Revision returns the revision of the ChartRepository's Index. It assumes // the Index is stable sorted. +// Deprecated: because of expensive memory usage of (YAML) marshal operations. +// We only use Digest now. func (r *ChartRepository) Revision(algorithm digest.Algorithm) digest.Digest { if !r.HasIndex() { return ""