mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
fix error message
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"errors"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/internal/utils"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
@@ -117,6 +119,14 @@ func applyToNode(node *yaml.RNode, value *yaml.RNode, target *types.TargetSelect
|
||||
var t *yaml.RNode
|
||||
var err error
|
||||
if target.Options != nil && target.Options.Create {
|
||||
// create option is not supported in a wildcard matching.
|
||||
// Because, PathMatcher is not supported create option.
|
||||
// So, if create option is set, we fallback to PathGetter.
|
||||
for _, f := range fieldPath {
|
||||
if f == "*" {
|
||||
return errors.New("cannot support create option in a multi-value target")
|
||||
}
|
||||
}
|
||||
t, err = node.Pipe(yaml.LookupCreate(value.YNode().Kind, fieldPath...))
|
||||
} else {
|
||||
t, err = node.Pipe(&yaml.PathMatcher{Path: fieldPath})
|
||||
|
||||
@@ -1671,7 +1671,7 @@ spec:
|
||||
options:
|
||||
create: true
|
||||
`,
|
||||
expectedErr: "cannot support create option in a multi-value target now",
|
||||
expectedErr: "cannot support create option in a multi-value target",
|
||||
},
|
||||
"multiple field paths in target": {
|
||||
input: `apiVersion: v1
|
||||
|
||||
Reference in New Issue
Block a user