Skip to content

Commit

Permalink
Allow the controller to be run locally
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Feb 14, 2021
1 parent 8492473 commit fc18a04
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion controllers/helmrelease_controller_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ func (r *HelmReleaseReconciler) loadHelmChart(source *sourcev1.HelmChart) (*char
defer f.Close()
defer os.Remove(f.Name())

res, err := http.Get(source.GetArtifact().URL)
url := source.GetArtifact().URL
if hostname := os.Getenv("SOURCE_CONTROLLER_LOCALHOST"); hostname != "" {
url = fmt.Sprintf("http://%s/%s/%s/%s/latest.tar.gz",
hostname,
strings.ToLower(source.Kind),
source.GetNamespace(),
source.GetName())
}

res, err := http.Get(url)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fc18a04

Please sign in to comment.