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

[kubeapps-apis] Add fallback mechanism to use the local kubeconfig file #2970

Merged
merged 5 commits into from
Jun 10, 2021

Conversation

antgamdia
Copy link
Contributor

@antgamdia antgamdia commented Jun 10, 2021

Description of the change

This PR adds a fallback mechanism in case that: 1. getting an inCluster fails AND 2. the --unsafe-use-demo-sa=true is passed. In that case, it will try to retrieve the kubeconfig file from the KUBECONFIG env var.

Benefits

Local development will be easier since it isn't required to deploy kubeapps-apis in the cluster, but just connecting to it using a kubeconfig file.

Possible drawbacks

As it is just a change intended for dev purposes we probably want to remove it in the mid-term.

Applicable issues

Additional information

Since it was easy to implement (without considering edge cases, of course, just a rough impl to easen development), I just go with this fallback mechanism. But also happy to consider other alternatives.

Adding a change for #2964 (comment)

Copy link
Contributor

@absoludity absoludity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - this not only avoids requiring the clusters config in development, but also makes it trivial to run locally talking to your development k8s api server. Only suggestion I'd have is to simplify the condition by adding a --unsafe-local-dev-kubeconfig flag instead of relying on a combination of missing clusters config and a related --unsafe-user-demo-sa which is for a different purpose, though related. But up to you.

@antgamdia
Copy link
Contributor Author

Only suggestion I'd have is to simplify the condition by adding a --unsafe-local-dev-kubeconfig flag instead of relying on a combination of missing clusters config and a related --unsafe-user-demo-sa which is for a different purpose, though related. But up to you.

Great, I've just added the flag :)
I just went quickly performing the changes so that others didn't get blocked because of this, but, while then I realized it was easier to add this kubeconfig feature rather than just ignoring the error. Glad to know it can be useful :)

@antgamdia antgamdia merged commit 85f5ace into vmware-tanzu:master Jun 10, 2021
@antgamdia antgamdia deleted the fixMakeRunApis branch June 10, 2021 17:16
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

Successfully merging this pull request may close these issues.

[kubeapps-api] Fix "make run" to locally test the changes w/o passing cluster config
2 participants