kustomize package - github.com/fluxcd/pkg/kustomize - Go Packages

Package kustomize contains generic helpers for use with kustomize-controller and flux cli.

This section is empty.

Build wraps krusty.MakeKustomizer with the following settings: - load files from outside the kustomization.yaml root - disable plugins except for the builtin ones

func CleanDirectory

CleanDirectory removes the kustomization.yaml file from the given directory.

LoadVariables reads the in-line variables set in the Flux Kustomization and merges them with the vars referred in ConfigMaps and Secrets data keys.

Secure Build wraps krusty.MakeKustomizer with the following settings:

  • secure on-disk FS denying operations outside root
  • load files from outside the kustomization dir path (but not outside root)
  • disable plugins except for the builtin ones

SubstituteVariables replaces the vars with their values in the specified resource. If a resource is labeled or annotated with 'kustomize.toolkit.fluxcd.io/substitute: disabled' the substitution is skipped.

Action is the action that was taken on the kustomization file

const (
	
	CreatedAction Action = "created"
	
	UnchangedAction Action = "unchanged"
)
type Generator struct {
	
}

Generator is a kustomize generator It is responsible for generating a kustomization.yaml file from - a directory path and a kustomization object

NewGenerator creates a new kustomize generator It takes a root directory and a kustomization object If the root is empty, no enforcement of the root directory will be done when handling paths.

NewGeneratorWithIgnore creates a new kustomize generator It takes a root directory, a kustomization object and a string of files to ignore The generator will combine the ignore files with the default ignore files i.e. .sourceignoreÒ

WriteFile generates a kustomization.yaml in the given directory if it does not exist. It apply the flux kustomize resources to the kustomization.yaml and then write the updated kustomization.yaml to the directory. It returns an action that indicates if the kustomization.yaml was created or not. It is the caller's responsibility to clean up the directory by using the provided function CleanDirectory. example: err := CleanDirectory(dirPath, action)

if err != nil {
	log.Fatal(err)
}
type SavingOptions func(dirPath, file string, action Action) error

SavingOptions is a function that can be used to apply saving options to a kustomization

func WithSaveOriginalKustomization() SavingOptions

WithSaveOriginalKustomization will save the original kustomization file

type SubstituteOption func(a *SubstituteOptions)
func SubstituteWithDryRun(dryRun bool) SubstituteOption

SubstituteWithDryRun sets the dryRun option. When dryRun is true, the substitution process will not attempt to talk to the cluster.

func SubstituteWithStrict(strict bool) SubstituteOption

SubstituteWithStrict sets the strict option. When strict is true, the substitution process will fail if a var without a default value is declared in files but is missing from the input vars.

type SubstituteOptions struct {
	DryRun bool
	Strict bool
}

SubstituteOptions defines the options for the variable substitutions operation.

type SubstituteReference struct {
	
	Kind string `json:"kind"`

	
	
	Name string `json:"name"`

	
	
	
	Optional bool `json:"optional,omitempty"`
}

SubstituteReference contains a reference to a resource containing the variables name and value.