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

use relative path to kubeconfig files in mirrord.json #2262

Closed
jstrachan opened this issue Feb 22, 2024 · 4 comments · Fixed by #2263
Closed

use relative path to kubeconfig files in mirrord.json #2262

jstrachan opened this issue Feb 22, 2024 · 4 comments · Fixed by #2263
Labels
enhancement New feature or request

Comments

@jstrachan
Copy link

we have lots of different git repositories that work with different kubernetes clusters; so we tend to check in local kube config files to each git repository. e.g. relative to the git directory they may be in: ./kubeconfigs/dev/.kube/config for the Dev environment

however I’ve only been able to refer to these project local kube config files using an absolute path in the .mirrord/mirrord.json file; all attempts at relative paths don't seem to work. I guess this is due to the mirrord plugin/agent running in a different temp directory maybe?

I wonder is it possible to use a relative path or expression/environment variable for the current IntelliJ project directory inside the kubeconfig value in the .mirrord/mirrord.json file?

As I’d love to be able to check in the .mirrord/mirrord.json file to git but right now it only works on 1 persons laptop due to the absolute path.

If this isn’t supported yet I’ll happy try figure out a patch; any hints/tips greatly appreciated - thanks!

@jstrachan jstrachan added the enhancement New feature or request label Feb 22, 2024
@aviramha
Copy link
Member

Hey! Thanks for the suggestion.
We actually use shellexpand which should support tilde

        let kubeconfig = shellexpand::tilde(&kubeconfig);
        let parsed_kube_config = Kubeconfig::read_from(kubeconfig.deref())?;

I'll send a patch to also expand environment variables - I'm not sure what's the "current directory" from our execution context, but hopefully the env would be good enough?

@aviramha
Copy link
Member

aviramha commented Feb 22, 2024

I've sent a PR - we just had 2 releases today so I'd prefer to postpone it to early next week ;)

@jstrachan
Copy link
Author

@aviramha many thanks!

is there a canonical env var for the current project directory I wonder? I guess thats maybe more of a question for the IntelliJ plugin; it could maybe pass that along when it runs mirrord agent

@aviramha
Copy link
Member

@jstrachan not sure if we have the project directory from our context - seems there's an open issue for IntelliJ to provide it
https://youtrack.jetbrains.com/issue/IDEA-122504
Sadly it is open for quite long time, but it seems to be updated lately so maybe there's hope!
If you'd like to send a PR for the IntelliJ plugin to do it from our side, feel free to do so :)

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

Successfully merging a pull request may close this issue.

2 participants