@@ -83,8 +83,9 @@ type KustomizationReconciler struct {
8383 kuberecorder.EventRecorder
8484 runtimeCtrl.Metrics
8585
86- artifactFetcher * fetch.ArchiveFetcher
87- requeueDependency time.Duration
86+ artifactFetchRetries int
87+ requeueDependency time.Duration
88+
8889 StatusPoller * polling.StatusPoller
8990 PollingOpts polling.Options
9091 ControllerName string
@@ -132,12 +133,7 @@ func (r *KustomizationReconciler) SetupWithManager(ctx context.Context, mgr ctrl
132133
133134 r .requeueDependency = opts .DependencyRequeueInterval
134135 r .statusManager = fmt .Sprintf ("gotk-%s" , r .ControllerName )
135- r .artifactFetcher = fetch .NewArchiveFetcher (
136- opts .HTTPRetry ,
137- tar .UnlimitedUntarSize ,
138- tar .UnlimitedUntarSize ,
139- os .Getenv ("SOURCE_CONTROLLER_LOCALHOST" ),
140- )
136+ r .artifactFetchRetries = opts .HTTPRetry
141137
142138 return ctrl .NewControllerManagedBy (mgr ).
143139 For (& kustomizev1.Kustomization {}, builder .WithPredicates (
@@ -322,8 +318,13 @@ func (r *KustomizationReconciler) reconcile(
322318 defer os .RemoveAll (tmpDir )
323319
324320 // Download artifact and extract files to the tmp dir.
325- err = r .artifactFetcher .Fetch (src .GetArtifact ().URL , src .GetArtifact ().Digest , tmpDir )
326- if err != nil {
321+ if err = fetch .NewArchiveFetcherWithLogger (
322+ r .artifactFetchRetries ,
323+ tar .UnlimitedUntarSize ,
324+ tar .UnlimitedUntarSize ,
325+ os .Getenv ("SOURCE_CONTROLLER_LOCALHOST" ),
326+ ctrl .LoggerFrom (ctx ),
327+ ).Fetch (src .GetArtifact ().URL , src .GetArtifact ().Digest , tmpDir ); err != nil {
327328 conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , err .Error ())
328329 return err
329330 }
0 commit comments