kubetail icon indicating copy to clipboard operation
kubetail copied to clipboard

Set context before calculating default namespace

Open andreacab opened this issue 5 years ago • 2 comments

With that change and a following kube config

- context
    namespace: dev
  name: dev
- context
    namespace: prod
  name: prod

all calls to kubetail below will work and yield the same result

kubetail --context prod
kubetail -n prod --context prod
kubetail --context prod -n prod

andreacab avatar Dec 10 '19 08:12 andreacab

Thanks for the PR! However I find it a bit hacky to set the context like this. I think it should be possible to pass it as an argument to calculate_default_namespace instead which would be nicer and include less mutable state (at least that what I hope). I'll see if I can come up with an alternative, but big thanks for the PR anyway! I'll let you know when/if I come up with an alternative and I would be super happy if you could try it out.

johanhaleby avatar Dec 11 '19 15:12 johanhaleby

Hey @johanhaleby totally fair, wasn't happy with my solution either but couldn't come up with a cleaner way. I'll be in standby if you need me.

andreacab avatar Dec 12 '19 08:12 andreacab