kustomize

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 10 Imported by: 2

Documentation

Overview

Package kustomize provides tools to interact with kustomization files. Kustomization files can be easily loaded, modified, written and built using the helpers the package provides.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kustomize

func Kustomize(fs filesys.FileSystem, path string) (result []byte, err error)

Kustomize takes a filesystem and a kustomization configuration and runs the kustomization on the filesystem. It returns the result of kustomization.

func LoadKustomization

func LoadKustomization(content []byte) (*apitypes.Kustomization, error)

LoadKustomization loads the byte content into a Kustomization object and returns it. It also performs some basic validation.

func LoadKustomizationFromPackage

func LoadKustomizationFromPackage(fs filesys.FileSystem, path string) (*apitypes.Kustomization, error)

LoadKustomizationFromPackage loads and returns Kustomization object from a given package path.

func Mutate

func Mutate(k *apitypes.Kustomization, funcs []MutateFunc)

Mutate takes a Kustomization object and a list of mutations to apply and applies all the mutations.

func MutateAndKustomize

func MutateAndKustomize(fs filesys.FileSystem, mutateFuncs []MutateFunc, path string) ([]byte, error)

MutateAndKustomize applies all the mutations to a kustomization in a package, runs kustomize and returns the result.

func WriteKustomizationInPackage

func WriteKustomizationInPackage(fs filesys.FileSystem, k *apitypes.Kustomization, path string) error

WriteKustomizationInPackage takes a filesystem, a kustomization object and a package path and writes the kustomization file in the package.

Types

type MutateFunc

type MutateFunc func(k *apitypes.Kustomization)

MutateFunc is a type for the kustomization mutate functions.

func AddCommonAnnotations

func AddCommonAnnotations(annotations map[string]string) MutateFunc

AddCommonLabels returns a MutateFunc which adds common annotations to a kustomization object.

func AddCommonLabels

func AddCommonLabels(labels map[string]string) MutateFunc

AddCommonLabels returns a MutateFunc which adds common labels to a kustomization object.

func AddImages

func AddImages(images []apitypes.Image) MutateFunc

AddImages returns a MutateFunc which adds images to kustomization object. NOTE: In kustomization, if an images list contains duplicate entries for the same name, the first entry takes precedence. To avoid confusion, any existing entry with the same name is updated with the new entry.

func AddNamePrefix

func AddNamePrefix(prefix string) MutateFunc

AddNamePrefix returns a MutateFunc which adds namePrefix to kustomization object.

func AddNameSuffix

func AddNameSuffix(suffix string) MutateFunc

AddNameSuffix returns a MutateFunc which adds nameSuffix to kustomization object.

func AddNamespace

func AddNamespace(namespace string) MutateFunc

AddNamespace returns a MutateFunc which adds a namespace to kustomization object.

func AddResources

func AddResources(resources []string) MutateFunc

AddResources returns a MutateFunc which adds resources to kustomization object.

Jump to

Keyboard shortcuts

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