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

[FEATURE] Allow changing the cluster name using environment variables #1281

Open
sagikazarmark opened this issue May 15, 2023 · 4 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@sagikazarmark
Copy link

Is your feature request related to a problem or a Pull Request

N/A

Scope of your request

I need a new environment variable for the cluster command.

Describe the solution you'd like

Coming from KinD, I really like that the default cluster name can be changed using an environment variable (KIND_CLUSTER_NAME), not just a flag.

The rationale behind this feature is that even when developers couldn't care less to specify a custom name, it can still be controlled through an environment variable (loaded with direnv for example).

Describe alternatives you've considered

A potential alternative is automatically loading a config file when it's present (or set using an environment variable).

As long as a project default setting (eg. through env vars using direnv) can be applied and the user doesn't need anything, but k3d cluster create, it's a viable solution.

Admittedly, this is a convenience feature.

@sagikazarmark sagikazarmark added the enhancement New feature or request label May 15, 2023
@tesla59
Copy link
Contributor

tesla59 commented May 20, 2023

I would like to work on this enhancement. Can i provide a little more example on how KinD works and how does it inspires your idea

@sagikazarmark
Copy link
Author

From what I can tell, KinD merges the configuration (config file, environment, flag) and determines the final name based on that.

I'm guessing some similar solution should work in this case as well.

As for the implementation: it really depends on how k3d configuration is implemented which I'm not really familiar with. I'd have to delve into the code to figure that out.

@tesla59
Copy link
Contributor

tesla59 commented May 22, 2023

can u show a KinD example how will u use it with what commands?

@iwilltry42
Copy link
Member

We're using cobra for CLI and viper for general config. Both have options to configure loading env vars.
Inside config files, we're already replacing generic environment variables.

@tesla59 thanks for chiming in and taking over, looking forward to your PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants