mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #4944 from ephesused/optimize-getannotations-2
Refactor mapping node traversal and optimize RNode.GetAnnotations and RNode.GetLabels
This commit is contained in:
@@ -35,7 +35,10 @@ func PrevIds(n *yaml.RNode) ([]resid.ResId, error) {
|
||||
var ids []resid.ResId
|
||||
// TODO: merge previous names and namespaces into one list of
|
||||
// pairs on one annotation so there is no chance of error
|
||||
annotations := n.GetAnnotations()
|
||||
annotations := n.GetAnnotations(
|
||||
BuildAnnotationPreviousNames,
|
||||
BuildAnnotationPreviousNamespaces,
|
||||
BuildAnnotationPreviousKinds)
|
||||
if _, ok := annotations[BuildAnnotationPreviousNames]; !ok {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -51,6 +54,7 @@ func PrevIds(n *yaml.RNode) ([]resid.ResId, error) {
|
||||
}
|
||||
apiVersion := n.GetApiVersion()
|
||||
group, version := resid.ParseGroupVersion(apiVersion)
|
||||
ids = make([]resid.ResId, 0, len(names))
|
||||
for i := range names {
|
||||
gvk := resid.Gvk{
|
||||
Group: group,
|
||||
|
||||
Reference in New Issue
Block a user