documentation updates and tweaking workflows with env vars. It now throws errors if they're not set
This commit is contained in:
parent
373e750642
commit
bc8bbf8e01
19
README.md
19
README.md
|
|
@ -29,6 +29,9 @@ charts:
|
|||
set: # values (--set)
|
||||
- name: address
|
||||
value: https://vault.example.com
|
||||
env: # values (--set) but value will be pulled from environment variables. Will throw an error if the environment variable is not set.
|
||||
- name: db.password
|
||||
value: DB_PASSWORD # $DB_PASSOWRD needs to be set in the calling environment ex: export DB_PASSWORD='password1'
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -41,24 +44,24 @@ charts:
|
|||
|
||||
```
|
||||
NAME:
|
||||
helmfile
|
||||
helmfile -
|
||||
|
||||
USAGE:
|
||||
helmfile [global options] command [command options] [arguments...]
|
||||
main [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
0.0.0
|
||||
0.1.0
|
||||
|
||||
COMMANDS:
|
||||
repos sync repositories from state file (helm repo add && help repo update)
|
||||
charts sync charts from state file (helm repo upgrade --install)
|
||||
sync sync all resources from state file (repos && charts)
|
||||
delete delete charts from state file (helm delete)
|
||||
help, h Shows a list of commands or help for one command
|
||||
repos sync repositories from state file (helm repo add && helm repo update)
|
||||
charts sync charts from state file (helm repo upgrade --install)
|
||||
sync sync all resources from state file (repos && charts)
|
||||
delete delete charts from state file (helm delete)
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
--file FILE, -f FILE load config from FILE (default: "charts.yaml")
|
||||
--quiet, -q silence output
|
||||
--kube-context value Set kubectl context. Uses current context by default
|
||||
--help, -h show help
|
||||
--version, -v print the version
|
||||
```
|
||||
|
|
|
|||
3
main.go
3
main.go
|
|
@ -21,6 +21,7 @@ func main() {
|
|||
app := cli.NewApp()
|
||||
app.Name = "helmfile"
|
||||
app.Usage = ""
|
||||
app.Version = "0.1.0"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "file, f",
|
||||
|
|
@ -33,7 +34,7 @@ func main() {
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "kube-context",
|
||||
Usage: "Set kubectl context",
|
||||
Usage: "Set kubectl context. Uses current context by default",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"errors"
|
||||
|
||||
"github.com/roboll/helmfile/helmexec"
|
||||
|
||||
|
|
@ -164,7 +165,12 @@ func flagsForChart(chart *ChartSpec) ([]string, error) {
|
|||
if len(chart.EnvValues) > 0 {
|
||||
val := []string{}
|
||||
for _, set := range chart.EnvValues {
|
||||
val = append(val, fmt.Sprintf("%s=%s", set.Name, os.Getenv(set.Value)))
|
||||
value, isSet := os.LookupEnv(set.Value)
|
||||
if isSet {
|
||||
val = append(val, fmt.Sprintf("%s=%s", set.Name, value))
|
||||
} else {
|
||||
return nil, errors.New(fmt.Sprintf("Unset env var: %s", set.Name))
|
||||
}
|
||||
}
|
||||
flags = append(flags, "--set", strings.Join(val, ","))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue