Add cluster name environment variable

- Add an environment variable to configure cluster name
- Expose envionrment variable in CLI documentation
This commit is contained in:
Kyle Rockman 2018-03-02 13:37:56 -06:00
parent db01b6a01f
commit 3b9384a23c
1 changed files with 3 additions and 2 deletions

View File

@ -126,9 +126,10 @@ func NewCmdRoot(f *util.Factory, out io.Writer) *cobra.Command {
if strings.HasSuffix(defaultStateStore, "/") {
defaultStateStore = strings.TrimSuffix(defaultStateStore, "/")
}
cmd.PersistentFlags().StringVarP(&rootCommand.RegistryPath, "state", "", defaultStateStore, "Location of state storage")
cmd.PersistentFlags().StringVarP(&rootCommand.RegistryPath, "state", "", defaultStateStore, "Location of state storage. Overrides $KOPS_STATE_STORE")
cmd.PersistentFlags().StringVarP(&rootCommand.clusterName, "name", "", "", "Name of cluster")
defaultClusterName := os.Getenv("KOPS_CLUSTER_NAME")
cmd.PersistentFlags().StringVarP(&rootCommand.clusterName, "name", "", defaultClusterName, "Name of cluster. Overrides $KOPS_CLUSTER_NAME")
// create subcommands
cmd.AddCommand(NewCmdCompletion(f, out))