File tree Expand file tree Collapse file tree 3 files changed +86
-2
lines changed
addons/adminconsole/static Expand file tree Collapse file tree 3 files changed +86
-2
lines changed Original file line number Diff line number Diff line change 7
7
{{- end }}
8
8
isHA : false
9
9
isHelmManaged : false
10
- isEC2Install : true
11
10
kurlProxy :
12
11
enabled : true
13
12
nodePort : 30000
Original file line number Diff line number Diff line change @@ -545,6 +545,10 @@ func cleanUpMapValue(v interface{}) interface{} {
545
545
switch v := v .(type ) {
546
546
case []interface {}:
547
547
return cleanUpInterfaceArray (v )
548
+ case []map [string ]interface {}:
549
+ return cleanUpGenericMapArray (v )
550
+ case []map [interface {}]interface {}:
551
+ return cleanUpInterfaceMapArray (v )
548
552
case map [string ]interface {}:
549
553
return cleanUpGenericMap (v )
550
554
case map [interface {}]interface {}:
@@ -571,6 +575,24 @@ func cleanUpInterfaceArray(in []interface{}) []interface{} {
571
575
return result
572
576
}
573
577
578
+ // Cleans up a slice of map to interface into slice of actual values
579
+ func cleanUpGenericMapArray (in []map [string ]interface {}) []map [string ]interface {} {
580
+ result := make ([]map [string ]interface {}, len (in ))
581
+ for i , v := range in {
582
+ result [i ] = cleanUpGenericMap (v )
583
+ }
584
+ return result
585
+ }
586
+
587
+ // Cleans up a slice of map to interface into slice of actual values
588
+ func cleanUpInterfaceMapArray (in []map [interface {}]interface {}) []map [string ]interface {} {
589
+ result := make ([]map [string ]interface {}, len (in ))
590
+ for i , v := range in {
591
+ result [i ] = cleanUpInterfaceMap (v )
592
+ }
593
+ return result
594
+ }
595
+
574
596
// Cleans up the map keys to be strings
575
597
func cleanUpInterfaceMap (in map [interface {}]interface {}) map [string ]interface {} {
576
598
result := make (map [string ]interface {})
Original file line number Diff line number Diff line change 1
1
package helm
2
2
3
3
import (
4
- "github.com/stretchr/testify/require"
5
4
"testing"
5
+
6
+ "github.com/stretchr/testify/require"
6
7
)
7
8
8
9
func Test_cleanUpGenericMap (t * testing.T ) {
@@ -82,6 +83,68 @@ func Test_cleanUpGenericMap(t *testing.T) {
82
83
},
83
84
},
84
85
},
86
+ {
87
+ name : "nested map, generic map array keys" ,
88
+ in : map [string ]interface {}{
89
+ "nest" : map [interface {}]interface {}{
90
+ "abc" : "xyz" ,
91
+ "number" : 5 ,
92
+ "float" : 1.5 ,
93
+ "bool" : true ,
94
+ "array" : []map [string ]interface {}{
95
+ {
96
+ "name" : "example" ,
97
+ "value" : "true" ,
98
+ },
99
+ },
100
+ },
101
+ },
102
+ want : map [string ]interface {}{
103
+ "nest" : map [string ]interface {}{
104
+ "abc" : "xyz" ,
105
+ "number" : 5 ,
106
+ "float" : 1.5 ,
107
+ "bool" : true ,
108
+ "array" : []map [string ]interface {}{
109
+ {
110
+ "name" : "example" ,
111
+ "value" : "true" ,
112
+ },
113
+ },
114
+ },
115
+ },
116
+ },
117
+ {
118
+ name : "nested map, interface map array keys" ,
119
+ in : map [string ]interface {}{
120
+ "nest" : map [interface {}]interface {}{
121
+ "abc" : "xyz" ,
122
+ "number" : 5 ,
123
+ "float" : 1.5 ,
124
+ "bool" : true ,
125
+ "array" : []map [interface {}]interface {}{
126
+ {
127
+ "name" : "example" ,
128
+ "value" : "true" ,
129
+ },
130
+ },
131
+ },
132
+ },
133
+ want : map [string ]interface {}{
134
+ "nest" : map [string ]interface {}{
135
+ "abc" : "xyz" ,
136
+ "number" : 5 ,
137
+ "float" : 1.5 ,
138
+ "bool" : true ,
139
+ "array" : []map [string ]interface {}{
140
+ {
141
+ "name" : "example" ,
142
+ "value" : "true" ,
143
+ },
144
+ },
145
+ },
146
+ },
147
+ },
85
148
}
86
149
for _ , tt := range tests {
87
150
t .Run (tt .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments