containers / podman-desktop

Podman Desktop is the best free and open source tool to work with Containers and Kubernetes for developers. Get an intuitive and user-friendly interface to effortlessly build, manage, and deploy containers and Kubernetes — all from your desktop.
https://podman-desktop.io
Apache License 2.0
4.72k stars 298 forks source link

Design: mockup for adding new kube context to kube config #5049

Open mairin opened 10 months ago

mairin commented 10 months ago

Is your feature request related to a problem? Please describe

For the Kubernetes contexts list page, we need (maybe a purple button in upper right) to create a new kube context.

Describe the solution you'd like

I would look at how we handle creating a new podman machine for a general idea of how the form page should look for this.

Describe alternatives you've considered

No response

Additional context

No response

ekidneyrh commented 9 months ago

Here is the current mock-up for this -

Screen 1: Screenshot from 2024-01-03 10-39-10

Screen 2: Screenshot from 2024-01-03 10-39-28

I followed the creating action that is used already - like adding a volume. For the second screen, I was unsure of what fields are relevant for to create a context, so guidance on that would be appreciated :)

lstocchi commented 8 months ago

@ekidneyrh just saw this issue as i should start working on the implementation. This is an explanation about the fields we should show.

The structure of the kube config is like this

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: xxxx
    server: https://127.0.0.1:58774
  name: kind-cluster
  ......
users:
- name: lstocchi/api-sandbox-m2-ll9k-p1-openshiftapps-com:6443
  user:
    token: sha256~K-aIqLXCkw2oe1QXiTSjIA246j_fPDCm92MnQjUzJQQ
 ....
contexts:
- context:
    cluster: kind-kind-cluster-2
    namespace: projectcontour
    user: kind-kind-user-2
  name: kind-kind-cluster-2

so we have a clusters section, a users section and then the contexts section. A context is just an object having all the infos to connect to a cluster. E.g. By selecting the context kind-kind-cluster-2 above i'm saying i want to connect to cluster kind-kind-cluster-2 as user kind-kind-user-2 on namespace projectcontour.

So, to add a new context we need to type its name, then select a cluster from a list (those retrieved by parsing the kubeconfig file) or add a new one, then select a user from a list (retrieve by parsing the kubeconfig) or add a new one.

To create/add a new cluster the options are:

To create/add a new user the options are:

there are other fields for both cluster and user but i think they are good for a first implementation.

feloy commented 7 months ago

As a user, I would be VERY happy to have a button to duplicate a context and only change the namespace on it (which would provide an equivalent of the kubectl ns non-official command)

ekidneyrh commented 7 months ago

Thanks, @lstocchi, for the additional info! Had some time to finish this version up.

#5049 new kube context @emma

I changed the field names to title case but can revert to dash-case if more appropriate.

@feloy - would this be something for this screen or maybe on the Kubernetes screen before this one?

feloy commented 7 months ago

I'm not sure it is really necessary to add new clusters, when adding a context. Generally, when you create a cluster, you get the context added for this cluster automatically to your kubeconfig file (this is what happens when you create a minikube or kind cluster, when you connect to an Openshift cluster with oc login, etc.).

For me, the cases when we want to add a new context into a kubeconfig file are (by order of importance):

ekidneyrh commented 7 months ago

@feloy Editing the namespace of a context can be addressed directly on the existing context card. (https://github.com/containers/podman-desktop/issues/4891#issuecomment-1842671377) More work could be done on the icon well to include a duplicate button also? I played around with the layout of it some more:

context-card

For just changing the user, would a new screen be necessary just for this, or is that something that can also be done just in the editing of the existing context card? Here's the 'Create a Context' page without the new cluster and user fields:

5049

feloy commented 7 months ago

In fact, I'm not sure it would be useful to have the possibility to create a new context from scratch.

The mockup above is a typical example: you have cluster2 and cluster3 clusters, and user2 and user3 users. The values come from the 2 contexts, context2 (with cluster2 and user2) and context3 (with cluster3 and user3).

But there is no chance a user can create another context with cluster2 and user3, because they cannot work together.

So, in my previous message, I would even remove the second point "to add a context for an existing cluster, changing the user", as if we have a user compatible with a cluster, we necessarily already have the context with this user and cluster.

Finally, except for changing the namespace, I cannot see any other reason to add a context from the UI.

The only way I would find interesting as a user would be to be able to copy/paste the content of a kubeconfig file (or to upload it), to merge it with the current kubeconfig file.

@cdrage @deboer-tim @slemeur WDYT?

benoitf commented 7 months ago

hello, on my side I would put on hold this task as there is a need to have more discussions for the feature

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had activity in the last 6 months. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

feloy commented 3 weeks ago

still valid