roboll / helmfile

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

KubeContext isn't working for Helmfle v0.119.1 #1333

Open bradenwright opened 4 years ago

bradenwright commented 4 years ago

I upgraded from Helmfile v0.118.5 to v0.119.1, and helmfile is no longer picking up on my kubeContext. It says that is doesn't exist but it works fine in 0.11.8.5 and works fine with Helm, and I see it in my kubeContext. I'm trying to set kubeContext under releases but for testing I did also try to set it under helmDefaults as well.

Here's some more details:

braden@Wi-THNVDI05:/mnt/d/Users/braden.wright/Helm/helmfile$ helmfile -e stage -l name=metallb diff
Adding repo jaegertracing https://jaegertracing.github.io/helm-charts
"jaegertracing" has been added to your repositories

Adding repo stable https://kubernetes-charts.storage.googleapis.com
"stable" has been added to your repositories

Adding repo rancher-latest https://releases.rancher.com/server-charts/latest
"rancher-latest" has been added to your repositories

Adding repo traefik https://containous.github.io/traefik-helm-chart
"traefik" has been added to your repositories

Updating repo
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "traefik" chart repository
...Successfully got an update from the "jaegertracing" chart repository
...Successfully got an update from the "rancher-latest" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈

Comparing release=metallb, chart=stable/metallb
in ./helmfile.yaml: command "D:\\Users\\braden.wright\\bin\\helm.exe" exited with non-zero status:

PATH:
  D:\Users\braden.wright\bin\helm.exe

ARGS:
  0: helm (4 bytes)
  1: --kube-context (14 bytes)
  2: stage01-linux (13 bytes)
  3: diff (4 bytes)
  4: upgrade (7 bytes)
  5: --reset-values (14 bytes)
  6: --allow-unreleased (18 bytes)
  7: metallb (7 bytes)
  8: stable/metallb (14 bytes)
  9: --version (9 bytes)
  10: 0.12.0 (6 bytes)
  11: --kube-context (14 bytes)
  12: stage01-linux (13 bytes)
  13: --namespace (11 bytes)
  14: wi-system (9 bytes)
  15: --values (8 bytes)
  16: D:\Users\braden.wright\AppData\Local\Temp\values919083502 (57 bytes)
  17: --values (8 bytes)
  18: D:\Users\braden.wright\AppData\Local\Temp\values028507253 (57 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: Failed to get release metallb in namespace wi-system: exit status 1: Error: Kubernetes cluster unreachable: context "stage01-linux" does not exist
  Error: plugin "diff" exited with error

COMBINED OUTPUT:
  Error: Failed to get release metallb in namespace wi-system: exit status 1: Error: Kubernetes cluster unreachable: context "stage01-linux" does not exist
  Error: plugin "diff" exited with error
braden@Wi-THNVDI05:/mnt/d/Users/braden.wright/Helm/helmfile$ helm ls --kube-context stage01-linux
NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION

braden@Wi-THNVDI05:/mnt/d/Users/braden.wright/Helm/helmfile$ kc config get-contexts
CURRENT   NAME            CLUSTER         AUTHINFO        NAMESPACE
          dev-api         dev-api         dev-api
          dev01-linux     dev01-linux     dev01-linux
          prod-rancher    prod-rancher    prod-rancher    
*         stage01-linux   stage01-linux   stage01-linux

braden@Wi-THNVDI05:/mnt/d/Users/braden.wright/Helm/helmfile$ helmfile -v
helmfile version v0.119.1
braden@Wi-THNVDI05:/mnt/d/Users/braden.wright/Helm/helmfile$ helmfile-v0.118.5 -e stage -l name=metallb diff
Adding repo jaegertracing https://jaegertracing.github.io/helm-charts
"jaegertracing" has been added to your repositories

Adding repo stable https://kubernetes-charts.storage.googleapis.com
"stable" has been added to your repositories

Adding repo rancher-latest https://releases.rancher.com/server-charts/latest
"rancher-latest" has been added to your repositories

Adding repo traefik https://containous.github.io/traefik-helm-chart
"traefik" has been added to your repositories

Updating repo
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "traefik" chart repository
...Successfully got an update from the "jaegertracing" chart repository
...Successfully got an update from the "rancher-latest" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈

Comparing release=metallb, chart=stable/metallb
bradenwright commented 4 years ago

FWIW, it does not work on 0.119.0 either

mumoshu commented 4 years ago

Thanks for reporting. I'm investigating this one.

mumoshu commented 4 years ago

@bradenwright Unfortunately I can't reproduce this 😢

Would you mind testing it out with v0.118.6, v0.118.7, v0.118.8, and v0.118.9?

Also, could you share me a minimum example helmfile.yaml to reproduce your issue?

mumoshu commented 4 years ago

@bradenwright Apparently #1312 is the only suspicious PR that affected this behavior, cuz it's the only PR that relates to kubeContext between v0.118.5 and v0.119.1.

But I wondering why this breaks your environment only - double --kube-context break nothing on my machine 🤔

freeo commented 3 years ago

Same issue here - I'm on 0.140.0

I've tried running tillerless: true & false. Here's some selective output from helmfile --log-level=debug --interactive apply

exec: helm diff upgrade --reset-values --allow-unreleased ingress ../../../../charts/.../ingress --version
    0.0.1 --namespace base --values /tmp/helmfile228828248/base-ingress-values-6b67f498ff --values
    /tmp/helmfile603195863/base-ingress-values-6959d9fdcd --detailed-exitcode

exec: helm diff upgrade --reset-values --allow-unreleased ingress-services ../../../../charts/.../ingress
    --version 0.0.1 --namespace base --values /tmp/helmfile477012298/base-ingress-services-values-7cb68848
    --values /tmp/helmfile190123041/base-ingress-services-values-786d4497

exec: helm dependency build ../../../../charts/...

exec: helm diff upgrade --reset-values --allow-unreleased namespace-base ../../../../somepath --version 0.0.1
    --values /tmp/helmfile427515318/namespace-base-values-8656

exec: helm dependency build ../../../../charts/.../ingress
exec: helm dependency build ../../../../charts/.../ingress

In total I can't find "--kube-context" anywhere, which is defined in my helmDefaults.

Anything else I should run to help debug?!

yuri-1987 commented 3 years ago

I discovered this while building a new environment on GKE when I got a new mac, previously I was able to work in most places with these defaults:

helmDefaults:
  tillerless: {{ .Values | get "tillerless" true }}
  kubeContext: {{ .Values.kubeContext }}
  verify: false
  wait: true
  atomic: true
  timeout: 300
  recreatePods: false
  force: false
  historyMax: 8
  devel: false
  cleanupOnFail: false
  createNamespace: true

but now, only after removing tillerless: {{ .Values | get "tillerless" true }} I managed to solve this 🤷‍♂️