tilt-dev / tilt-extensions

Extensions for Tilt
https://tilt.dev/
Apache License 2.0
204 stars 162 forks source link

should `helm_resource` always use `k8s_context()`? #599

Open znd4 opened 2 months ago

znd4 commented 2 months ago

It feels like helm_resource should respect k8s_context() by passing --kube-context={k8s_context()} (pseudocode) to helm. I've got a naive, untested implementation here, but I'm guessing there might be a better, more maintainable solution?

nicks commented 2 months ago

i believe the way it currently works is that tilt generates a custom kubeconfig for subprocesses to use with only one context, sets the KUBECONFIG environment variable, and helm respects that. No need to pass --kube-context directly

nicks commented 2 months ago

There doesn't appear to be any bug report here, so I'm going to close this issue. Let me know if I missed something!

znd4 commented 1 week ago

Update: this definitely doesn't work as intended, at least for the delete_cmd part of helm_resource.

Can we reopen this and #598 ?

nicks commented 1 week ago

Sure, can you add more details on what you tried, what you expected to happen, and what happened instead?

nicks commented 1 week ago

for what it's worth, here are the repro steps i tried:

  1. Created two kubectl contexts -- kind, and a dummy kubectl context connected to a dead cluster.
  2. kubectl config use-context kind-kind
  3. Ran tilt up in https://github.com/tilt-dev/tilt-extensions/tree/master/helm_resource/test
  4. kubectl config use-context dummy
  5. tilt trigger helloworld
  6. Confirmed that the helm chart was deleted and re-installed to the kind cluster successfully
znd4 commented 1 week ago

Instead, for 2, kubectl config use-context dummy, then 3 tilt up --context kind-kind

znd4 commented 1 week ago

(thx for trying to repro btw :) )