Documentation
¶
Overview ¶
Package kustomize contains generic helpers for use with kustomize-controller and flux cli.
Index ¶
- Constants
- func BuildKustomization(fs filesys.FileSystem, dirPath string) (resmap.ResMap, error)
- func CleanDirectory(dirPath string, action Action) error
- func SubstituteVariables(ctx context.Context, kubeClient client.Client, ...) (*resource.Resource, error)
- type Action
- type Generator
- type SavingOptions
- type SubstituteReference
Constants ¶
const (
DisabledValue = "disabled"
)
Variables ¶
This section is empty.
Functions ¶
func BuildKustomization ¶
BuildKustomization 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 SubstituteVariables ¶
func SubstituteVariables( ctx context.Context, kubeClient client.Client, kustomization unstructured.Unstructured, res *resource.Resource) (*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(kustomization unstructured.Unstructured) *Generator
NewGenerator creates a new kustomize generator
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 responsability to clean up the directory by use 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 SubstituteReference ¶
SubstituteReference contains a reference to a resource containing the variables name and value.