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 77{{- end }}
88isHA : false
99isHelmManaged : false
10- isEC2Install : true
1110kurlProxy :
1211 enabled : true
1312 nodePort : 30000
Original file line number Diff line number Diff line change @@ -545,6 +545,10 @@ func cleanUpMapValue(v interface{}) interface{} {
545545 switch v := v .(type ) {
546546 case []interface {}:
547547 return cleanUpInterfaceArray (v )
548+ case []map [string ]interface {}:
549+ return cleanUpGenericMapArray (v )
550+ case []map [interface {}]interface {}:
551+ return cleanUpInterfaceMapArray (v )
548552 case map [string ]interface {}:
549553 return cleanUpGenericMap (v )
550554 case map [interface {}]interface {}:
@@ -571,6 +575,24 @@ func cleanUpInterfaceArray(in []interface{}) []interface{} {
571575 return result
572576}
573577
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+
574596// Cleans up the map keys to be strings
575597func cleanUpInterfaceMap (in map [interface {}]interface {}) map [string ]interface {} {
576598 result := make (map [string ]interface {})
Original file line number Diff line number Diff line change 11package helm
22
33import (
4- "github.com/stretchr/testify/require"
54 "testing"
5+
6+ "github.com/stretchr/testify/require"
67)
78
89func Test_cleanUpGenericMap (t * testing.T ) {
@@ -82,6 +83,68 @@ func Test_cleanUpGenericMap(t *testing.T) {
8283 },
8384 },
8485 },
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+ },
85148 }
86149 for _ , tt := range tests {
87150 t .Run (tt .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments