diff --git a/internal/config/unit.go b/internal/config/unit.go index d702f60..e7cf3db 100644 --- a/internal/config/unit.go +++ b/internal/config/unit.go @@ -58,11 +58,12 @@ func (u *Unit) UnmarshalYAML(value *yaml.Node) error { if err := yaml.Unmarshal(defaults, &m); err != nil { return errors.Wrap(err, "failed to unmarshal defaults") } - if err := mergo.Merge(&u.Values, m); err != nil { + if err := mergo.Merge(&m, u.Values, mergo.WithAppendSlice, mergo.WithOverride, mergo.WithSliceDeepCopy); err != nil { return err } u.Extends = "" + u.Values = m } return nil } diff --git a/testdata/extends/snapshop-config-norender.yaml b/testdata/extends/snapshop-config-norender.yaml index 2028f43..eb99ca9 100644 --- a/testdata/extends/snapshop-config-norender.yaml +++ b/testdata/extends/snapshop-config-norender.yaml @@ -14,6 +14,9 @@ squadron: image: repository: nginx tag: latest + null_obj: null + null_tags: null tags: - ONE - TWO + - THREE diff --git a/testdata/extends/snapshop-config.yaml b/testdata/extends/snapshop-config.yaml index da64fe9..8282ad3 100644 --- a/testdata/extends/snapshop-config.yaml +++ b/testdata/extends/snapshop-config.yaml @@ -14,6 +14,9 @@ squadron: image: repository: nginx tag: latest + null_obj: null + null_tags: null tags: - ONE - TWO + - THREE diff --git a/testdata/extends/squadron.base.yaml b/testdata/extends/squadron.base.yaml index 506492c..56ef48c 100644 --- a/testdata/extends/squadron.base.yaml +++ b/testdata/extends/squadron.base.yaml @@ -5,4 +5,10 @@ env: ONE: unknown THREE: baz tags: - - unknown + - ONE + - TWO +null_tags: + - TWO +null_obj: + ONE: unknown + THREE: baz diff --git a/testdata/extends/squadron.yaml b/testdata/extends/squadron.yaml index aee7f8a..56c66f4 100644 --- a/testdata/extends/squadron.yaml +++ b/testdata/extends/squadron.yaml @@ -12,5 +12,6 @@ squadron: ONE: foo TWO: bar tags: - - ONE - - TWO + - THREE + null_obj: ~ + null_tags: ~