<p>We are using the Go <a href="https://pkg.go.dev/helm.sh/helm/v3/pkg/action" rel="nofollow noreferrer">helm.sh/helm/v3/pkg/action</a> package to install Helm charts.
We are able to pass installation values to Helm chart <code>Run</code> functions via <code>map[string]interface{}</code>, as in <a href="https://stackoverflow.com/questions/45692719/samples-on-kubernetes-helm-golang-client">Samples on kubernetes helm golang client</a>:</p>
<pre class="lang-golang prettyprint-override"><code>rel, err := client.Run(myChart, vals)
if err != nil {
    log.Println(err)
    panic(err)
}
</code></pre>
<p>But we have a <code>values.yaml</code> file also which was passed as <code>-f values.yaml</code> when installing charts from the CLI.
Is there a way to pass these <code>values.yaml</code> files via the action Go package during installation (<code>client.Run()</code>)?</p>
<p>Or do we need to unmarshal the YAML file and pass that also as map:</p>
<pre class="lang-golang prettyprint-override"><code>data2 := make(map[string]interface{})
yfile2, err := ioutil.ReadFile(&quot;./utils/values.yaml&quot;)

fmt.Println(err)
err = yaml.Unmarshal(yfile2, &amp;data2)
</code></pre>

<p>One straightforward thing to do could be to reuse the <a href="https://pkg.go.dev/helm.sh/helm/v3@v3.9.3/pkg/cli/values" rel="nofollow noreferrer">helm.sh/helm/v3/pkg/cli/values</a> package.  This has the logic to handle the <code>-f</code> option (and also <code>--set</code> and its variants) and return a unified <code>map[string]interface{}</code>.  This could look like:</p>
<pre class="lang-golang prettyprint-override"><code>import (
        &quot;helm.sh/helm/v3/pkg/cli&quot;
        &quot;helm.sh/helm/v3/pkg/cli/values&quot;
        &quot;helm.sh/helm/v3/pkg/getter&quot;
)

envSettings := cli.New()
providers := getter.All(envSettings)
options := values.Options{
        ValueFiles: []string{&quot;./utils/values.yaml&quot;},
}
theValues := options.MergeValues(providers)
</code></pre>
<p>Now <code>theValues</code> is the <code>map[string]interface{}</code> that results from reading those files.  You can customize the values further if required (as Go data) and then pass that to <code>install.Run()</code>.</p>
