mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Fix error during expansion of !!merge <<: anchor tags (#4383)
* WIP * Fix merge corner cases * Add test for explicit !!merge tag * Fix tests * Cleanup * Cleanup * Fix deanchoring lists * Add test case for keeping comments * Add MapEntrySetter and fix json marshalling after deanchoring * Keep duplicated keys * Move MergeTag definition to yaml alias * Remove go-spew from api * Add support for sequence nodes on merge tags * Add docstring to MapEntrySetter.Key * Add docstring to MapEntrySetter struct * Add tests to MapEntrySetter * Fix duplicate merge key * Revert whitespace changes on forked go-yaml * Remove AssocMapEntry function * Refactoring merge order * Return errors on VisitFields and PipeE * Add tests for each non-conforming map merges
This commit is contained in:
@@ -743,7 +743,7 @@ items:
|
||||
`},
|
||||
},
|
||||
},
|
||||
"listWithAnchors": {
|
||||
"mergeAnchors": {
|
||||
input: []byte(`
|
||||
apiVersion: v1
|
||||
kind: DeploymentList
|
||||
@@ -764,7 +764,59 @@ items:
|
||||
metadata:
|
||||
name: deployment-b
|
||||
spec:
|
||||
*hostAliases
|
||||
<<: *hostAliases
|
||||
`),
|
||||
exp: expected{
|
||||
sOut: []string{`
|
||||
apiVersion: v1
|
||||
kind: DeploymentList
|
||||
items:
|
||||
- apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: deployment-a
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- a.example.com
|
||||
ip: 8.8.8.8
|
||||
- apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: deployment-b
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- a.example.com
|
||||
ip: 8.8.8.8
|
||||
`},
|
||||
},
|
||||
},
|
||||
"listWithAnchors": {
|
||||
input: []byte(`
|
||||
apiVersion: v1
|
||||
kind: DeploymentList
|
||||
items:
|
||||
- apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: deployment-a
|
||||
spec: &hostAliases
|
||||
template:
|
||||
spec:
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- a.example.com
|
||||
ip: 8.8.8.8
|
||||
- apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: deployment-b
|
||||
spec: *hostAliases
|
||||
`),
|
||||
exp: expected{
|
||||
sOut: []string{`
|
||||
|
||||
Reference in New Issue
Block a user