Skip to content

Commit 4229efd

Browse files
author
Simon Emms
committed
[installer]: escape inline yaml keys for labels/annotations
1 parent 5855038 commit 4229efd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

install/installer/pkg/helm/helm.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ func CustomizeAnnotation(registryValues []string, prefix string, ctx *common.Ren
218218
annotations := common.CustomizeAnnotation(ctx, component, typeMeta, existingAnnotations...)
219219
if len(annotations) > 0 {
220220
for k, v := range annotations {
221-
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, k), v))
221+
// Escape any dots in the keys so they're not expanded
222+
key := strings.Replace(k, ".", "\\.", -1)
223+
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, key), v))
222224
}
223225
}
224226

@@ -236,7 +238,9 @@ func CustomizeLabel(registryValues []string, prefix string, ctx *common.RenderCo
236238

237239
if len(labels) > 0 {
238240
for k, v := range labels {
239-
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, k), v))
241+
// Escape any dots in the keys so they're not expanded
242+
key := strings.Replace(k, ".", "\\.", -1)
243+
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, key), v))
240244
}
241245
}
242246

0 commit comments

Comments
 (0)