mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
merge2: preserve explicitly set null values
Fixed bug where an explicitly set null value in yaml was cleared, even when the patch did not operate on that field.
This commit is contained in:
@@ -143,6 +143,66 @@ kind: Deployment
|
||||
},
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case
|
||||
//
|
||||
{description: `remove scalar -- null in src, empty in dest`,
|
||||
source: `
|
||||
kind: Deployment
|
||||
field: null
|
||||
`,
|
||||
dest: `
|
||||
kind: Deployment
|
||||
field:
|
||||
`,
|
||||
expected: `
|
||||
kind: Deployment
|
||||
`,
|
||||
mergeOptions: yaml.MergeOptions{
|
||||
ListIncreaseDirection: yaml.MergeOptionsListAppend,
|
||||
},
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case
|
||||
//
|
||||
{description: `remove scalar -- null in src, null in dest`,
|
||||
source: `
|
||||
kind: Deployment
|
||||
field: null
|
||||
`,
|
||||
dest: `
|
||||
kind: Deployment
|
||||
field: null
|
||||
`,
|
||||
expected: `
|
||||
kind: Deployment
|
||||
`,
|
||||
mergeOptions: yaml.MergeOptions{
|
||||
ListIncreaseDirection: yaml.MergeOptionsListAppend,
|
||||
},
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case
|
||||
//
|
||||
{description: `keep scalar -- missing in src, null in dest`,
|
||||
source: `
|
||||
kind: Deployment
|
||||
`,
|
||||
dest: `
|
||||
kind: Deployment
|
||||
field: null
|
||||
`,
|
||||
expected: `
|
||||
kind: Deployment
|
||||
field: null
|
||||
`,
|
||||
mergeOptions: yaml.MergeOptions{
|
||||
ListIncreaseDirection: yaml.MergeOptionsListAppend,
|
||||
},
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user