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

should helm_resource always use k8s_context()? #599

Open
znd4 opened this issue Aug 19, 2024 · 12 comments
Open

should helm_resource always use k8s_context()? #599

znd4 opened this issue Aug 19, 2024 · 12 comments

Comments

@znd4
Copy link

znd4 commented Aug 19, 2024

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
Copy link
Member

nicks commented Aug 19, 2024

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
Copy link
Member

nicks commented Aug 20, 2024

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
Copy link
Author

znd4 commented Oct 23, 2024

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
Copy link
Member

nicks commented Oct 23, 2024

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

@nicks
Copy link
Member

nicks commented Oct 24, 2024

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
Copy link
Author

znd4 commented Oct 24, 2024

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

@znd4
Copy link
Author

znd4 commented Oct 24, 2024

(thx for trying to repro btw :) )

@nicks
Copy link
Member

nicks commented Nov 19, 2024

we received a bug report about kube contexts not resolving correctly sometimes if you were using docker compose and kubernetes in the same tiltfile - tilt-dev/tilt#6453

was that possibly the issue here?

@znd4
Copy link
Author

znd4 commented Nov 19, 2024

I was building images with docker, but no docker compose

@znd4
Copy link
Author

znd4 commented Nov 19, 2024

If you see this comment, the issue is tilt's --context not being respected by helm_resource

@znd4
Copy link
Author

znd4 commented Dec 12, 2024

(obvs when you get a chance), can you try

  1. Create two kubectl contexts -- kind, and a dummy kubectl context connected to a dead cluster.
  2. kubectl config use-context dummy
  3. tilt up --context kind-kind in https://github.com/tilt-dev/tilt-extensions/tree/master/helm_resource/test
  4. Check if tilt installs into the kind cluster or errors trying to install into the dead cluster

nicks added a commit that referenced this issue Dec 13, 2024
#599
Signed-off-by: Nick Santos <[email protected]>
@nicks nicks mentioned this issue Dec 13, 2024
@nicks
Copy link
Member

nicks commented Dec 13, 2024

sure, here's what i tried:
#624

seems to work correctly:
https://app.circleci.com/pipelines/github/tilt-dev/tilt-extensions/1726/workflows/0f14996e-bca2-4753-8fb4-dbd6b96b1b4a/jobs/4203

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

No branches or pull requests

2 participants