Documentation ¶
Index ¶
- Constants
- func RegisterFilter(kind string, fn func() kio.Filter)
- func SkipBadRead(log logr.Logger, basePath string) kio.LocalPackageSkipFileFunc
- type Dispatcher
- func (d *Dispatcher) ApplyFilteredFuncs(filteredFuncs []*yaml.RNode) error
- func (d *Dispatcher) GetAllFuncs(sourceDir []string) (kio.PackageBuffer, error)
- func (d *Dispatcher) RemoveOverlayOnHydratedFiles(filesToHydrate []string, sourceRoot string) (map[TargetPath]bool, error)
- func (d *Dispatcher) RunOnDir(sourceDir string, functionPaths []string) error
- func (d *Dispatcher) SetFuncPaths(buff kio.PackageBuffer, hydratedPath string, sourceRoot string, ...) error
- func (d *Dispatcher) SortFns(buff kio.PackageBuffer) error
- type TargetPath
Constants ¶
const ( // SourceFunctionPath the source dir key where you can find a function in question SourceFunctionPath = "sourcefunctionpath" // FunctionTargetDir the target dir key for a function to be applied too FunctionTargetDir = "targetdir" )
const (
// KustomizationType the type of kustomization file
KustomizationType = "kustomization.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterFilter ¶
RegisterFilter registers a function with the dispatcher
func SkipBadRead ¶
func SkipBadRead(log logr.Logger, basePath string) kio.LocalPackageSkipFileFunc
SkipBadRead tries to read a file and returns true if there is an error, false otherwise. Used with kio.LocalPackageReader to skip yaml files that aren't parsable by kustomize. mostly copied from kio.readFile: https://github.com/kubernetes-sigs/kustomize/blob/a0c7997b6647d78a9b8f7c2f320bf7efb8256423/kyaml/kio/pkgio_reader.go#L258
Types ¶
type Dispatcher ¶
Dispatcher dispatches to the matching API
func (*Dispatcher) ApplyFilteredFuncs ¶
func (d *Dispatcher) ApplyFilteredFuncs(filteredFuncs []*yaml.RNode) error
ApplyFilteredFuncs will apply all the functions to its specific directory, as
func (*Dispatcher) GetAllFuncs ¶
func (d *Dispatcher) GetAllFuncs(sourceDir []string) (kio.PackageBuffer, error)
GetAllFuncs gets all functions from the supplied source directory
func (*Dispatcher) RemoveOverlayOnHydratedFiles ¶
func (d *Dispatcher) RemoveOverlayOnHydratedFiles(filesToHydrate []string, sourceRoot string) (map[TargetPath]bool, error)
RemoveOverlayOnHydratedFiles will return a map of targetpaths that are separated by their overlay
func (*Dispatcher) RunOnDir ¶
func (d *Dispatcher) RunOnDir(sourceDir string, functionPaths []string) error
RunOnDir dispatches the functionPath on the supplied sourceDirectory
func (*Dispatcher) SetFuncPaths ¶
func (d *Dispatcher) SetFuncPaths(buff kio.PackageBuffer, hydratedPath string, sourceRoot string, leafPaths map[TargetPath]bool) error
SetFuncPaths function adds 2 annotations; sourcefunctionpath that will be the source of where the functionpath lies; targetdir is the target directory we need to apply the function too. This allows functions to be stored in a different directory than the target directory and just applying the functions to the files below that directory. leafPaths should be set if you are using Syncer and running kustomize build and then applying KPT functions to the kustomize build output. The convention in hydros is to treat the final directory as an overlay and strip that directory from the target name.
However, when applying KRM functions in place you can set leafPaths to nil
func (*Dispatcher) SortFns ¶
func (d *Dispatcher) SortFns(buff kio.PackageBuffer) error
SortFns sorts functions so that functions with the longest paths come first copied from the kustomize library https://github.com/kubernetes-sigs/kustomize/blob/3ebdb3fcef66580417d18f44ac20572469e41fa5/kyaml/runfn/runfn.go#L337
type TargetPath ¶
TargetPath to get target Dir and OverlayName by calling GenerateTargetPath
func GenerateTargetPath ¶
func GenerateTargetPath(sourceBase string, kustomization string) (TargetPath, error)
GenerateTargetPath is a helper function to generate the path where hydrated manifests should be generated. sourceBase base for searching for overlays to generate