roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.05k stars 565 forks source link

Global flag --debug adds all --args to helm3 command. Helm3 throws error. #1289

Open Kirill-Garbar opened 4 years ago

Kirill-Garbar commented 4 years ago

Hi. We use this helmfile command to deploy release.

helmfile --helm-binary helm3 sync --args "--atomic --timeout 10m0s --cleanup-on-fail --disable-openapi-validation --create-namespace=false"

It works fine. When we want to add global debug like this.

helmfile --helm-binary helm3 --debug sync --skip-deps --args "--atomic --timeout 10m0s --cleanup-on-fail --disable-openapi-validation --create-namespace=false"

we receive error

getting deployed release version failed:the following cmd exited with status 1:
  /usr/local/bin/helm3 helm3 list --filter ^maintenance-page$ --namespace gigabit-tm-pacman-02 --deployed --failed --pending --atomic --timeout 10m0s --cleanup-on-fail --disable-openapi-validation --create-namespace=false --debug

As I can see all args are added to helm list command.

At first we tried to pass --debug through --args:

helmfile --helm-binary helm3 sync --skip-deps --args "--atomic --timeout 10m0s --cleanup-on-fail --disable-openapi-validation --create-namespace=false --debug"

But in this case helmfile doesn't show stderr (former tiller logs), but only stdout. P.S. I want to get former tiller logs to stdout/stderr.

machine424 commented 4 years ago

The global flag --debug also sets the logging level to debug, the error is always there, it is just hidden, if you omit --debug and set --log-level debug you'll see it.

It is better to use --args for Helm's Global flags only, as a Helmfile command may call many Helm commands that don't support the same flags. Making Helmfile filter/chose the appropriate flags from --args to be passed to every Helm command may be tedious.

Most of the flags you add into --args (--atomic, --timeout ...) may be set using the helmfile.yaml

Kirill-Garbar commented 4 years ago

Hi, @machine424. Thank you for your answer.

he global flag --debug also sets the logging level to debug, the error is always there, it is just hidden, if you omit --debug and set --log-level debug you'll see it.

Yeah, yesterday I found out, that this issue is about --log-level debug.

It is better to use --args for Helm's Global flags only, as a Helmfile command may call many Helm commands that don't support the same flags. Making Helmfile filter/chose the appropriate flags from --args to be passed to every Helm command may be tedious.

As I can see, helmfile --args "--debug" doesn't show all the logs, that helm shows. It seems, helmfile filters stderr output of helm. I read some issues yesterday about complexity with args flag.

Most of the flags you add into --args (--atomic, --timeout ...) may be set using the helmfile.yaml.

I totally agree, but unfortunately we can't do that way at the moment.

So from my point of view the current issue is missing stderr logs from helm.

machine424 commented 4 years ago

Hi, @Kirill-Garbar

There is already an opened issue about Helm --debug's logs being swallowed by Helmfile: https://github.com/roboll/helmfile/issues/1255 if that is your problem.

Kirill-Garbar commented 4 years ago

@machine424 Maybe. I've seen it before, but from the first glance I understood it is about realtime logs. If release is failed, I can see the logs at the end of the timeout and rollback. If release is successfull, helm logs (like in the example below) are hidden from us.

  history.go:52: [debug] getting history for release <release_name>
  upgrade.go:121: [debug] preparing upgrade for <release_name>
  upgrade.go:434: [debug] resetting values to the chart's original version
  upgrade.go:129: [debug] performing update for <release_name>
  upgrade.go:308: [debug] creating upgraded release for <release_name>
  client.go:173: [debug] checking 6 resources for changes
  client.go:194: [debug] Created a new Secret called "<release_name>-secret" in <namespace>

If that issue is about it, so this issue is duplicate.

desaintmartin commented 4 years ago

At first glance, this looks like because all those informations are sent by helm to stderr (why?), and stderr is never returned by Output.