Skip to content

Commit 1434fc6

Browse files
committed
Convert Secret data values to strings
This converts all values in a Secret data element to strings when generating.
1 parent 3f672aa commit 1434fc6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

controllers/templates/generators/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ func secretToParams(ctx context.Context, k8sClient client.Client, key client.Obj
9292
return mapToAnyMap(secret.Data), nil
9393
}
9494

95-
func mapToAnyMap[V any](m map[string]V) map[string]any {
95+
func mapToAnyMap[V string | []byte](m map[string]V) map[string]any {
9696
result := map[string]any{}
9797

9898
for k, v := range m {
99-
result[k] = v
99+
result[k] = string(v)
100100
}
101101

102102
return result

controllers/templates/generators/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ func TestConfigGenerator_Generate(t *testing.T) {
152152
},
153153
want: []map[string]any{
154154
{
155-
"test-key1": []byte("test-value1"),
156-
"test-key2": []byte("test-value2"),
155+
"test-key1": "test-value1",
156+
"test-key2": "test-value2",
157157
},
158158
},
159159
},

0 commit comments

Comments
 (0)