Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass-thru options for helmfile template #1060

Open
travisghansen opened this issue Jan 6, 2020 · 17 comments
Open

pass-thru options for helmfile template #1060

travisghansen opened this issue Jan 6, 2020 · 17 comments

Comments

@travisghansen
Copy link

Thanks for the great tool! Trying to best leverage helmfile in a gitops situation (specifically looking at argo-cd ATM) and found a few options that would be helpful to pass through to helm:

  • --no-hooks
  • --skip-crds
  • --api-versions

I'm not sure exactly how --api-versions versions is meant to be used, meaning, not sure if it can be specified multiple times, or once with comma-separate values or what.

Thanks!

#1014 (comment)

@travisghansen
Copy link
Author

It appears --is-upgrade has been re-introduced as well. Could be useful: helm/helm#7054

@travisghansen
Copy link
Author

I noticed there's a --args command that seems to let you pass thru anything you'd like. This could be unnecessary.

@Nuru
Copy link

Nuru commented Jun 12, 2020

@mumoshu I could use an option for skip-crds, preferably in the helmfile as with createNamespace.

helmfile sync --args --skip-crds

is a problem, because I need it for helm install and helm upgrade, but if installed: false then it turns into helm delete which does not have a skip-crds option.

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 13, 2020

We're trying to deprecate --args as we can't really relialy determine which args should be passed to which helm commands. So yes, we'd better add native support for those options!

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 13, 2020

@travisghansen Do you need those options to be configurable within helmfile.yaml? Or maybe you only need that in helmfile template args?

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 13, 2020

Maybe --no-hooks should be added to just helmfile template. But I'm not yet sure about others.

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 13, 2020

@Nuru Sorry but I don't know how I'd use --skip-crds. Is it for helm upgrade to prevent any updates to CRDs?

@Nuru
Copy link

Nuru commented Jun 13, 2020

@mumoshu If we want to manage CRDs some other way than with the helm chart we are using to install the program, --skip-crds keeps helm from doing anything with them.

skip-crds: "if set, no CRDs will be installed. By default, CRDs are installed if not already present." It is an option for "install" and "upgrade" and maybe other helm sub-commands.

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 13, 2020

@Nuru Thanks! Gotcha. So you would probably like to use it from a command-line arg, like helmfile sync --skip-crds, right? There will be no use-case if we make it configurable per release in helmfile.yaml?

@travisghansen
Copy link
Author

@Nuru
Copy link

Nuru commented Jun 13, 2020

@Nuru Thanks! Gotcha. So you would probably like to use it from a command-line arg, like helmfile sync --skip-crds, right? There will be no use-case if we make it configurable per release in helmfile.yaml?

@mumoshu On the contrary, I would primarily use it in the helmfile.yaml, because it is part of how I am managing the release of the chart. "For this chart, I am manually managing CRDs, so skip CRDs for the chart." That is why I mentioned createNamespace: I would like a similar skipCRDs option for a release.

@Nuru
Copy link

Nuru commented Jun 25, 2020

@mumoshu This is a bigger problem than I thought, because I cannot use helmfile apply --args --skip-crds because of helm diff.

@albertrdixon
Copy link

I'd like to throw out there --include-crds with helm template. I would love this to be included in helmfile.yaml as I am currently having to hardcode helmfile template --args='--include-crds' in my argo-cd gitops pipeline - similar to @travisghansen - and I hate hardcoding that type of thing in automated pipelines for obvious reasons.

Maybe something like this could work (as an easier substitute before a better solution)?

helmDefaults:
  args:
    template: ["--include-crds"]
    apply: ["--skip-crds"]
...

mumoshu added a commit that referenced this issue Aug 6, 2020
Relates to #1110
Relates to #1060
Relates to #780
mumoshu added a commit that referenced this issue Aug 6, 2020
Relates to #1110
Relates to #1060
Relates to #780
@GolubevV
Copy link

GolubevV commented Oct 6, 2020

Just like @travisghansen, I was working on integrating Helmfile with ArgoCD, using CustomTool approach of the later to dynamically render results of the Helmfile.

@travisghansen has provided a great script to make that work here, however the Api Versions capabilities do not work, as helm template command expects stringArray of --api-versions command line flag while script is currently passing comma-separated set of versions via single flag

I tried to fork the repository and update bash script logic to pass multiple --api-versions flags in the --args parameter of the helmfile, but now problems seems to be that helmfile is not correctly working with mutiple parameters specified using the same key (as described in #457 )

So my current solution to dynamically feed helmfile, invoked via ArgoCD, with apiversions of target cluster is using the new apiVersions section (described in doc under Advanced Configuration: API Capabilities) and requiring the ArgoCD parameter to be set:

apiVersions:
{{- range $apiV := (requiredEnv "KUBE_API_VERSIONS" | split ",") }}
- {{ $apiV }}
{{- end }}

@travisghansen
Copy link
Author

@GolubevV could you open an issue up on my project as well to discuss and possibly fix however best we can currently?

@GolubevV
Copy link

GolubevV commented Oct 8, 2020

@travisghansen - I can make a PR with a fix to the script that will change behaviour to provide each K8S APi version with a separate dedicated flag.

However, that would not fix the problem completely as some change in the helmfile logic is required to perform correct support for multiple flags with the same key value (--api-versions), provided either via --args or helmDefaults.args to be proxied down to helm template command. Currently, it looks like only the first argument is used, while all others are just dropped ( as described in issue 457 comment)

@mumoshu - For that problem, i am not sure if that should be tracked in this issue, issue #457 or should i create a completely new one?

@craigmulligan
Copy link

Just to add some more usecases into the pot. I'm trying to pass --no-hooks to helmfile apply & helm sync both currently fail because they are running a helm command (eg helm list) that doesn't support the --no-hooks flag. @albertrdixon suggestion of name-spacing the helm args would work for my use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants