Commit 3372098
committed
fix: preserve original YAML formatting in resource output
Previously, Resource.AsYAML() used yaml.JSONToYAML which caused two issues:
1. Long lines were automatically wrapped at ~80 characters, breaking
shell commands and template strings (e.g., Helm-style {{ }})
2. Quote styles were inconsistently modified - sometimes removed,
sometimes added
This change switches to using kyaml's encoder (RNode.MustString) which
preserves the original YAML formatting, including:
- Long lines remain on a single line
- Quote styles ('single', "double", or unquoted) are preserved
This is a more consistent behavior that respects the user's original
YAML structure.
Related to:
- #947
- #39691 parent 008b7a0 commit 3372098
2 files changed
+15
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 12 | + | |
| 13 | + | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
| |||
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | | - | |
| 67 | + | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
73 | | - | |
| 71 | + | |
74 | 72 | | |
75 | | - | |
76 | | - | |
| 73 | + | |
77 | 74 | | |
78 | | - | |
79 | | - | |
| 75 | + | |
80 | 76 | | |
81 | 77 | | |
82 | | - | |
83 | | - | |
84 | 78 | | |
85 | 79 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
388 | 387 | | |
389 | 388 | | |
390 | | - | |
| 389 | + | |
391 | 390 | | |
392 | 391 | | |
393 | 392 | | |
| |||
0 commit comments