add helm compatibility option
This commit is contained in:
parent
207aad94a0
commit
9d1f97258a
@ -14,6 +14,8 @@ Usage of ./spry:
|
||||
Output delimiter between template files rendered (default "---")
|
||||
-f value
|
||||
Specify a values file (JSON or YAML)
|
||||
-helm
|
||||
Whether to nest provided values under .Values
|
||||
-set value
|
||||
Set a specific value (foo.bar=spam)
|
||||
```
|
||||
|
11
main.go
11
main.go
@ -77,6 +77,7 @@ var flags struct {
|
||||
valuesFiles valFileSlice
|
||||
values valSlice
|
||||
outputDelimiter string
|
||||
helmCompat bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -87,6 +88,7 @@ func init() {
|
||||
"d", "---",
|
||||
"Output delimiter between template files rendered",
|
||||
)
|
||||
flag.BoolVar(&flags.helmCompat, "helm", false, "Whether to nest provided values under .Values")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@ -164,8 +166,13 @@ func expandFiles(files []string) (expFiles []string) {
|
||||
return
|
||||
}
|
||||
|
||||
func mergeValues() (result map[string]interface{}) {
|
||||
result = map[string]interface{}{}
|
||||
func mergeValues() (res map[string]interface{}) {
|
||||
res = map[string]interface{}{}
|
||||
result := res
|
||||
if flags.helmCompat {
|
||||
res["Values"] = map[string]interface{}{}
|
||||
result = res["Values"].(map[string]interface{})
|
||||
}
|
||||
for _, vf := range flags.valuesFiles {
|
||||
vfContent, err := os.ReadFile(vf)
|
||||
checkErr(err)
|
||||
|
Loading…
Reference in New Issue
Block a user