splunk / qbec

configure kubernetes objects on multiple clusters using jsonnet

Home Page:https://qbec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow env var in addition to --force command line flags

splkforrest opened this issue · comments

In certain situations, it may be slightly easier to manage the forcing of k8s contexts and namespaces via an env var rather than a command line flag. For example, in one of my deployment scripts where I use qbec, I also call two other scripts that use qbec. Rather than needing to pass the command line flags for each qbec call, it would be slightly easier to set an env var once in the root script. As an example, instead of:

qbec --force:k8s-context=foo --force:k8s-namespace=bar apply baz

do

export FORCE_K8S_CONTEXT=foo
export FORCE_K8S_NAMESPACE=bar
qbec apply baz

If a lot of the config has to be exposed via env vars, we might want to look at something like https://github.com/spf13/viper to make it possible to set env override for cmd options. It also supports a config file option but I think we'd probably want to disable that. The precedence order can be "inline > env > default"