Introduce ResId and ResMap.

This commit is contained in:
jregan
2018-05-31 23:22:46 -07:00
committed by Jeffrey Regan
parent 9a5c0f5a25
commit ef71cb478f
39 changed files with 1063 additions and 1447 deletions

View File

@@ -20,7 +20,7 @@ import (
"errors"
"fmt"
"github.com/kubernetes-sigs/kustomize/pkg/resource"
"github.com/kubernetes-sigs/kustomize/pkg/resmap"
"github.com/kubernetes-sigs/kustomize/pkg/types"
)
@@ -57,12 +57,12 @@ func NewNamePrefixTransformer(pc []PathConfig, np string) (Transformer, error) {
}
// Transform prepends the name prefix.
func (o *namePrefixTransformer) Transform(m resource.ResourceCollection) error {
for gvkn := range m {
obj := m[gvkn].Data
func (o *namePrefixTransformer) Transform(m resmap.ResMap) error {
for id := range m {
obj := m[id].Unstruct()
objMap := obj.UnstructuredContent()
for _, path := range o.pathConfigs {
if !types.SelectByGVK(gvkn.GVK, path.GroupVersionKind) {
if !types.SelectByGVK(id.Gvk(), path.GroupVersionKind) {
continue
}
err := mutateField(objMap, path.Path, path.CreateIfNotPresent, o.addPrefix)