File tree Expand file tree Collapse file tree 3 files changed +4
-82
lines changed Expand file tree Collapse file tree 3 files changed +4
-82
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ package generators
5
5
6
6
import (
7
7
"fmt"
8
- "strings"
9
8
10
9
"github.com/go-errors/errors"
11
10
"sigs.k8s.io/kustomize/api/ifc"
@@ -51,11 +50,7 @@ func makeValidatedDataMap(
51
50
return nil , errors .Errorf (
52
51
"configmap %s illegally repeats the key `%s`" , name , p .Key )
53
52
}
54
- lines := strings .Split (p .Value , "\n " )
55
- for i := range lines {
56
- lines [i ] = strings .TrimSuffix (lines [i ], " " )
57
- }
58
- knownKeys [p .Key ] = strings .Join (lines , "\n " )
53
+ knownKeys [p .Key ] = p .Value
59
54
}
60
55
return knownKeys , nil
61
56
}
Original file line number Diff line number Diff line change @@ -292,10 +292,8 @@ metadata:
292
292
---
293
293
apiVersion: v1
294
294
data:
295
- nonsense: |
296
- Lorem ipsum dolor sit amet, consectetur
297
- adipiscing elit, sed do eiusmod tempor
298
- incididunt ut labore et dolore magna aliqua.
295
+ nonsense: "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit, sed do eiusmod
296
+ tempor\nincididunt ut labore et dolore magna aliqua. \n"
299
297
kind: ConfigMap
300
298
metadata:
301
299
annotations:
@@ -304,6 +302,6 @@ metadata:
304
302
app: mungebot
305
303
org: kubernetes
306
304
repo: test-infra
307
- name: test-infra-app-config-4thktg822m
305
+ name: test-infra-app-config-49d6f5h7b5
308
306
` )
309
307
}
Original file line number Diff line number Diff line change @@ -572,74 +572,3 @@ metadata:
572
572
name: test-k9cc55dfm5
573
573
` )
574
574
}
575
-
576
- // regression test for https://github.com/kubernetes-sigs/kustomize/issues/4287
577
- func TestMultilineDataEndsWithSpace (t * testing.T ) {
578
- th := kusttest_test .MakeHarness (t )
579
- th .WriteK ("." , `
580
- apiVersion: kustomize.config.k8s.io/v1beta1
581
- kind: Kustomization
582
- configMapGenerator:
583
- - name: config_bla
584
- files:
585
- - cfg.text=cfg.text
586
- ` )
587
- th .WriteF ("cfg.text" , `bla
588
- bla
589
- bla
590
- ` )
591
-
592
- m := th .Run ("." , th .MakeDefaultOptions ())
593
- th .AssertActualEqualsExpected (
594
- m , `apiVersion: v1
595
- data:
596
- cfg.text: |
597
- bla
598
- bla
599
- bla
600
- kind: ConfigMap
601
- metadata:
602
- name: config_bla-4k548khbf5
603
- ` )
604
- }
605
-
606
- // regression test to record the behavior prior to the fix for https://github.com/kubernetes-sigs/kustomize/issues/4287
607
- // to ensure that the fix does not affect leading and trailing newlines in ConfigMap data
608
- func TestMultilineDataEndsLeadingAndTrailingNewlines (t * testing.T ) {
609
- th := kusttest_test .MakeHarness (t )
610
- th .WriteK ("." , `
611
- apiVersion: kustomize.config.k8s.io/v1beta1
612
- kind: Kustomization
613
- configMapGenerator:
614
- - name: config_bla
615
- files:
616
- - cfg.text=cfg.text
617
- ` )
618
- th .WriteF ("cfg.text" , `
619
-
620
- bla
621
- bla
622
- bla
623
-
624
-
625
-
626
- ` )
627
-
628
- m := th .Run ("." , th .MakeDefaultOptions ())
629
- th .AssertActualEqualsExpected (
630
- m , `apiVersion: v1
631
- data:
632
- cfg.text: |2+
633
-
634
-
635
- bla
636
- bla
637
- bla
638
-
639
-
640
-
641
- kind: ConfigMap
642
- metadata:
643
- name: config_bla-8dm6c68g22
644
- ` )
645
- }
You can’t perform that action at this time.
0 commit comments