DopplerHQ / cli

The official CLI for interacting with your Doppler secrets and configuration.
https://docs.doppler.com
Apache License 2.0
214 stars 43 forks source link

[FEATURE] Special Handling for KUBECONFIG #319

Closed rawkode closed 1 year ago

rawkode commented 1 year ago

Is your feature request related to a problem? Please describe.

kubectl can only be configured by setting KUBECONFIG to a file path and having the file contain the configuration.

Describe the solution you'd like

When KUBECONFIG exists within a config and we use doppler run, the contents should be mounted and KUBECONFIG env should point to the mounted location

Describe alternatives you've considered

Nothing is really good, we need to write the file to a location ourselves - but Doppler can already do some nice mounting stuff

Additional context

N/A

Piccirello commented 1 year ago

Just to make sure I understand, you'd want to mount the contents of an individual secret (in this case KUBECONFIG) to its own file. Is that right?

rawkode commented 1 year ago

Yeah. In Doppler there’d be a secret called KUBECONFIG and when I do Doppler run, I’d want /magic/fs/kubeconfig to be a file with the KUBECONFIG contents and the environment variables KUBECONFIG to be set to the path of said file

ryan-blunden commented 1 year ago

Hi @rawkode,

Here is how you could achieve this today using a mounted secrets file.

Create the template to render the contents of the Kube config file:

# kube-config.tmpl

{{.KUBE_CONFIG}}

Then run:

KUBECONFIG=./kube-config  doppler run --mount kube-config --mount-template ./kube-config.tmpl -- kubectl get secrets