mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Merge pull request #3445 from KnVerey/resource_list_empty_items
[kio] Unwrap ResourceList with a functionConfig but no items
This commit is contained in:
@@ -178,7 +178,7 @@ func (r *ByteReader) Read() ([]*yaml.RNode, error) {
|
|||||||
if !r.DisableUnwrapping &&
|
if !r.DisableUnwrapping &&
|
||||||
len(values) == 1 && // Only unwrap if there is only 1 value
|
len(values) == 1 && // Only unwrap if there is only 1 value
|
||||||
(meta.Kind == ResourceListKind || meta.Kind == "List") &&
|
(meta.Kind == ResourceListKind || meta.Kind == "List") &&
|
||||||
node.Field("items") != nil {
|
(node.Field("items") != nil || node.Field("functionConfig") != nil) {
|
||||||
r.WrappingKind = meta.Kind
|
r.WrappingKind = meta.Kind
|
||||||
r.WrappingAPIVersion = meta.APIVersion
|
r.WrappingAPIVersion = meta.APIVersion
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,29 @@ spec:
|
|||||||
elems:
|
elems:
|
||||||
- a
|
- a
|
||||||
- b
|
- b
|
||||||
|
- c`,
|
||||||
|
wrappingAPIVersion: ResourceListAPIVersion,
|
||||||
|
wrappingAPIKind: ResourceListKind,
|
||||||
|
},
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
{
|
||||||
|
name: "wrapped_resource_list_function_config_without_items",
|
||||||
|
input: `apiVersion: config.kubernetes.io/v1alpha1
|
||||||
|
kind: ResourceList
|
||||||
|
functionConfig:
|
||||||
|
foo: bar
|
||||||
|
elems:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
`,
|
||||||
|
expectedItems: []string{},
|
||||||
|
expectedFunctionConfig: `foo: bar
|
||||||
|
elems:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
- c`,
|
- c`,
|
||||||
wrappingAPIVersion: ResourceListAPIVersion,
|
wrappingAPIVersion: ResourceListAPIVersion,
|
||||||
wrappingAPIKind: ResourceListKind,
|
wrappingAPIKind: ResourceListKind,
|
||||||
|
|||||||
Reference in New Issue
Block a user