Re: Helm Question: Provide Helm Install flags using client.go

Matt Fisher
 

Ante,

This has been common feedback from other Helm users as well. Currently those flags and functions are intentionally hidden away in the `cmd` package, which is an internal package and cannot be imported outside of the helm project.

For reference, A similar comment was made in https://github.com/helm/helm/issues/5311. In the past, the internals of the `cmd` package changed very often due to breaking changes in `k8s.io/kubernetes`, which is why we have avoided migrating these functions to the `pkg` package in the past.

You may wish to take a look at https://github.com/helm/helm/pull/5365 which refactors most of the internal code for Helm 3, including splitting out the feature flags into the action package (new for Helm 3). While that won't help you in the short term, I just wanted to point it out that we are working on making this easier to maintain in the future and to expose more of the `cmd` package's internals for other projects to take advantage of.

In the meantime, you'll have to copy that code over to your project and maintain it yourself. It's too significant of an overhaul to make that change in Helm 2 and maintain backwards compatibility, which is why we're opting to do the work for Helm 3.

Hope that helps!


1504220459230_microsoft.png

Matthew Fisher

Caffeinated Software Engineer

Microsoft Canada


From: cncf-helm@... <cncf-helm@...> on behalf of via Lists.Cncf.Io <ante.peric1990=gmail.com@...>
Sent: Monday, March 11, 2019 6:18 AM
To: cncf-helm@...
Cc: cncf-helm@...
Subject: [cncf-helm] Helm Question: Provide Helm Install flags using client.go
 
Hi,

I've received your contact through the following discussion: https://discuss.kubernetes.io/t/provide-helm-install-flags-using-client-go/5415

I'm pasting the question from discussion so you can hopefully help me.

Also, I would be very grateful if somebody can send me Slack invite (if it works that way) once Slack is up&running (I presume you're quite busy w/ this at the moment)

Thanks,
Ante

---------------------------------------------------------------------------------------------

Hi all,

This is my first post here. I wanted to ask this question in slack group but invites are currently down (maybe someone can send me invite or I can ask on another channel? I’m quite new to slack so don’t know how this plays along :) ) and I was redirected here by http://slack.k8s.io/

Also, I’m not sure if this is the correct category to ask this question so someone can maybe help to get the post redirected (if needed).

Anyways, I’m creating a small orchestration tool in Go which includes K8s and Helm. This tool makes use of helm/client.go to perform helm install. In my install I need to support several flags, including –values, --set and -f (users provide it from different sources so can’t modify the logic on user end). I’ve noticed that InstallRelease() function doesn’t allow me to separately specify –values and –set/-f combinations as command line usually does. The method allows me to specify InstallOption.ValueOverrides(data), where I need to manually merge the above flag values in order to create the data parameter. As I would prefer not to do this, I checked the install.go file (this one is executed via helm command line) and it has functions called vals() and mergeFlags(). Unfortunately, these are private so can’t use them to assemble the data above.

Therefore, I’m stuck on both ends and can’t do anything neat (without actually hacking it)

Can someone maybe help with this issue or provide suggestion?

Thanks,
Ante

Join cncf-helm@lists.cncf.io to automatically receive all group messages.