Skip to content

Commit 8a9bc98

Browse files
authored
Merge pull request #1540 from fluxcd/backport-1539-to-release/v1.7.x
[release/v1.7.x] Allow fetching artifacts from a local source-watcher
2 parents 1d4447f + 1df5cad commit 8a9bc98

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/controller/kustomization_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,19 @@ func (r *KustomizationReconciler) reconcile(
326326
}
327327
}(tmpDir)
328328

329+
// Set the artifact URL hostname override for localhost access.
330+
sourceLocalhost := os.Getenv("SOURCE_CONTROLLER_LOCALHOST")
331+
if strings.Contains(src.GetArtifact().URL, "//source-watcher") {
332+
sourceLocalhost = os.Getenv("SOURCE_WATCHER_LOCALHOST")
333+
}
334+
329335
// Download artifact and extract files to the tmp dir.
330336
fetcher := fetch.New(
331337
fetch.WithLogger(ctrl.LoggerFrom(ctx)),
332338
fetch.WithRetries(r.ArtifactFetchRetries),
333339
fetch.WithMaxDownloadSize(tar.UnlimitedUntarSize),
334340
fetch.WithUntar(tar.WithMaxUntarSize(tar.UnlimitedUntarSize)),
335-
fetch.WithHostnameOverwrite(os.Getenv("SOURCE_CONTROLLER_LOCALHOST")),
341+
fetch.WithHostnameOverwrite(sourceLocalhost),
336342
)
337343
if err = fetcher.Fetch(src.GetArtifact().URL, src.GetArtifact().Digest, tmpDir); err != nil {
338344
conditions.MarkFalse(obj, meta.ReadyCondition, meta.ArtifactFailedReason, "%s", err)

0 commit comments

Comments
 (0)