Skip to content

Commit ff25bcf

Browse files
nishytarttor
authored andcommitted
adding support for lists in configmap
1 parent 3325f46 commit ff25bcf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pkg/helmify/values.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package helmify
22

33
import (
44
"fmt"
5+
"strconv"
56
"strings"
67

78
"github.com/iancoleman/strcase"
@@ -32,6 +33,11 @@ func (v *Values) Add(value interface{}, name ...string) (string, error) {
3233
if isString {
3334
return "{{ .Values." + strings.Join(name, ".") + " | quote }}", nil
3435
}
36+
_, isSlice := value.([]interface{})
37+
if isSlice {
38+
spaces := strconv.Itoa(len(name) * 2)
39+
return "{{ toYaml .Values." + strings.Join(name, ".") + " | nindent " + spaces + " }}", nil
40+
}
3541
return "{{ .Values." + strings.Join(name, ".") + " }}", nil
3642
}
3743

pkg/processor/configmap/configmap.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ func parseConfig(config map[string]interface{}, values helmify.Values, path []st
170170
}
171171
config[k] = templated
172172
case []interface{}:
173-
logrus.Warn("configmap: arrays not supported")
173+
templated, err := values.Add(v, append(path, k)...)
174+
if err != nil {
175+
logrus.WithError(err).Error()
176+
continue
177+
}
178+
config[k] = templated
174179
case map[string]interface{}:
175180
if len(t) == 0 {
176181
templated, err := values.Add(v, append(path, k)...)

0 commit comments

Comments
 (0)