Added code for fields with dots(.) in their names work as needed (#4591)

* Added code for fields with dots(.) in their names work as needed

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Fixed imports

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Removed comments

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Fix filter method

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Fixed failing tests

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Remove comments

Add co-author to PR.

Co-authored-by: sarjamil <sjamil@salesforce.com>

* Add co-author to PR.

Co-authored-by: sarjamil sjamil@salesforce.com

Co-authored-by: sarjamil <sjamil@salesforce.com>
This commit is contained in:
annelausf
2022-05-02 14:30:33 -07:00
committed by GitHub
parent 233b6adf7e
commit 188e35fbfd
6 changed files with 7 additions and 9 deletions

View File

@@ -8,10 +8,10 @@ import (
"strings"
"sigs.k8s.io/kustomize/api/filters/filtersutil"
"sigs.k8s.io/kustomize/api/internal/utils"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/errors"
"sigs.k8s.io/kustomize/kyaml/resid"
"sigs.k8s.io/kustomize/kyaml/utils"
"sigs.k8s.io/kustomize/kyaml/yaml"
)

View File

@@ -12,6 +12,7 @@ import (
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/resid"
kyaml_utils "sigs.k8s.io/kustomize/kyaml/utils"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
@@ -114,7 +115,7 @@ func rejectId(rejects []*types.Selector, id *resid.ResId) bool {
func applyToNode(node *yaml.RNode, value *yaml.RNode, target *types.TargetSelector) error {
for _, fp := range target.FieldPaths {
fieldPath := utils.SmarterPathSplitter(fp, ".")
fieldPath := kyaml_utils.SmarterPathSplitter(fp, ".")
var t *yaml.RNode
var err error
if target.Options != nil && target.Options.Create {
@@ -199,7 +200,7 @@ func getReplacement(nodes []*yaml.RNode, r *types.Replacement) (*yaml.RNode, err
if r.Source.FieldPath == "" {
r.Source.FieldPath = types.DefaultReplacementFieldPath
}
fieldPath := utils.SmarterPathSplitter(r.Source.FieldPath, ".")
fieldPath := kyaml_utils.SmarterPathSplitter(r.Source.FieldPath, ".")
rn, err := source.Pipe(yaml.Lookup(fieldPath...))
if err != nil {