mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
feat: annotation to disable list conversion
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
@@ -189,6 +190,16 @@ func (rf *Factory) inlineAnyEmbeddedLists(
|
||||
var n0 *yaml.RNode
|
||||
for len(nodes) > 0 {
|
||||
n0, nodes = nodes[0], nodes[1:]
|
||||
annotations := n0.GetAnnotations()
|
||||
convertToInlineList, err := strconv.ParseBool(annotations["kustomize.config.k8s.io/convertToInlineList"])
|
||||
if err != nil {
|
||||
convertToInlineList = true
|
||||
}
|
||||
if !convertToInlineList {
|
||||
// if the annotation is set to true, then we should not convert the list to inline
|
||||
result = append(result, n0)
|
||||
continue
|
||||
}
|
||||
kind := n0.GetKind()
|
||||
if !strings.HasSuffix(kind, "List") {
|
||||
result = append(result, n0)
|
||||
|
||||
Reference in New Issue
Block a user