mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
don't surface entire node content in error message
This commit is contained in:
@@ -6,6 +6,8 @@ package resid
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
|
||||
// ResId is an identifier of a k8s resource object.
|
||||
@@ -63,7 +65,7 @@ func FromString(s string) ResId {
|
||||
gvk := GvkFromString(values[0])
|
||||
|
||||
values = strings.Split(values[1], fieldSep)
|
||||
last := len(values)-1
|
||||
last := len(values) - 1
|
||||
|
||||
ns := values[last]
|
||||
if ns == noNamespace {
|
||||
@@ -80,6 +82,13 @@ func FromString(s string) ResId {
|
||||
}
|
||||
}
|
||||
|
||||
// FromRNode returns the ResId for the RNode
|
||||
func FromRNode(rn *yaml.RNode) ResId {
|
||||
group, version := ParseGroupVersion(rn.GetApiVersion())
|
||||
return NewResIdWithNamespace(
|
||||
Gvk{Group: group, Version: version, Kind: rn.GetKind()}, rn.GetName(), rn.GetNamespace())
|
||||
}
|
||||
|
||||
// GvknEquals returns true if the other id matches
|
||||
// Group/Version/Kind/name.
|
||||
func (id ResId) GvknEquals(o ResId) bool {
|
||||
|
||||
Reference in New Issue
Block a user