@@ -667,16 +667,16 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
667667
668668 // Attempt to load the index from the cache.
669669 if r .Cache != nil {
670- if index , ok := r .Cache .Get (httpChartRepo .Path ); ok {
670+ if index , ok := r .Cache .Get (repo . GetArtifact () .Path ); ok {
671671 r .IncCacheEvents (cache .CacheEventTypeHit , repo .Name , repo .Namespace )
672- r .Cache .SetExpiration (httpChartRepo .Path , r .TTL )
672+ r .Cache .SetExpiration (repo . GetArtifact () .Path , r .TTL )
673673 httpChartRepo .Index = index .(* helmrepo.IndexFile )
674674 } else {
675675 r .IncCacheEvents (cache .CacheEventTypeMiss , repo .Name , repo .Namespace )
676676 defer func () {
677677 // If we succeed in loading the index, cache it.
678678 if httpChartRepo .Index != nil {
679- if err = r .Cache .Set (httpChartRepo .Path , httpChartRepo .Index , r .TTL ); err != nil {
679+ if err = r .Cache .Set (repo . GetArtifact () .Path , httpChartRepo .Index , r .TTL ); err != nil {
680680 r .eventLogf (ctx , obj , eventv1 .EventTypeTrace , sourcev1 .CacheOperationFailedReason , "failed to cache index: %s" , err )
681681 }
682682 }
@@ -1123,21 +1123,21 @@ func (r *HelmChartReconciler) namespacedChartRepositoryCallback(ctx context.Cont
11231123 return nil , err
11241124 }
11251125
1126- if obj .Status .Artifact != nil {
1126+ if artifact := obj .GetArtifact (); artifact != nil {
1127+ httpChartRepo .Path = r .Storage .LocalPath (* artifact )
1128+
11271129 // Attempt to load the index from the cache.
1128- httpChartRepo .Path = r .Storage .LocalPath (* obj .GetArtifact ())
11291130 if r .Cache != nil {
1130- if index , ok := r .Cache .Get (httpChartRepo .Path ); ok {
1131+ if index , ok := r .Cache .Get (artifact .Path ); ok {
11311132 r .IncCacheEvents (cache .CacheEventTypeHit , name , namespace )
1132- r .Cache .SetExpiration (httpChartRepo .Path , r .TTL )
1133-
1133+ r .Cache .SetExpiration (artifact .Path , r .TTL )
11341134 httpChartRepo .Index = index .(* helmrepo.IndexFile )
11351135 } else {
11361136 r .IncCacheEvents (cache .CacheEventTypeMiss , name , namespace )
11371137 if err := httpChartRepo .LoadFromPath (); err != nil {
11381138 return nil , err
11391139 }
1140- r .Cache .Set (httpChartRepo .Path , httpChartRepo .Index , r .TTL )
1140+ r .Cache .Set (artifact .Path , httpChartRepo .Index , r .TTL )
11411141 }
11421142 }
11431143 }
0 commit comments