k3d icon indicating copy to clipboard operation
k3d copied to clipboard

[FEATURE] Allow changing the cluster name using environment variables

Open tesla59 opened this issue 1 year ago • 5 comments

What

Adds new functionality to check for env variable for cluster name. The variable is named K3D_CLUSTER_NAME

Why

Closes https://github.com/k3d-io/k3d/issues/1281

Implications

The PR changes the default behavior of cluster commands including create, delete, start, stop. After this change, k3d will first look for env variable named K3D_CLUSTER_NAME and create cluster with the value provided by the variable. It should be noted that env variable has less preference than config file, so it only acts when neither of the config file or the command line provides cluster name

tesla59 avatar May 22 '23 14:05 tesla59

@iwilltry42 need your insight on following it can be seen that we are setting ppViper in clusterCreate.go and to follow current pattern, ive created separate Viper config variable in every cluterCreate, clusterDelete, clusterStart and clusterStop command files. I think we can merge all ppViper variable into single variable

tesla59 avatar May 22 '23 14:05 tesla59

Hey @tesla59, thanks for putting up this PR! I feel like that may be a little over-engineered though :thinking: Why not just use k3d cluster create $CLUSTER_NAME right away or use $CLUSTER_NAME inside the config file?

iwilltry42 avatar Aug 03 '23 18:08 iwilltry42

Hi @iwilltry42 . I have kept this way keeping in mind that we might add more options in the future. Can i get your suggestion on the alternative u mentioned?

tesla59 avatar Aug 10 '23 14:08 tesla59

Hey @iwilltry42 . I would like to revisit this PR on the points u mentioned. Can u kindly elaborate please?

tesla59 avatar Dec 30 '23 21:12 tesla59

@tesla59 sorry I never got back to this! I wonder what's the big benefit of creating those extra options in Viper as compared to what I mentioned here: https://github.com/k3d-io/k3d/pull/1294#issuecomment-1664409683 ?

iwilltry42 avatar Jan 03 '24 16:01 iwilltry42

Closing due to inactivity. Feel free to reopen if still applicable.

iwilltry42 avatar Jul 04 '24 09:07 iwilltry42