diff --git a/pkg/skaffold/render/renderer/kustomize/kustomize.go b/pkg/skaffold/render/renderer/kustomize/kustomize.go index ca8ab8f72b9..05aff58ef03 100644 --- a/pkg/skaffold/render/renderer/kustomize/kustomize.go +++ b/pkg/skaffold/render/renderer/kustomize/kustomize.go @@ -298,6 +298,18 @@ func (k Kustomize) mirrorResources(kusDir string, fs TmpFS, resources []string) return nil } +func (k Kustomize) mirrorComponents(kusDir string, fs TmpFS, components []string) error { + for _, c := range components { + // note that c is relative to kustomization file not working dir here + cPath := filepath.Join(kusDir, c) + + if err := k.mirror(cPath, fs); err != nil { + return err + } + } + return nil +} + func (k Kustomize) mirrorFile(kusDir string, fs TmpFS, path string) error { if sUtil.IsURL(path) { return nil @@ -408,27 +420,6 @@ func (k Kustomize) mirrorConfigMapGenerators(kusDir string, fs TmpFS, args []typ return nil } -func (k Kustomize) mirrorComponents(kusDir string, fs TmpFS, components []string) error { - for _, r := range components { - // note that r is relative to kustomization file not working dir here - rPath := filepath.Join(kusDir, r) - stat, err := os.Stat(rPath) - if err != nil { - return err - } - if stat.IsDir() { - if err := k.mirror(rPath, fs); err != nil { - return err - } - } else { - if err := k.mirrorFile(kusDir, fs, r); err != nil { - return err - } - } - } - return nil -} - func kustomizeDependencies(workdir string, paths []string) ([]string, error) { deps := stringset.New() for _, kustomizePath := range paths {