mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
fix kyaml issue where dropping Style created issues
dropping the node style creates a compatibility issue where quotes around "on" are dropped because yaml.v3 interprets it as a string. other yaml parsers interpret on as a bool value, and parse it as a bool rather than string. fix: retain the original style so it is kept as quoted. - fmt: don't drop the styles - merge2: keep the style when merging elements - setting a field: if changing the value of a scalar field, retain its style by default
This commit is contained in:
@@ -646,6 +646,25 @@ metadata:
|
||||
`, assertNoErrorString(t)(r0.String()))
|
||||
}
|
||||
|
||||
func TestUpdateAnnotation_Fn(t *testing.T) {
|
||||
// create metadata.annotations field
|
||||
r0 := assertNoError(t)(Parse(`apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
a.b.c: "h.i.j"
|
||||
`))
|
||||
|
||||
rn := assertNoError(t)(r0.Pipe(SetAnnotation("a.b.c", "d.e.f")))
|
||||
assert.Equal(t, "\"d.e.f\"\n", assertNoErrorString(t)(rn.String()))
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
a.b.c: "d.e.f"
|
||||
`, assertNoErrorString(t)(r0.String()))
|
||||
}
|
||||
|
||||
func TestRNode_GetMeta(t *testing.T) {
|
||||
s := `apiVersion: v1/apps
|
||||
kind: Deployment
|
||||
|
||||
Reference in New Issue
Block a user