krusty

package
v0.0.0-...-59ba1d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package krusty is intended as the entry point package for those seeking to add kustomize ability to other programs.

To use, follow the example of the kustomize CLI's 'build' command. Also, see the high level tests in this package, which serve a dual purpose as examples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuiltinPluginNames

func GetBuiltinPluginNames() []string

GetBuiltinPluginNames returns a list of builtin plugin names

Types

type Kustomizer

type Kustomizer struct {
	// contains filtered or unexported fields
}

Kustomizer performs kustomizations.

It's meant to behave similarly to the kustomize CLI, and can be used instead of performing an exec to a kustomize CLI subprocess. To use, load a filesystem with kustomization files (any number of overlays and bases), then make a Kustomizer injected with the given fileystem, then call Run.

func MakeKustomizer

func MakeKustomizer(o *Options) *Kustomizer

MakeKustomizer returns an instance of Kustomizer.

func (*Kustomizer) Run

func (b *Kustomizer) Run(
	fSys filesys.FileSystem, path string) (resmap.ResMap, error)

Run performs a kustomization.

It reads given path from the given file system, interprets it as a kustomization.yaml file, perform the kustomization it represents, and return the resulting resources.

Any files referenced by the kustomization must be present on the filesystem. One may call Run any number of times, on any number of internal paths (e.g. the filesystem may contain multiple overlays, and Run can be called on each of them).

type Options

type Options struct {
	// When true, sort the resources before emitting them,
	// per a particular sort order.  When false, don't do the
	// sort, and instead respect the depth-first resource input
	// order as specified by the kustomization file(s).
	DoLegacyResourceSort bool

	// When true, a label
	//     app.kubernetes.io/managed-by: kustomize-<version>
	// is added to all the resources in the build out.
	AddManagedbyLabel bool

	// Restrictions on what can be loaded from the file system.
	// See type definition.
	LoadRestrictions types.LoadRestrictions

	// Create an inventory object for pruning.
	DoPrune bool

	// Options related to kustomize plugins.
	PluginConfig *types.PluginConfig

	// TODO(#3588): Delete this field (it's always true).
	// When true, use kyaml/ packages to manipulate KRM yaml.
	// When false, use k8sdeps/ instead (uses k8s.io/api* packages).
	UseKyaml bool

	// When true, allow name and kind changing via a patch
	// When false, patch name/kind don't overwrite target name/kind
	AllowResourceIdChanges bool
}

Options holds high-level kustomize configuration options, e.g. are plugins enabled, should the loader be restricted to the kustomization root, etc.

func MakeDefaultOptions

func MakeDefaultOptions() *Options

MakeDefaultOptions returns a default instance of Options.

func (Options) IfApiMachineryElseKyaml

func (o Options) IfApiMachineryElseKyaml(s1, s2 string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL