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

Custom Store from CLI Command #90

Open
jose-fully-ported opened this issue Oct 24, 2023 · 1 comment
Open

Custom Store from CLI Command #90

jose-fully-ported opened this issue Oct 24, 2023 · 1 comment

Comments

@jose-fully-ported
Copy link

jose-fully-ported commented Oct 24, 2023

It would be cool to have a custom store based on a custom command. One could set the backend like so:

kind: SwitchConfig
version: "v1alpha1"
kubeconfigStores:
  - kind: custom
    id: id-only-required-if-there-are-more-than-one-store
    config:
      command: custom-command
      env:
        KEY: value

The config contains a command - the command to run - as well as an optional map of environment variables for the command context.

Under the hood, the command should implement a specific interface:

  • list: outputs a json object of all clusters. There is a clusters key that has a list of cluster objects, with a name that can be displayed in the ui and an id that is the internal cluster id.
    {
      "clusters": [
        {"name": "test": "id": "some-id"}
      ]
    }
  • kubeconfig: Takes anid and writes a kubeconfig to stdout.

With these two, we'd create a custom store that calls the list command in StartSearch, and then again when returning a kubeconfig in GetKubeconfigForPath.

The KubeConfig would then be written to a path like custom_${id}-${name-slug}.


I am not sure how expired KubeConfigs might work - is there some tracking for that? - but this would provide folks the ability to customize where their KubeConfig comes from in the case of custom tooling.

Is this something you'd be interested in taking a pull request for?

@danielfoehrKn
Copy link
Owner

danielfoehrKn commented Nov 29, 2023

Hi, sorry for the delay. Yes, I would very much be interested in taking a pull request for that.

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

No branches or pull requests

2 participants