Documentation
¶
Overview ¶
Package layout is where a writer's files go in a GitOps repository and what one write changes there: every writer (a manager, a CLI) owns one directory under the directory a Flux Kustomization builds from, holding one file per object and its own kustomization.yaml that lists them, and the parent's kustomization.yaml, where there is one, lists the directory. Flux then builds the directory whether the parent has a kustomization.yaml (the entry is added there) or not (Flux generates one that includes every directory with a kustomization.yaml).
Build decides a write against the base branch — which files are added, updated, removed or already there — encrypts new secret files for the repository's .sops.yaml recipients and never re-encrypts one that exists. The plan's Change is what commit.Open lands as the person.
Index ¶
Constants ¶
const KustomizationFile = "kustomization.yaml"
KustomizationFile lists a directory's files for kustomize.
const SOPSConfigFile = ".sops.yaml"
SOPSConfigFile is the repository's encryption rules, read at its root.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Directory ¶
type Directory struct {
provenance.Location
// Name is the writer's directory name, one path segment
// ("cluster-manager", "model-manager").
Name string
}
Directory is a writer's directory: Name under the directory of Location, on its repository and branch.
func (Directory) ObjectFile ¶
ObjectFile is the path of an object's file in the directory: named after the object, a Secret in a secret file of its own (sopsenc's naming convention), so it is encrypted and never written in plaintext.
type File ¶
File is one file of a plan. Content is the new content of an added or updated plain file, for a dry run to show; a secret file's content is never carried.
type Plan ¶
type Plan struct {
Directory Directory
// Files are every file the write decided on, sorted by path — unchanged
// ones included, so a dry run shows the whole directory the write owns.
Files []File
// contains filtered or unexported fields
}
Plan is the change set of one write in a directory.
func Build ¶
func Build(ctx context.Context, r commit.Reader, dir Directory, write map[string][]byte, remove []string) (*Plan, error)
Build decides a write in dir against the base branch: write are the files to land by path, remove the paths to take away (a path the base does not carry is no change); every path lies inside the directory. A plain file is added, updated or unchanged; a new secret file is encrypted for the recipients of the repository's .sops.yaml, one that exists is left as it is. The directory's kustomization.yaml lists every file it keeps and is removed with the last one; the parent's kustomization.yaml, where there is one, lists the directory while it has files. Both are edited on their YAML nodes: comments and every other key stay. Read errors from r are returned as they are (commit.AuthError included).
type SecretError ¶
SecretError refuses secret files the repository cannot take encrypted: no .sops.yaml, one that does not parse, or no creation rule with recipients for their paths. They are never written in plaintext; the caller names its way out.
func (*SecretError) Error ¶
func (e *SecretError) Error() string