Skip to content

Commit 4f1b241

Browse files
authored
Merge pull request #293 from fluxcd/remove-ctx
Do not override the artifact fetch timeout
2 parents ff38a3f + 8708205 commit 4f1b241

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

controllers/kustomization_controller.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func (r *KustomizationReconciler) reconcile(
281281
defer os.RemoveAll(tmpDir)
282282

283283
// download artifact and extract files
284-
err = r.download(kustomization, source.GetArtifact().URL, tmpDir)
284+
err = r.download(source.GetArtifact().URL, tmpDir)
285285
if err != nil {
286286
return kustomizev1.KustomizationNotReady(
287287
kustomization,
@@ -423,11 +423,7 @@ func (r *KustomizationReconciler) checkDependencies(kustomization kustomizev1.Ku
423423
return nil
424424
}
425425

426-
func (r *KustomizationReconciler) download(kustomization kustomizev1.Kustomization, artifactURL string, tmpDir string) error {
427-
timeout := kustomization.GetTimeout() + (time.Second * 1)
428-
ctx, cancel := context.WithTimeout(context.Background(), timeout)
429-
defer cancel()
430-
426+
func (r *KustomizationReconciler) download(artifactURL string, tmpDir string) error {
431427
if hostname := os.Getenv("SOURCE_CONTROLLER_LOCALHOST"); hostname != "" {
432428
u, err := url.Parse(artifactURL)
433429
if err != nil {
@@ -442,7 +438,7 @@ func (r *KustomizationReconciler) download(kustomization kustomizev1.Kustomizati
442438
return fmt.Errorf("failed to create a new request: %w", err)
443439
}
444440

445-
resp, err := r.httpClient.Do(req.WithContext(ctx))
441+
resp, err := r.httpClient.Do(req)
446442
if err != nil {
447443
return fmt.Errorf("failed to download artifact, error: %w", err)
448444
}

0 commit comments

Comments
 (0)