Skip to content

Add service to expose configuration to users #6

@amimof

Description

@amimof

A user must be able to get information about which clusters that multikube manages and their endpoints.
This is so that they can populate their .kube/config files.

Suggesting that we enhance proxy.go with a service that responds to /clientconfig and returns the cluster endpoints and contexts.

Eg. curl -H "Authorization: Bearer eyJh..5Q" https://127.0.0.1:8443/clientconfig

{
    "clusters": {
        "kladdis": {
            "server": "https://localhost:8443/kladdis",
            "certificate-authority-data": "xxx"
        },
        "skippy": {
            "server": "https://localhost:8443/skippy",
            "certificate-authority-data": "xxx"
        },
        "woho": {
            "server": "https://localhost:8443/woho",
            "certificate-authority-data": "xxx"
        }
    },
    "users": {
        "mk-user": {
            "token": "ey..." 
        }
    },
    "contexts": {
        "kladdis": {
            "cluster": "kladdis",
            "user": "mk-user"
        },
        "skippy": {
            "cluster": "skippy",
            "user": "mk-user"
        },
        "woho": {
            "cluster": "woho",
            "user": "mk-user"
        }
    }
}

This would have enough information for an web-frontend to display an kube/.config file that the user can download.

If the user already has an existing config file the web ui can display the commands needed to add the cluster to the configuration. Eg.

To connect to the cluster, run the following commands [copy to clipboard]

kubectl config set clusters.skippy.server https://localhost:8443/skippy
kubectl config set clusters.skippy.certificate-authority-data LS0tL...S0tLS0K
kubectl config set contexts.skippy.cluster skippy
kubectl config set contexts.skippy.user mk-user
kubectl config use-context skippy

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions