Search code examples
gokuberneteskubernetes-helm

Helm go sdk install chart from external location


Im using the following code to install chart that is bounded in my source code (eg. in my app/chart/chart1 in my go bin app), Now I need to move the chart to git repository or to artifactory,

My question is how can I install the chart from outside my program?

This is the code I use which works for bundled chart

I use the helm3 loader package which works when I have the chart bundled in my app

chart, err := loader.Load(“chart/chart1”)

https://pkg.go.dev/helm.sh/helm/[email protected]/pkg/chart/loader

Should I load it somehow with an http call or helm have some built in functionality ? we need some efficient way to handle it


Solution

  • You can use something like this for installing nginx chart

    
        myChart, err := loader.Load("https://charts.bitnami.com/bitnami/nginx-8.8.4.tgz")
    ...
        install := action.NewInstall(m.actionConfig)
        install.ReleaseName = "my-release"
    ...
        myRelease, err := install.Run(myChart, myValues)
    

    It would be similar to:

    helm install my-release https://charts.bitnami.com/bitnami/nginx-8.8.4.tgz