mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
fix: patch additions honor source key style
When a patch appends a new node, it should honor the key style from the patch. Prior to this commit, no style was applied, leading to problems when the key value could be interpreted as a different type based on its content. For example, "9110" needs quoting to ensure it is seen as a string in yaml.
This commit is contained in:
@@ -306,4 +306,61 @@ metadata:
|
||||
name: foo
|
||||
annotations: {}
|
||||
`},
|
||||
|
||||
//
|
||||
// Test Case
|
||||
//
|
||||
{
|
||||
description: `Verify key style behavior`,
|
||||
origin: `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: foo
|
||||
data:
|
||||
unchanged: origin
|
||||
unchanged-varying-key-style: origin
|
||||
deleted-in-update: origin
|
||||
deleted-in-local: origin
|
||||
`,
|
||||
update: `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: foo
|
||||
data:
|
||||
unchanged: origin
|
||||
'unchanged-varying-key-style': origin
|
||||
deleted-in-local: origin
|
||||
'added-in-update': 'update'
|
||||
'added-in-update-and-local-same-value': 'update-and-local'
|
||||
'added-in-update-and-local-diff-value': 'update'
|
||||
`,
|
||||
local: `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: foo
|
||||
data:
|
||||
unchanged: origin
|
||||
"unchanged-varying-key-style": origin
|
||||
deleted-in-update: origin
|
||||
"added-in-local": "local"
|
||||
"added-in-update-and-local-same-value": "update-and-local"
|
||||
"added-in-update-and-local-diff-value": "local"
|
||||
`,
|
||||
expected: `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: foo
|
||||
data:
|
||||
unchanged: origin
|
||||
"unchanged-varying-key-style": origin
|
||||
"added-in-local": "local"
|
||||
"added-in-update-and-local-same-value": "update-and-local"
|
||||
"added-in-update-and-local-diff-value": "update"
|
||||
'added-in-update': 'update'
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user