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