Merge pull request #139 from int128/inline-values
Inline values support
This commit is contained in:
commit
fb781be560
12
README.md
12
README.md
|
|
@ -45,7 +45,11 @@ releases:
|
|||
foo: bar
|
||||
chart: roboll/vault-secret-manager # the chart being installed to create this release, referenced by `repository/chart` syntax
|
||||
version: ~1.24.1 # the semver of the chart. range constraint is supported
|
||||
values: [ vault.yaml ] # value files (--values)
|
||||
values:
|
||||
- vault.yaml # value files (--values)
|
||||
- db: # inline values. Passed via a temporary values file (--values)
|
||||
username: {{ requiredEnv "DB_USERNAME" }}
|
||||
password: {{ requiredEnv "DB_PASSWORD" }}
|
||||
secrets:
|
||||
- vault_secret.yaml # will attempt to decrypt it using helm-secrets plugin
|
||||
set: # values (--set)
|
||||
|
|
@ -78,7 +82,7 @@ If the environment variable is unset or empty, the template rendering will fail
|
|||
|
||||
## Using environment variables
|
||||
|
||||
Environment variables can be used in most places for templating the helmfile. Currently this is supported for `name`, `namespace`, `value` (in set) and `url` (in repositories).
|
||||
Environment variables can be used in most places for templating the helmfile. Currently this is supported for `name`, `namespace`, `value` (in set), `values` and `url` (in repositories).
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -93,6 +97,10 @@ releases:
|
|||
- name: {{ requiredEnv "NAME" }}-vault
|
||||
namespace: {{ requiredEnv "NAME" }}
|
||||
chart: roboll/vault-secret-manager
|
||||
values:
|
||||
- db:
|
||||
username: {{ requiredEnv "DB_USERNAME" }}
|
||||
password: {{ requiredEnv "DB_PASSWORD" }}
|
||||
set:
|
||||
- name: proxy.domain
|
||||
value: {{ requiredEnv "PLATFORM_ID" }}.my-domain.com
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ type ReleaseSpec struct {
|
|||
Name string `yaml:"name"`
|
||||
Namespace string `yaml:"namespace"`
|
||||
Labels map[string]string `yaml:"labels"`
|
||||
Values []string `yaml:"values"`
|
||||
Values []interface{} `yaml:"values"`
|
||||
Secrets []string `yaml:"secrets"`
|
||||
SetValues []SetValue `yaml:"set"`
|
||||
|
||||
|
|
@ -479,12 +479,28 @@ func flagsForRelease(helm helmexec.Interface, basePath string, release *ReleaseS
|
|||
flags = append(flags, "--namespace", release.Namespace)
|
||||
}
|
||||
for _, value := range release.Values {
|
||||
path := filepath.Join(basePath, value)
|
||||
switch typedValue := value.(type) {
|
||||
case string:
|
||||
path := filepath.Join(basePath, typedValue)
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
flags = append(flags, "--values", path)
|
||||
|
||||
case map[interface{}]interface{}:
|
||||
valfile, err := ioutil.TempFile("", "values")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer valfile.Close()
|
||||
encoder := yaml.NewEncoder(valfile)
|
||||
defer encoder.Close()
|
||||
if err := encoder.Encode(typedValue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
release.generatedValues = append(release.generatedValues, valfile.Name())
|
||||
flags = append(flags, "--values", valfile.Name())
|
||||
}
|
||||
}
|
||||
for _, value := range release.Secrets {
|
||||
path := filepath.Join(basePath, value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue