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
Allow user to select Kubeconfig from filesystem #740
Conversation
Signed-off-by: Roman <ixrock@gmail.com>
render() { | ||
const { onSelectFiles, readAsText, ...props } = this.props; | ||
return ( | ||
<input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow set a directory here? It would make sense to open a file dialog to a path where default kubeconfig is located (thanks @matti for this tip).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to check if it's possible with standard <input type="file">
system dialog to customize it somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find anything appropriate for https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not normally allowed because of browser security issues. Electron could have an extension to this behaviour because it also allows to read local files (which browsers don't allow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is it possible to show hidden files and folders in upload dialog? It's impossible to go to some paths because of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We probably should open an issue about using electron's showOpenDialog
(instead of input).
An idea (out of the scope): should we also allow to drop kubeconfig files from filesystem right into this "input"? |
That's why we should open the default kubeconfig location by default (because it's a hidden folder and not easily accessible on MacOS). |
Good idea! |
Actually it's possible to show hidden files/folders with https://www.electronjs.org/docs/api/dialog#dialogshowopendialogbrowserwindow-options . Anyway, we should still open a dialog to a folder where current kubeconfig is. |
BTW it's possible to show hidden files in finder in MacOS with |
Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@ixrock awesome! Could you make DCO bot happy so that we can merge this asap? |
UI needs improvement. The feature itself is good. |
@miskun let's create a separate issue about this. |
Signed-off-by: Roman <ixrock@gmail.com>
… kube-config file Signed-off-by: Roman <ixrock@gmail.com>
…auto-replace "~" => os.homedir() Signed-off-by: Roman <ixrock@gmail.com>
One more question: in case of using second tab with custom kube-config text: should we still use "Select context" form-control or hide it and instead consume all clusters and contexts from pasted config? |
Can you replace |
My suggestion is: |
umm, if the config has a lot of contexts it will take about an hour with the current "how to remove cluster from lens" - it is a LOT of clicking. And I think doing that kind of thing "add all clusters" is horribly wrong decission anyway. The user is doing "add cluster" - not "add clusterS" |
Good point, thanks @matti ! |
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
I think it's now pre-selects all contexts found in kubeconfig. That might be fine if there's only one context but if there are hundreds of contexts it's not good idea. |
When adding clusters from kubeconfig file, we don't want to save kubeconfig under app resources but we want to keep the reference to the original kubeconfig file. If pasting kubeconfig, then we store kubeconfig like we do it already. |
Please could you run |
That said, we need to unlink kubeconfig file on cluster remove only if kubeconfig file is stored in app resources. |
What happens if file is damaged or added context will be removed from original kubeconfig file at some point? |
Signed-off-by: Roman <ixrock@gmail.com>
…stom_config # Conflicts: # src/common/cluster-store.ts # src/migrations/cluster-store/3.6.0-beta.1.ts
Signed-off-by: Roman <ixrock@gmail.com>
@nevalla ready to merge, please check. |
src/common/vars.ts
Outdated
@@ -5,7 +5,7 @@ import { defineGlobal } from "./utils/defineGlobal"; | |||
|
|||
export const isMac = process.platform === "darwin" | |||
export const isWindows = process.platform === "win32" | |||
export const isDebugging = process.env.DEBUG === "true"; | |||
export const isDebugging = process.env.DEBUG === "lens"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert this and let's focus on this in separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Roman <ixrock@gmail.com>
I'm not sure about this. I have one context in default kubeconfig that I don't ever want to add to Lens. Now it's always auto-selected when adding new clusters. @jakolehm WDYT? |
Well you can de-select manually. But for most cases auto-selection is good IMO. |
IMHO auto-selection is not a good idea. I have had times when I have huge number of clusters in kubeconfig and normally I always just want to get one cluster from there. |
Signed-off-by: Roman <ixrock@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
close #738