Documentation ¶
Overview ¶
Package kustomize contains generic helpers for use with kustomize-controller and flux cli.
Index ¶
- Constants
- func Build(fs filesys.FileSystem, dirPath string) (res resmap.ResMap, err error)
- func CleanDirectory(dirPath string, action Action) error
- func IsLocalRelativePath(path string) bool
- func LoadVariables(ctx context.Context, kubeClient client.Client, ...) (map[string]string, error)
- func SecureBuild(root, dirPath string, allowRemoteBases bool) (res resmap.ResMap, err error)
- func SubstituteVariables(ctx context.Context, kubeClient client.Client, ...) (*resource.Resource, error)
- type Action
- type Generator
- type SavingOptions
- type SubstituteOption
- type SubstituteOptions
- type SubstituteReference
Constants ¶
const (
DisabledValue = "disabled"
)
Variables ¶
This section is empty.
Functions ¶
func Build ¶ added in v0.10.0
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.
func IsLocalRelativePath ¶ added in v0.11.0
func LoadVariables ¶ added in v1.15.0
func LoadVariables(ctx context.Context, kubeClient client.Client, kustomization unstructured.Unstructured) (map[string]string, error)
LoadVariables reads the in-line variables set in the Flux Kustomization and merges them with the vars referred in ConfigMaps and Secrets data keys.
func SecureBuild ¶ added in v0.10.0
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
func SubstituteVariables ¶
func SubstituteVariables( ctx context.Context, kubeClient client.Client, kustomization unstructured.Unstructured, res *resource.Resource, opts ...SubstituteOption) (*resource.Resource, error)
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.
Types ¶
type Action ¶ added in v0.0.2
type Action string
Action is the action that was taken on the kustomization file
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is a kustomize generator It is responsible for generating a kustomization.yaml file from - a directory path and a kustomization object
func NewGenerator ¶
func NewGenerator(root string, kustomization unstructured.Unstructured) *Generator
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.
func NewGeneratorWithIgnore ¶ added in v1.1.0
func NewGeneratorWithIgnore(root, ignore string, kustomization unstructured.Unstructured) *Generator
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Ò
func (*Generator) WriteFile ¶
func (g *Generator) WriteFile(dirPath string, opts ...SavingOptions) (Action, error)
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 responsability to clean up the directory by using the provided function CleanDirectory. example: err := CleanDirectory(dirPath, action)
if err != nil { log.Fatal(err) }
type SavingOptions ¶
SavingOptions is a function that can be used to apply saving options to a kustomization
func WithSaveOriginalKustomization ¶
func WithSaveOriginalKustomization() SavingOptions
WithSaveOriginalKustomization will save the original kustomization file
type SubstituteOption ¶ added in v1.9.0
type SubstituteOption func(a *SubstituteOptions)
func SubstituteWithDryRun ¶ added in v1.9.0
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 ¶ added in v1.9.0
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 ¶ added in v1.9.0
SubstituteOptions defines the options for the variable substitutions operation.
type SubstituteReference ¶
type SubstituteReference struct { // Kind of the values referent, valid values are ('Secret', 'ConfigMap'). Kind string `json:"kind"` // Name of the values referent. Should reside in the same namespace as the // referring resource. Name string `json:"name"` // Optional indicates whether the referenced resource must exist, or whether to // tolerate its absence. If true and the referenced resource is absent, proceed // as if the resource was present but empty, without any variables defined. Optional bool `json:"optional,omitempty"` }
SubstituteReference contains a reference to a resource containing the variables name and value.