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

Now you need to explicitly pass --namespace with --context if namespace is different from the current-context one #109

Open
andreacab opened this issue Dec 10, 2019 · 2 comments

Comments

@andreacab
Copy link

andreacab commented Dec 10, 2019

Hi there,

Not sure, if that's the intended behaviour but presently if I pass --context and that context has a namespace attached to it in my kube config file, I won't be able to tail anything as it won't get the specific namespace of that context, it will set the namespace of the current-context no matter what.

My configuration is something like that:

- context:
    cluster: cluster-1.com
    namespace: dev
    user: user-cluster-1.com
  name: dev
- context:
    cluster: cluster-2.com
    namespace: prod
    user: user-cluster-2.com
  name: prod
current-context: dev

When running the following with kubetail version 1.6.10

$ kubetail oauth --context prod

returns

No pod exists that matches oauth

However, running

kubetail oauth --context prod -n prod

returns all the logs expected.

I've looked into the script and while I'm not an expert in bash I think it's due to the method calculate_default_namespace() which doesn't get passed the --context option if one is given to the kubetail command, thus, grabbing the namespace of the current-context every time that function is ran.

Happy to help if needed.

@andreacab
Copy link
Author

made an attempt at it here #110

@wederbrand
Copy link

This bothers me too. I simply cleard out namespace_arg on line 55
namespace_arg=""
That way the namespace from the context is used.

The default namespace that is being calculated is also dependent on the namespace for the current context from the config, and there is no guarantee that it will have a namespace attached to it.

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

No branches or pull requests

2 participants