Skip to content

Commit 9111a62

Browse files
authored
Merge pull request #91 from weaveworks/config-secrets-to-strings
Config secrets to strings.
2 parents 99f32ce + 1434fc6 commit 9111a62

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
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
},

tests/e2e/gitopsset_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ func TestReconcilingUpdatingSecret(t *testing.T) {
569569
Content: runtime.RawExtension{
570570
Raw: mustMarshalJSON(t, test.NewConfigMap(func(c *corev1.ConfigMap) {
571571
c.Data = map[string]string{
572-
"testing": "{{ .Element.testKey | toString }}",
572+
"testing": "{{ .Element.testKey }}",
573573
}
574574
})),
575575
},
@@ -637,7 +637,7 @@ func TestReconcilingUpdatingSecret_in_matrix(t *testing.T) {
637637
Content: runtime.RawExtension{
638638
Raw: mustMarshalJSON(t, test.NewConfigMap(func(c *corev1.ConfigMap) {
639639
c.Data = map[string]string{
640-
"testing": "{{ .Element.testKey | toString }}",
640+
"testing": "{{ .Element.testKey }}",
641641
"team": "{{ .Element.team }}",
642642
}
643643
})),

0 commit comments

Comments
 (0)