Documentation
¶
Overview ¶
Package flux reads Flux HelmReleases and turns them into chart + values targets, resolving their sources, valuesFrom and kustomize overlays.
Index ¶
- func Build(dir string, vars map[string]string, components ...string) ([]byte, error)
- func Get(n *yaml.Node, path ...string) *yaml.Node
- func IsKustomizeDir(dir string) bool
- func IsRelease(o *Object) bool
- func Roots(dir string) ([]string, error)
- func Str(n *yaml.Node, path ...string) string
- func Substitute(data []byte, vars map[string]string) []byte
- func Tree(dir string, components ...string) []string
- type Attributor
- type Index
- type Object
- type Release
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build runs kustomize on dir in process, the way Flux's kustomize-controller does, adding Flux components and applying ${var} substitution to the output.
func IsKustomizeDir ¶
IsKustomizeDir reports whether dir holds a kustomization file.
func IsRelease ¶
IsRelease reports whether o is a full HelmRelease. Partial HelmReleases used as kustomize patches have neither chart nor chartRef.
func Roots ¶
Roots returns the kustomize directories under dir that no other kustomization under dir includes: the overlays to build. When dir itself is a kustomize directory it is the only root.
func Substitute ¶
Substitute applies Flux postBuild-style ${var} and ${var:=default} substitution. Unknown variables without a default are left as they are.
Types ¶
type Attributor ¶
type Attributor struct {
// contains filtered or unexported fields
}
Attributor traces keys of a built HelmRelease back to the files of the build that set them: the base release and every patch, in kustomize order.
func NewAttributor ¶
func NewAttributor(files []string, vars map[string]string) *Attributor
func (*Attributor) File ¶
func (a *Attributor) File(rel *Object) string
File returns the file holding the base definition of the release.
type Index ¶
type Index struct {
Objects []*Object
}
func IndexRepo ¶
IndexRepo indexes every object of every YAML file under root, plus the ConfigMaps declared by configMapGenerator entries. Files that are not valid YAML (Helm templates, for instance) are skipped.
func (*Index) Find ¶
Find returns the object of that kind and name. An object without a namespace matches any namespace (kustomize may set it later). When several match, ConfigMaps from a generator win, then the object whose file is closest to near.
func (*Index) KustomizationFor ¶ added in v0.1.6
KustomizationFor returns the Flux Kustomization whose spec.path is closest above dir.
type Object ¶
type Object struct {
APIVersion string
Kind string
Name string
Namespace string
// File is empty for objects that only exist in a build output.
File string
Doc int
Node *yaml.Node
// Gen is set for ConfigMaps produced by a kustomize configMapGenerator:
// data key -> source file.
Gen map[string]string
}
Object is one Kubernetes object found in the repository or in a kustomize build output.
func TreeGenerators ¶
TreeGenerators returns the ConfigMaps declared by configMapGenerator entries anywhere in dir's build.
type Resolver ¶
type Resolver struct {
RepoRoot string
Sources *Index
// Fallback is searched when Sources has no match, e.g. the whole
// repository when Sources is a kustomize build output.
Fallback *Index
Attribute func(rel *Object, path []string) []values.Origin
// Namespace replaces the releases' own, like a Kustomization's targetNamespace.
Namespace string
}
Resolver turns HelmRelease objects into releases. Sources, ConfigMaps and Secrets are looked up in Sources. In build mode the HelmRelease comes from a kustomize output and Attribute traces its values back to files.