var ( ErrHTTP = errors.Errorf("HTTP Error") ErrRtNotDir = errors.Errorf("must build at directory") )
func IsRemoteFile(path string) bool
IsRemoteFile returns whether path has a url scheme that kustomize allows for remote files. See https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md
func NewLoader( lr LoadRestrictorFunc, target string, fSys filesys.FileSystem) (ifc.Loader, error)
NewLoader returns a Loader pointed at the given target. If the target is remote, the loader will be restricted to the root and below only. If the target is local, the loader will have the restrictions passed in. Regardless, if a local target attempts to transitively load remote bases, the remote bases will all be root-only restricted.
func RestrictionNone( _ filesys.FileSystem, _ filesys.ConfirmedDir, path string) (string, error)
func RestrictionRootOnly( fSys filesys.FileSystem, root filesys.ConfirmedDir, path string) (string, error)
FileLoader is a kustomization's interface to files.
The directory in which a kustomization file sits is referred to below as the kustomization's _root_.
An instance of fileLoader has an immutable root, and offers a `New` method returning a new loader with a new root.
A kustomization file refers to two kinds of files:
* supplemental data paths
`Load` is used to visit these paths. These paths refer to resources, patches, data for ConfigMaps and Secrets, etc. The loadRestrictor may disallow certain paths or classes of paths.
* bases (other kustomizations)
`New` is used to load bases. A base can be either a remote git repo URL, or a directory specified relative to the current root. In the former case, the repo is locally cloned, and the new loader is rooted on a path in that clone. As loaders create new loaders, a root history is established, and used to disallow: - A base that is a repository that, in turn, specifies a base repository seen previously in the loading stack (a cycle). - An overlay depending on a base positioned at or above it. I.e. '../foo' is OK, but '.', '..', '../..', etc. are disallowed. Allowing such a base has no advantages and encourages cycles, particularly if some future change were to introduce globbing to file specifications in the kustomization file.
These restrictions assure that kustomizations are self-contained and relocatable, and impose some safety when relying on remote kustomizations, e.g. a remotely loaded ConfigMap generator specified to read from /etc/passwd will fail.
type FileLoader struct {
// contains filtered or unexported fields
}
func NewLoaderOrDie( lr LoadRestrictorFunc, fSys filesys.FileSystem, path string) *FileLoader
func (fl *FileLoader) Cleanup() error
Cleanup runs the cleaner.
func (fl *FileLoader) Load(path string) ([]byte, error)
Load returns the content of file at the given path, else an error. Relative paths are taken relative to the root.
func (fl *FileLoader) New(path string) (ifc.Loader, error)
New returns a new Loader, rooted relative to current loader, or rooted in a temp directory holding a git repo clone.
func (fl *FileLoader) Repo() string
Repo returns the absolute path to the repo that contains Root if this fileLoader was created from a url or the empty string otherwise.
func (fl *FileLoader) Root() string
Root returns the absolute path that is prepended to any relative paths used in Load.
type LoadRestrictorFunc func( filesys.FileSystem, filesys.ConfirmedDir, string) (string, error)