...

Package localizer

import "sigs.k8s.io/kustomize/api/internal/localizer"
Overview
Index

Overview ▾

Package localizer contains utilities for the command kustomize localize, which is documented under proposals/localize-command or at https://github.com/kubernetes-sigs/kustomize/blob/master/proposals/22-04-localize-command.md

Constants

const (
    // DstPrefix prefixes the target and ref, if target is remote, in the default localize destination directory name
    DstPrefix = "localized"

    // LocalizeDir is the name of the localize directories used to store remote content in the localize destination
    LocalizeDir = "localized-files"

    // FileSchemeDir is the name of the directory immediately inside LocalizeDir used to store file-schemed repos
    FileSchemeDir = "file-schemed"
)

func NewLoader

func NewLoader(rawTarget string, rawScope string, rawNewDir string, fSys filesys.FileSystem) (*Loader, Args, error)

NewLoader is the factory method for Loader, under localize constraints, at rawTarget. For invalid localize arguments, NewLoader returns an error.

func Run

func Run(target, scope, newDir string, fSys filesys.FileSystem) (string, error)

Run attempts to localize the kustomization root at target with the given localize arguments and returns the path to the created newDir.

type Args

Args holds localize arguments

type Args struct {
    // target; local copy if remote
    Target filesys.ConfirmedDir

    // directory that bounds target's local references
    // repo directory of local copy if target is remote
    Scope filesys.ConfirmedDir

    // localize destination
    NewDir filesys.ConfirmedDir
}

type Loader

Loader is an ifc.Loader that enforces additional constraints specific to kustomize localize.

type Loader struct {

    // loader at Loader's current directory
    ifc.Loader
    // contains filtered or unexported fields
}

func (*Loader) Load

func (ll *Loader) Load(path string) ([]byte, error)

Load returns the contents of path if path is a valid localize file. Otherwise, Load returns an error.

func (*Loader) New

func (ll *Loader) New(path string) (ifc.Loader, error)

New returns a Loader at path if path is a valid localize root. Otherwise, New returns an error.

type PathLocalizeError

type PathLocalizeError struct {
    Path      string
    FileError error
    RootError error
}

func (PathLocalizeError) Error

func (ple PathLocalizeError) Error() string

type ResourceLoadError

type ResourceLoadError struct {
    InlineError error
    FileError   error
}

func (ResourceLoadError) Error

func (rle ResourceLoadError) Error() string